[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BLUPR03MB37333B3BB74B3DD928EEE6FF5320@BLUPR03MB373.namprd03.prod.outlook.com>
Date: Tue, 27 Jan 2015 02:44:14 +0000
From: "fugang.duan@...escale.com" <fugang.duan@...escale.com>
To: Florian Fainelli <f.fainelli@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC: "davem@...emloft.net" <davem@...emloft.net>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>
Subject: RE: [PATCH net-next 4/4] net: phy: avoid suspending twice a PHY
From: Florian Fainelli <f.fainelli@...il.com> Sent: Tuesday, January 27, 2015 8:31 AM
> To: netdev@...r.kernel.org
> Cc: davem@...emloft.net; s.hauer@...gutronix.de; Duan Fugang-B38611;
> Florian Fainelli
> Subject: [PATCH net-next 4/4] net: phy: avoid suspending twice a PHY
>
> 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.
>
> Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
> ---
> drivers/net/phy/mdio_bus.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 20447741893a..095ef3fe369a 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -443,9 +443,13 @@ static bool mdio_bus_phy_may_suspend(struct
> phy_device *phydev)
> if (!drv || !phydrv->suspend)
> return false;
>
> - /* PHY not attached? May suspend. */
> + /* PHY not attached? May suspend if the PHY has not already been
> + * suspended as part of a prior call to phy_disconnect() ->
> + * phy_detach() -> phy_suspend() because the parent netdev might be
> the
> + * MDIO bus driver and clock gated at this point.
> + */
> if (!netdev)
> - return true;
> + return !phydev->suspended;
>
> /* Don't suspend PHY if the attched netdev parent may wakeup.
> * The parent may point to a PCI device, as in tg3 driver.
> --
> 2.1.0
Acked-by: Fugang Duan <B38611@...escale.com>
Tested-by: Fugang Duan <B38611@...escale.com>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists