jme: Fix PHY power-off error
authorGuo-Fu Tseng <cooldavid@cooldavid.org>
Mon, 18 Oct 2010 05:58:49 +0000 (13:58 +0800)
committerGuo-Fu Tseng <cooldavid@cooldavid.org>
Mon, 18 Oct 2010 23:51:33 +0000 (07:51 +0800)
Adding phy_on in opposition to phy_off.

jme.c

diff --git a/jme.c b/jme.c
index 3b84cb3..d7d2140 100644 (file)
--- a/jme.c
+++ b/jme.c
@@ -1600,6 +1600,16 @@ jme_free_irq(struct jme_adapter *jme)
        }
 }
 
+static inline void
+jme_phy_on(struct jme_adapter *jme)
+{
+       u32 bmcr;
+
+       bmcr = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_BMCR);
+       bmcr &= ~BMCR_PDOWN;
+       jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_BMCR, bmcr);
+}
+
 static int
 jme_open(struct net_device *netdev)
 {
@@ -1620,10 +1630,12 @@ jme_open(struct net_device *netdev)
 
        jme_start_irq(jme);
 
-       if (test_bit(JME_FLAG_SSET, &jme->flags))
+       if (test_bit(JME_FLAG_SSET, &jme->flags)) {
+               jme_phy_on(jme);
                jme_set_settings(netdev, &jme->old_ecmd);
-       else
+       } else {
                jme_reset_phy_processor(jme);
+       }
 
        jme_reset_link(jme);
 
@@ -3165,10 +3177,12 @@ jme_resume(struct pci_dev *pdev)
        jme_clear_pm(jme);
        pci_restore_state(pdev);
 
-       if (test_bit(JME_FLAG_SSET, &jme->flags))
+       if (test_bit(JME_FLAG_SSET, &jme->flags)) {
+               jme_phy_on(jme);
                jme_set_settings(netdev, &jme->old_ecmd);
-       else
+       } else {
                jme_reset_phy_processor(jme);
+       }
 
        jme_start_irq(jme);
        netif_device_attach(netdev);