broadcom: Make the 57780 IEEE compliant
authorMatt Carlson <mcarlson@broadcom.com>
Tue, 25 Aug 2009 10:11:26 +0000 (10:11 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Aug 2009 22:48:06 +0000 (15:48 -0700)
This brings the 57780's phy into IEEE compliance by suppressing the
common mode oscillation.

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/broadcom.c

index 3262a2474b07b62e9daa6a6af8bcc769151e4fda..f81e53222230f72fa7852bb59bd053c068090e9b 100644 (file)
 
 #define PHY_ID_BCM50610                0x0143bd60
 #define PHY_ID_BCM50610M       0x0143bd70
+#define PHY_ID_BCM57780                0x03625d90
+
+#define BRCM_PHY_MODEL(phydev) \
+       ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask)
+
 
 #define MII_BCM54XX_ECR                0x10    /* BCM54xx extended control register */
 #define MII_BCM54XX_ECR_IM     0x1000  /* Interrupt mask */
 #define  MII_BCM54XX_EXP_EXP08_EARLY_DAC_WAKE  0x0200
 #define MII_BCM54XX_EXP_EXP75                  0x0f75
 #define  MII_BCM54XX_EXP_EXP75_VDACCTRL                0x003c
+#define  MII_BCM54XX_EXP_EXP75_CM_OSC          0x0001
 #define MII_BCM54XX_EXP_EXP96                  0x0f96
 #define  MII_BCM54XX_EXP_EXP96_MYST            0x0010
 #define MII_BCM54XX_EXP_EXP97                  0x0f97
@@ -194,7 +200,7 @@ static int bcm54xx_shadow_write(struct phy_device *phydev, u16 shadow, u16 val)
 }
 
 /* Indirect register access functions for the Expansion Registers */
-static int bcm54xx_exp_read(struct phy_device *phydev, u8 regnum)
+static int bcm54xx_exp_read(struct phy_device *phydev, u16 regnum)
 {
        int val;
 
@@ -308,6 +314,33 @@ static int bcm54xx_config_init(struct phy_device *phydev)
                        return err;
        }
 
+       if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) {
+               int err2;
+
+               err = bcm54xx_auxctl_write(phydev,
+                                          MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
+                                          MII_BCM54XX_AUXCTL_ACTL_SMDSP_ENA |
+                                          MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
+               if (err < 0)
+                       return err;
+
+               reg = bcm54xx_exp_read(phydev, MII_BCM54XX_EXP_EXP75);
+               if (reg < 0)
+                       goto error;
+
+               reg |= MII_BCM54XX_EXP_EXP75_CM_OSC;
+               err = bcm54xx_exp_write(phydev, MII_BCM54XX_EXP_EXP75, reg);
+
+error:
+               err2 = bcm54xx_auxctl_write(phydev,
+                                           MII_BCM54XX_AUXCTL_SHDWSEL_AUXCTL,
+                                           MII_BCM54XX_AUXCTL_ACTL_TX_6DB);
+               if (err)
+                       return err;
+               if (err2)
+                       return err2;
+       }
+
        return 0;
 }
 
@@ -694,7 +727,7 @@ static struct phy_driver bcm50610m_driver = {
 };
 
 static struct phy_driver bcm57780_driver = {
-       .phy_id         = 0x03625d90,
+       .phy_id         = PHY_ID_BCM57780,
        .phy_id_mask    = 0xfffffff0,
        .name           = "Broadcom BCM57780",
        .features       = PHY_GBIT_FEATURES |