Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218400
b: refs/heads/master
c: 1c55781
h: refs/heads/master
v: v3
  • Loading branch information
Guo-Fu Tseng authored and David S. Miller committed Oct 24, 2010
1 parent f41d4b6 commit cbc52a4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b889416b54c90f59276537debd92cb4e84b5f550
refs/heads/master: 1c5578194abde100c089855cce72e87c047d8530
45 changes: 30 additions & 15 deletions trunk/drivers/net/jme.c
Original file line number Diff line number Diff line change
Expand Up @@ -1623,12 +1623,12 @@ jme_open(struct net_device *netdev)
return rc;
}

#ifdef CONFIG_PM
static void
jme_set_100m_half(struct jme_adapter *jme)
{
u32 bmcr, tmp;

jme_phy_on(jme);
bmcr = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_BMCR);
tmp = bmcr & ~(BMCR_ANENABLE | BMCR_SPEED100 |
BMCR_SPEED1000 | BMCR_FULLDPLX);
Expand Down Expand Up @@ -1656,14 +1656,28 @@ jme_wait_link(struct jme_adapter *jme)
phylink = jme_linkstat_from_phy(jme);
}
}
#endif

static inline void
jme_phy_off(struct jme_adapter *jme)
{
jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_BMCR, BMCR_PDOWN);
}

static void
jme_powersave_phy(struct jme_adapter *jme)
{
if (jme->reg_pmcs) {
jme_set_100m_half(jme);

if (jme->reg_pmcs & (PMCS_LFEN | PMCS_LREN))
jme_wait_link(jme);

jwrite32(jme, JME_PMCS, jme->reg_pmcs);
} else {
jme_phy_off(jme);
}
}

static int
jme_close(struct net_device *netdev)
{
Expand Down Expand Up @@ -2991,6 +3005,16 @@ jme_remove_one(struct pci_dev *pdev)

}

static void
jme_shutdown(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct jme_adapter *jme = netdev_priv(netdev);

jme_powersave_phy(jme);
pci_pme_active(pdev, true);
}

#ifdef CONFIG_PM
static int
jme_suspend(struct pci_dev *pdev, pm_message_t state)
Expand Down Expand Up @@ -3028,19 +3052,9 @@ jme_suspend(struct pci_dev *pdev, pm_message_t state)
tasklet_hi_enable(&jme->rxempty_task);

pci_save_state(pdev);
if (jme->reg_pmcs) {
jme_set_100m_half(jme);

if (jme->reg_pmcs & (PMCS_LFEN | PMCS_LREN))
jme_wait_link(jme);

jwrite32(jme, JME_PMCS, jme->reg_pmcs);

pci_enable_wake(pdev, PCI_D3cold, true);
} else {
jme_phy_off(jme);
}
pci_set_power_state(pdev, PCI_D3cold);
jme_powersave_phy(jme);
pci_enable_wake(jme->pdev, PCI_D3hot, true);
pci_set_power_state(pdev, PCI_D3hot);

return 0;
}
Expand Down Expand Up @@ -3087,6 +3101,7 @@ static struct pci_driver jme_driver = {
.suspend = jme_suspend,
.resume = jme_resume,
#endif /* CONFIG_PM */
.shutdown = jme_shutdown,
};

static int __init
Expand Down

0 comments on commit cbc52a4

Please sign in to comment.