realtek: enhance RTL930x SerDes/PLL/CMU interoperability
authorMarkus Stockhausen <[email protected]>
Mon, 23 Jun 2025 18:12:05 +0000 (14:12 -0400)
committerRobert Marko <[email protected]>
Fri, 11 Jul 2025 08:05:52 +0000 (10:05 +0200)
commitd2108c2c5896dcc878c7d65d8c3cd9c5b616dfae
tree6e868355ff595dc6a369e3c948288ad025aff12b
parenta854d833eabdbc3b42065927c136d75b981a1021
realtek: enhance RTL930x SerDes/PLL/CMU interoperability

The operating mode of a SerDes must be aligned with the attached PHY or
SFP module. That does not only require to change the protocol (e.g. SGMII,
10Gbase-R, ...) but also the speed (e.g. 1.25G). For this the SerDes must
be re-initialized properly.

- It must be taken into power down
- The PLL speed must be set
- Maybe the CMU (clock management unit) must be resetted
- The new mode must be set
- The state machine must be resetted
- The power must be reactivated

Until now this sequence is bugged. First the driver relies on a clean
setup from U-Boot (rtk network on) and second trying to to change mode
and PLL speeds does not work at all. And not to forget: Currently two
adjacent SerDes cannot drive SGMII/HSGMII at the same time. Fix this by
taking care about the right SerDes/PLL/CMU command init order.

P.S. This code is inspired by the work of Jan Hofmann, who tried to
enable parallel SGMII/HSGMII mode. The only missing bit was a proper CMU
reset sequence.

Signed-off-by: Jan Hoffmann <[email protected]>
Signed-off-by: Markus Stockhausen <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/19220
Signed-off-by: Robert Marko <[email protected]>
target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c