summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFugang Duan <b38611@freescale.com>2015-06-05 15:16:23 +0800
committerFugang Duan <B38611@freescale.com>2015-06-09 10:09:06 +0800
commit63fe75a17972ed90234bdd956f19024458c8f152 (patch)
treeed5c2dfce9661858041ae231183e31d2ed33e719 /drivers
parente776a8ad9b3bb91024b2e6846e8d9459844192d0 (diff)
MLK-11051 net: phy: mdio_bus: don't call .phy_suspendi() when netdev is NULL
In .mdio_bus_phy_may_suspend(), there check netdev is NULL to judge to set phy to suspend status. netdev is NULL has three cases: - phy is not found - phy is found, match to general phy driver - phy is found, match to specifical phy driver Case 1: phy is not found, cannot communicate by MDIO bus. Case 2: phy is found: if phy dev driver probe/bind err, netdev is not __open__ status, mdio bus is unregistered. if phy is detached, phy had entered suspended status. Case 3: phy is found, phy is detached, phy had entered suspended status. So, in here, it shouldn't set phy to suspend by calling mdio bus. In i.MX6UL evk/arm2 board, if down the ethx interface and do suspend/resume, system will hang. Because after ethx down all clocks are gated off, for general phy driver, unbind the phy device, for specifical phy driver, no unbind the device, and the original driver call mdio bus to set phy to suspend during system suspend, so system will hang since there have mdio register access. The patch can fix it. Signed-off-by: Fugang Duan <B38611@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/phy/mdio_bus.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 9dc956ee7963..96d15514fe32 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -376,9 +376,23 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
if (!drv || !phydrv->suspend)
return false;
- /* PHY not attached? May suspend. */
+ /*
+ * netdev is NULL has three cases:
+ * - phy is not found
+ * - phy is found, match to general phy driver
+ * - phy is found, match to specifical phy driver
+ *
+ * Case 1: phy is not found, cannot communicate by MDIO bus.
+ * Case 2: phy is found:
+ * if phy dev driver probe/bind err, netdev is not __open__ status,
+ * mdio bus is unregistered.
+ * if phy is detached, phy had entered suspended status.
+ * Case 3: phy is found, phy is detached, phy had entered suspended status.
+ *
+ * So, in here, it shouldn't set phy to suspend by calling mdio bus.
+ */
if (!netdev)
- return true;
+ return false;
/* Don't suspend PHY if the attched netdev parent may wakeup.
* The parent may point to a PCI device, as in tg3 driver.