mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-11-10 20:48:12 +00:00
net: mdio: realtek-rtl9300: Configure hardware polling during probing
During PHY probing and configuration complex configuration sequences might be issued and firmware might be loaded. Hardware polling can interfere badly with that. E.g. a hardware polling MMD c45 over c22 request might break an ongoing firmware loading sequence. To avoid such issues the polling of the Realtek Otto switches can be (de)activated with one or two 32 bit mask registers. Each bit enables (=1) or disables (=0) the polling of the corresponding port. Make use of this as follows: - Disable polling for all ports when the MDIO driver starts. - Reenable polling just after the PHY has been attached. - Disable polling just before the PHY is being detached. This synchronizes the kernel and hardware polling to some extent. It gracefully handles deferred probing of PHYs in case the driver is loaded asynchronously during boot. Additionally it brings the hardware polling into a consistent operation mode for devices where U-Boot does not take care. Important notes about the implementation: Realtek is very inconsistent about its register naming. RTL930x uses SMI_POLL_CTRL for polling control while it is SMI_PORT_POLLING_CTRL on RTL931x. Keep these vendor names. These devices do not support power management for the whole system. So mdio_bus_phy_resume() is not used and it is not required to disable/enable hardware polling for that usecase. These devices have no CPU MAC to PHY design. Thus abort phy_attach() in case PHYs are not mapped to valid switch ports. All MDIO bus commands will fail afterwards, leaving it in an unusable state. Enabling/disabling hardware polling is a simple regmap bit access. For this it is enough to rely on the regmap internal lock. This polling enabling/disabling does not solve the current inability of the driver to handle C45-over-C22 access during normal operation. For all existing designs this is not needed. [1] https://github.com/openwrt/openwrt/blob/main/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c#L818 [2] https://lore.kernel.org/netdev/680696024a8648535ce6dee771fe4de67802e0e8.1769053496.git.daniel@makrotopia.org/ Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://patch.msgid.link/20260831143439.2404484-8-markus.stockhausen@gmx.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
fe7a07ff51
commit
ee18e22c63
1 changed files with 61 additions and 0 deletions
Loading…
Add table
Add a link
Reference in a new issue