Re: FEC MDIO read timeout on linkup
From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-05-02 18:21:19
Could it be that the issue is writing the MSCR in fec_restart(), `writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED)`? I do see the issue on link up/down event, when this function is actually called.quoted
From what I can understand from the previous history:1e6114f51f9d (net: fec: fix MDIO probing for some FEC hardware blocks, 2020-10-28) f166f890c8f0 (net: ethernet: fec: Replace interrupt driven MDIO with polled IO, 2020-05-02) writing to this register could trigger a FEC_ENET_MII interrupt actually creating a race condition with fec_enet_mdio_read() that is called on link change also.
You should read the discussion from when this code was added.
Are you planning on adding:
if (fep->quirks & FEC_QUIRK_CLEAR_SETUP_MII) {
/* Clear MMFR to avoid to generate MII event by writing MSCR.
* MII event generation condition:
* - writing MSCR:
* - mmfr[31:0]_not_zero & mscr[7:0]_is_zero &
* mscr_reg_data_in[7:0] != 0
* - writing MMFR:
* - mscr[7:0]_not_zero
*/
writel(0, fep->hwp + FEC_MII_DATA);
}
To other locations which change FEC_MII_SPEED?
Andrew