]> git.ipfire.org Git - thirdparty/openwrt.git/commit
realtek: pcs: switch SerDes polarity to {rx,tx}-polarity 23044/head
authorJonas Jelonek <jelonek.jonas@gmail.com>
Wed, 22 Apr 2026 08:33:56 +0000 (08:33 +0000)
committerRobert Marko <robimarko@gmail.com>
Fri, 24 Apr 2026 08:13:38 +0000 (10:13 +0200)
commit90c0a37ddce63a27abbcea7191811ca2194c0a86
treeb4d6ee4c3e10c4b56aa815203ae4b6cf9b259f8c
parent32710715799d753c4f32d8767e219706f7e6e8f2
realtek: pcs: switch SerDes polarity to {rx,tx}-polarity

With the recent backport of the common PHY properties infrastructure
(phy-common-props and the phy_get_manual_{rx,tx}_polarity() helpers) to
OpenWrt, the generic `{rx,tx}-polarity` device tree properties are now
usable for the Realtek PCS driver. Switch the driver and all affected
boards from the local vendor-specific `realtek,pnswap-{rx,tx}` booleans
to the common properties.

Add a `config_polarity` SerDes op (implemented by RTL930x and RTL931x;
RTL838x/RTL839x polarity support not yet added) and a generic wrapper
that resolves the requested polarity via phy_get_manual_{rx,tx}_polarity()
and dispatches to the op. Variants without the op silently accept the
default polarity but warn when a non-default polarity is requested,
since that cannot be honored.

Move the polarity programming out of the variant setup_serdes callbacks
into rtpcs_pcs_config, so it runs before setup_serdes. This matches the
ordering used by the vendor SDK, which configures polarity first.

Update all board DTS files that previously used `realtek,pnswap-{rx,tx}`
to the new `{rx,tx}-polarity = <PHY_POL_INVERT>` property, and select
PHY_COMMON_PROPS from Kconfig.

Each SerDes now retains its DT node for later polarity lookup. Use
for_each_child_of_node_scoped for the iterator, and register a
devm_add_action_or_reset for each stored reference so it is released on
unbind or probe failure.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23044
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/dts/rtl9311_linksys_lgs352c.dts
target/linux/realtek/dts/rtl9313_xikestor_sks8300-12x-v1.dts
target/linux/realtek/dts/rtl9313_zyxel_xs1930-10.dts
target/linux/realtek/dts/rtl9313_zyxel_xs1930-12f.dts
target/linux/realtek/dts/rtl9313_zyxel_xs1930-12hp.dts
target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c
target/linux/realtek/patches-6.18/730-add-pcs-rtl-otto.patch