Re: FEC MDIO read timeout on linkup
From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-05-03 22:18:12
I'm wondering could this be related to fec_enet_adjust_link()->fec_restart() during a fec_enet_mdio_read() and one of the many register write in fec_restart() just creates the issue, maybe while resetting the FEC? Does this makes any sense?
phylib is 'single threaded', in that only one thing will be active at
once for a PHY. While fec_enet_adjust_link() is being called, there
will not be any read/writes occurring for that PHY.
However, each PHY in the system runs on its own. If you have multiple
PHYs sharing one MDIO bus, or an Ethernet switch on the bus, they can
be doing read/writes at the same time.
The mdio bus has a lock which prevents actual transactions on the bus
at the same time. Nothing in phylib means that lock is held when
fec_enet_adjust_link() is called, so another PHY could be making MDIO
transfers. If fec_enet_adjust_link() is going to do bad things with
the MDIO bus master, it needs to hold the MDIO lock while doing it.
Andrew