realtek: pcs: rtl93xx: provide proper SerDes polarity configuration
authorJonas Jelonek <[email protected]>
Tue, 4 Nov 2025 21:27:07 +0000 (21:27 +0000)
committerHauke Mehrtens <[email protected]>
Sun, 9 Nov 2025 16:48:10 +0000 (17:48 +0100)
commit56e9a73d0b169ed2a7bb48fb5caddb70099d65c9
tree0a6da8210ef6490875dc2b63b49d6e8a8bab8b04
parent627a0e7da0c84de6744c6453ef2ce8f5b4bf41dc
realtek: pcs: rtl93xx: provide proper SerDes polarity configuration

The configuration code for RTL930X already provides setting the SerDes
TX and RX PN polarity. This is covered by a function called
'..._sds_mac_link_config'. But despite its name, this function only sets
the SerDes polarity and nothing more.

Moreover, this was called always with 'not inverted' in the SerDes setup
code and thus not really allowing to be configured.

At first, streamline the SerDes polarity configuration code. Rename the
function to reflect what it actually does instead of giving the
impression of doing more. Improve the implementation of this for better
readability.

As the implementation, page, register, bits, etc. are exactly the same
for both RTL930X and RTL931X (compare [1] and [2]), move and name it
accordingly so we can also add support for RTL931X.

[1] https://github.com/plappermaul/realtek-doc/blob/69d2890a2e2d7a03df6e40e2cd2c32ff5b074dcf/sources/rtk-xgs1210/src/hal/phy/phy_rtl9300.c#L1384
[2] https://github.com/plappermaul/realtek-doc/blob/69d2890a2e2d7a03df6e40e2cd2c32ff5b074dcf/sources/rtk-xgs1210/src/hal/phy/phy_rtl9310.c#L3479

Signed-off-by: Jonas Jelonek <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20648
Signed-off-by: Hauke Mehrtens <[email protected]>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c