diff options
author | Giuseppe Cavallaro <peppe.cavallaro@st.com> | 2008-11-28 19:24:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-28 19:24:56 -0500 |
commit | 0f0ca340e57bd7446855fefd07a64249acf81223 (patch) | |
tree | 9a3af0f86f8bcce9eb86a38bf4dd5f4a2c5da2d1 /drivers/net/phy/mdio_bus.c | |
parent | 914804b95caa61c633431262044034ab05c78ba4 (diff) |
phy: power management support
This patch adds the power management support into the physical
abstraction layer.
Suspend and resume functions respectively turns on/off the bit 11
into the PHY Basic mode control register.
Generic PHY device starts supporting PM.
In order to support the wake-on LAN and avoid to put in power down
the PHY device, the MDIO is aware of what the Ethernet device wants to do.
Voluntary, no CONFIG_PM defines were added into the sources.
Also generic suspend/resume functions are exported to allow
other drivers use them (such as genphy_config_aneg etc.).
Within the phy_driver_register function, we need to remove the
memset. It overrides the device driver owner and it is not good.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/mdio_bus.c')
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 868812ff6de8..8755d8cd4166 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -284,9 +284,12 @@ static int mdio_bus_suspend(struct device * dev, pm_message_t state) | |||
284 | { | 284 | { |
285 | int ret = 0; | 285 | int ret = 0; |
286 | struct device_driver *drv = dev->driver; | 286 | struct device_driver *drv = dev->driver; |
287 | struct phy_driver *phydrv = to_phy_driver(drv); | ||
288 | struct phy_device *phydev = to_phy_device(dev); | ||
287 | 289 | ||
288 | if (drv && drv->suspend) | 290 | if ((!device_may_wakeup(phydev->dev.parent)) && |
289 | ret = drv->suspend(dev, state); | 291 | (phydrv && phydrv->suspend)) |
292 | ret = phydrv->suspend(phydev); | ||
290 | 293 | ||
291 | return ret; | 294 | return ret; |
292 | } | 295 | } |
@@ -295,9 +298,12 @@ static int mdio_bus_resume(struct device * dev) | |||
295 | { | 298 | { |
296 | int ret = 0; | 299 | int ret = 0; |
297 | struct device_driver *drv = dev->driver; | 300 | struct device_driver *drv = dev->driver; |
301 | struct phy_driver *phydrv = to_phy_driver(drv); | ||
302 | struct phy_device *phydev = to_phy_device(dev); | ||
298 | 303 | ||
299 | if (drv && drv->resume) | 304 | if ((!device_may_wakeup(phydev->dev.parent)) && |
300 | ret = drv->resume(dev); | 305 | (phydrv && phydrv->resume)) |
306 | ret = phydrv->resume(phydev); | ||
301 | 307 | ||
302 | return ret; | 308 | return ret; |
303 | } | 309 | } |