• Florian Fainelli's avatar
    net: phy: avoid suspending twice a PHY · 803dd9c7
    Florian Fainelli authored
    As part of a call to ndo_close() a netdevice driver may call
    phy_disconnect() -> phy_detach() -> phy_suspend(), such that the PHY is
    suspsended at this point and a netdevice driver may clock gate the
    backing peripheral providing MDIO bus accessses as well.
    
    Update mdio_bus_phy_may_suspend() to return whether a PHY is allowed to
    be suspended and conversely resumed if and only if it was not previously
    suspended before while it is currently in detached (netdev pointer is
    NULL) state.
    
    This fixes bus errors seen during S2/S3 suspend/resume cycles for
    netdevice drivers such as GENET which clock gates the entire Ethernet
    MAC, including the MDIO bus block.
    Acked-by: default avatarFugang Duan <B38611@freescale.com>
    Tested-by: default avatarFugang Duan <B38611@freescale.com>
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    803dd9c7
mdio_bus.c 14.2 KB