[PATCH v4 0/3] phy: add common PHY polarity properties support

Jerome Forissier jerome.forissier at arm.com
Wed May 6 10:57:17 CEST 2026


On 25/04/2026 10:06, Lucien.Jheng wrote:
> This series ports PHY polarity inversion support via generic device tree
> properties from Linux kernel, synchronizing with Merge tag 'phy-for-7.0'
> of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy.
> 
> Patch 1 introduces a new PHY_COMMON_PROPS library providing helper
> functions (phy_get_rx_polarity, phy_get_tx_polarity, and their
> "manual" variants) for PHY drivers to read standard polarity properties
> from the device tree. The PHY_POL_NORMAL, PHY_POL_INVERT, and
> PHY_POL_AUTO constants are consumed from dts/upstream/include, which is
> already on the compiler include path.
> 
> Patch 2 updates the Airoha EN8811H PHY driver to use the new standard
> rx-polarity and tx-polarity properties, with backward compatibility
> fallback to the now-deprecated airoha,pnswap-rx and airoha,pnswap-tx
> boolean properties.
> 
> Patch 3 adds sandbox DM unit tests for the new library, ported from
> the Linux KUnit test (linux/drivers/phy/phy-common-props-test.c), along
> with the 8 sandbox DT test nodes in arch/sandbox/dts/test.dts and the
> CONFIG_PHY_COMMON_PROPS=y entry in configs/sandbox_defconfig. 16 unit
> test cases (8 for rx, 8 for tx) cover: missing property, single value
> with no names array, count mismatches, name-based lookup, missing
> default fallback, default fallback, and unsupported polarity value.
> 
> Changes in v4:
> - Squash former patches 3 and 4 into a single patch to fix bisectability
>   (the test code referenced DT nodes that were only added in the
>   following patch)
> - Add CONFIG_PHY_COMMON_PROPS=y to configs/sandbox_defconfig
> - patch 1: replace printf with pr_err for error-condition messages in
>   phy-common-props.c
> - patch 2: use phy_string_for_interface() instead of direct array access
>   phy_interface_strings[] in en8811h_config_serdes_polarity()
> - patch 2: remove unused local variables ofnode node and u32 pbus_value
>   from en8811h_config()
> 
> Changes in v3:
> - patch 1: fix ofnode_get_u32_prop_for_name() to apply default_val and
>   return 0 when the polarity property is absent, instead of returning
>   -ENOENT; update @node and @default_val kdoc accordingly — this aligns
>   the "missing property" path with the behaviour expected by
>   phy_get_manual_rx/tx_polarity() and is validated by the new unit tests
> - Add unit tests for the PHY_COMMON_PROPS library (patches 3-4), ported
>   from Linux KUnit test linux/drivers/phy/phy-common-props-test.c
> - Add test/dm/Makefile build entry gated on CONFIG_PHY_COMMON_PROPS
> - Add 8 sandbox DT nodes to arch/sandbox/dts/test.dts covering all test
>   scenarios; include <dt-bindings/phy/phy.h> in test.dts
> 
> Changes in v2:
> - Drop DT binding patches (v1 patches 1 and 3): already merged via
>   the DTS upstream subtree merge (tag 'v7.0-rc2-dts')
> - Drop creation of include/dt-bindings/phy/phy.h: the header is now
>   provided by dts/upstream/include/dt-bindings/phy/phy.h, which is
>   already in the build's include search path
> 
> Lucien.Jheng (3):
>   phy: add common PHY properties support
>   net: phy: airoha: air_en8811: use standard rx-polarity/tx-polarity properties
>   test: dm: add PHY common props unit tests and sandbox DT nodes
> 
>  arch/sandbox/dts/test.dts            |  60 +++++
>  configs/sandbox_defconfig            |   1 +
>  drivers/net/phy/airoha/Kconfig       |   1 +
>  drivers/net/phy/airoha/air_en8811.c  |  60 +++--
>  drivers/phy/Kconfig                  |   8 +
>  drivers/phy/Makefile                 |   1 +
>  drivers/phy/phy-common-props.c       | 286 ++++++++++++++++++++++++
>  include/linux/phy/phy-common-props.h |  69 ++++++
>  test/dm/Makefile                     |   1 +
>  test/dm/phy_common_props.c           | 319 +++++++++++++++++++++++++++
>  10 files changed, 790 insertions(+), 16 deletions(-)
>  create mode 100644 drivers/phy/phy-common-props.c
>  create mode 100644 include/linux/phy/phy-common-props.h
>  create mode 100644 test/dm/phy_common_props.c
> 
> --
> 2.34.1
> 

Series added to the net queue, thanks!

-- 
Jerome


More information about the U-Boot mailing list