diff options
| author | Andrew Morton <akpm@osdl.org> | 2005-03-02 13:55:36 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-03-02 13:55:36 -0500 |
| commit | 955bd9bb8e6e4ac3d042434424aed42efdd5c636 (patch) | |
| tree | cf4e1d728b9bc9c338c7a9c909df41238d7ee662 | |
| parent | 4ceb33e3c5a9bfe6e8d5394ad0b55d32512c0c9a (diff) | |
[PATCH] smc91x: power down PHY on suspend
From: Ian Campbell <icampbell@arcom.com>
Powering down the PHY saves something like 100mA at 5V on my platform.
Currently it is only done when the interface is brought down but it makes
sense to do it on suspend as well.
Signed-off-by: Ian Campbell <icampbell@arcom.com>
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
| -rw-r--r-- | drivers/net/smc91x.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 0ebf8ca75342..6766bacbb199 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c @@ -1038,13 +1038,29 @@ static int smc_phy_reset(struct net_device *dev, int phy) /* * smc_phy_powerdown - powerdown phy * @dev: net device - * @phy: phy address * * Power down the specified PHY */ -static void smc_phy_powerdown(struct net_device *dev, int phy) +static void smc_phy_powerdown(struct net_device *dev) { + struct smc_local *lp = netdev_priv(dev); unsigned int bmcr; + int phy = lp->mii.phy_id; + + if (lp->phy_type == 0) + return; + + /* We need to ensure that no calls to smc_phy_configure are + pending. + + flush_scheduled_work() cannot be called because we are + running with the netlink semaphore held (from + devinet_ioctl()) and the pending work queue contains + linkwatch_event() (scheduled by netif_carrier_off() + above). linkwatch_event() also wants the netlink semaphore. + */ + while(lp->work_pending) + schedule(); bmcr = smc_phy_read(dev, phy, MII_BMCR); smc_phy_write(dev, phy, MII_BMCR, bmcr | BMCR_PDOWN); @@ -1583,21 +1599,7 @@ static int smc_close(struct net_device *dev) /* clear everything */ smc_shutdown(dev); - if (lp->phy_type != 0) { - /* We need to ensure that no calls to - smc_phy_configure are pending. - - flush_scheduled_work() cannot be called because we - are running with the netlink semaphore held (from - devinet_ioctl()) and the pending work queue - contains linkwatch_event() (scheduled by - netif_carrier_off() above). linkwatch_event() also - wants the netlink semaphore. - */ - while(lp->work_pending) - schedule(); - smc_phy_powerdown(dev, lp->mii.phy_id); - } + smc_phy_powerdown(dev); if (lp->pending_tx_skb) { dev_kfree_skb(lp->pending_tx_skb); @@ -2284,6 +2286,7 @@ static int smc_drv_suspend(struct device *dev, u32 state, u32 level) if (netif_running(ndev)) { netif_device_detach(ndev); smc_shutdown(ndev); + smc_phy_powerdown(ndev); } } return 0; |
