On 05/24/2017 04:36 PM, Florian Fainelli wrote:
OK, and there is no way you can run into the following race condition:

CPU                             HW
MDIO read intent
                                polling starts
disable HW autopoll
                                polling continues

Disabling of the HW autopoll waits for the poll to actually stop before continuing. You can see the code here:

http://elixir.free-electrons.com/linux/latest/source/drivers/net/ethernet/qualcomm/emac/emac-phy.c#L102

MDIO read is done
                                MDIO read done
                                polling stops
MDIO read value returned


if you disable autopolling in HW this is guaranteed to immediately stop
by the time the register value is seen in HW and your I/O read/write
returns?

It doesn't immediately stop, but the emac_phy_mdio_autopoll_disable() function waits for the MDIO bus to not be busy. But low-level details of this feature are not documented, so who knows what it does exactly? The original code that used this feature only supported one PHY and never expected there to be any asynchronous MDIO transactios.

--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

Reply via email to