Re: [PATCH net-next v2 2/8] net: mdio: realtek-rtl9300: Add page tracking
From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-06-29 16:29:01
Also in:
linux-devicetree
On Mon, Jun 29, 2026 at 05:23:30PM +0200, Markus Stockhausen wrote:
The hardware polling unit of the Realtek switches has a very special handling for PHY register 31 (aka Realtek page register) in place. - On the RTL838x it is permanently reset to zero. - On other devices there is some magic saving/restoring (aka parking) in the background in place. This makes access to PHYs a gamble. As of now all known existing hardware designs have Realtek based 1G PHYs. Otherwise the polling engine and the MAC status update will not work at all and the vendor SDK would fail totally.
If you are going this direction, then please somehow validate the PHY is a realtek PHY, and error out if it is not.
This driver differentiates clearly between c22 and c45 buses. During probing it enables only one of the protocols for a bus. So it is safe to assume that any c22 access will only target a Realtek based 1G PHY. Intercept access to register 31 and store the desired value for each port in the driver. When issuing access to other registers add the saved page. This given, the hardware will run two consecutive c22 commands that are not interrupted by polling. ... hardware poll ... phy_write(phy, 31, page) phy_write(phy, reg, value) ... hardware poll ...
How do you guarantee the polling will not get between? Andrew