[PATCH v3 0/4] phy: add common PHY polarity properties support
Lucien.Jheng
lucienzx159 at gmail.com
Sun Apr 5 16:49:40 CEST 2026
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.
Patches 3-4 add sandbox DM unit tests for the new library, ported from
the Linux KUnit test (linux/drivers/phy/phy-common-props-test.c). Patch 3
adds the build rule in test/dm/Makefile and 16 unit test cases (8 for rx,
8 for tx) covering: missing property, single value with no names array,
count mismatches, name-based lookup, missing default fallback, default
fallback, and unsupported polarity value. Patch 4 adds the corresponding
8 test DT nodes to arch/sandbox/dts/test.dts.
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 (4):
phy: add common PHY properties support
net: phy: air_en8811h: use standard rx-polarity/tx-polarity properties
test: dm: add PHY common props unit tests
sandbox: dts: add PHY common props test nodes
arch/sandbox/dts/test.dts | 60 +++++
drivers/net/phy/airoha/Kconfig | 1 +
drivers/net/phy/airoha/air_en8811.c | 58 +++--
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 +++++++++++++++++++++++++++
9 files changed, 789 insertions(+), 14 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
More information about the U-Boot
mailing list