Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150091
b: refs/heads/master
c: b6907b0
h: refs/heads/master
i:
  150089: b26f85d
  150087: 6487475
v: v3
  • Loading branch information
Daniel Mack authored and David S. Miller committed May 5, 2009
1 parent 64f15cf commit 83d9151
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c7ae011dc8306d982c25fb4f679752e790a08dc4
refs/heads/master: b6907b0c705b6db221f937b4d343e2a6b280c8c5
46 changes: 46 additions & 0 deletions trunk/drivers/net/smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -2109,12 +2109,58 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
return retval;
}

#ifdef CONFIG_PM
/* This implementation assumes the devices remains powered on its VDDVARIO
* pins during suspend. */

static int smsc911x_suspend(struct platform_device *pdev, pm_message_t state)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct smsc911x_data *pdata = netdev_priv(dev);

/* enable wake on LAN, energy detection and the external PME
* signal. */
smsc911x_reg_write(pdata, PMT_CTRL,
PMT_CTRL_PM_MODE_D1_ | PMT_CTRL_WOL_EN_ |
PMT_CTRL_ED_EN_ | PMT_CTRL_PME_EN_);

return 0;
}

static int smsc911x_resume(struct platform_device *pdev)
{
struct net_device *dev = platform_get_drvdata(pdev);
struct smsc911x_data *pdata = netdev_priv(dev);
unsigned int to = 100;

/* Note 3.11 from the datasheet:
* "When the LAN9220 is in a power saving state, a write of any
* data to the BYTE_TEST register will wake-up the device."
*/
smsc911x_reg_write(pdata, BYTE_TEST, 0);

/* poll the READY bit in PMT_CTRL. Any other access to the device is
* forbidden while this bit isn't set. Try for 100ms and return -EIO
* if it failed. */
while (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && --to)
udelay(1000);

return (to == 0) ? -EIO : 0;
}

#else
#define smsc911x_suspend NULL
#define smsc911x_resume NULL
#endif

static struct platform_driver smsc911x_driver = {
.probe = smsc911x_drv_probe,
.remove = smsc911x_drv_remove,
.driver = {
.name = SMSC_CHIPNAME,
},
.suspend = smsc911x_suspend,
.resume = smsc911x_resume,
};

/* Entry point for loading the module */
Expand Down

0 comments on commit 83d9151

Please sign in to comment.