Re: [PATCH net-next] net: phy: broadcom: Implement suspend/resume for AC131 and BCM5241

From: Russell King (Oracle)
Date: Mon Aug 15 2022 - 14:01:20 EST


On Mon, Aug 15, 2022 at 10:43:56AM -0700, Florian Fainelli wrote:
> + /* We cannot use a read/modify/write here otherwise the PHY continues
> + * to drive LEDs which defeats the purpose of low power mode.
> + */
...
> + /* Set standby mode */
> + reg = phy_read(phydev, MII_BRCM_FET_SHDW_AUXMODE4);
> + if (reg < 0) {
> + err = reg;
> + goto done;
> + }
> +
> + reg |= MII_BRCM_FET_SHDW_AM4_STANDBY;
> +
> + err = phy_write(phydev, MII_BRCM_FET_SHDW_AUXMODE4, reg);

Does the read-modify-write problem extend to this register? Why would
the PHY behave differently whether you used phy_modify() here or not?
On the mdio bus, it should be exactly the same - the only difference
is that we're guaranteed to hold the lock over the sequence whereas
this drops and re-acquires the lock.

If it's sensitive to the timing of the read and the write, it suggests
the above code is fragile - maybe there needs to be a minimum delay
inserted between the read and the write?

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!