Merge ../linux-2.6-watchdog-mm
[pandora-kernel.git] / drivers / net / ibm_emac / ibm_emac_phy.c
index a27e49c..9074f76 100644 (file)
@@ -12,7 +12,6 @@
  * (c) 2004-2005, Eugene Surovegin <ebs@ebshome.net>
  *
  */
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
@@ -236,12 +235,16 @@ static struct mii_phy_def genmii_phy_def = {
 };
 
 /* CIS8201 */
+#define MII_CIS8201_10BTCSR    0x16
+#define  TENBTCSR_ECHO_DISABLE 0x2000
 #define MII_CIS8201_EPCR       0x17
 #define  EPCR_MODE_MASK                0x3000
 #define  EPCR_GMII_MODE                0x0000
 #define  EPCR_RGMII_MODE       0x1000
 #define  EPCR_TBI_MODE         0x2000
 #define  EPCR_RTBI_MODE                0x3000
+#define MII_CIS8201_ACSR       0x1c
+#define  ACSR_PIN_PRIO_SELECT  0x0004
 
 static int cis8201_init(struct mii_phy *phy)
 {
@@ -269,6 +272,14 @@ static int cis8201_init(struct mii_phy *phy)
        }
 
        phy_write(phy, MII_CIS8201_EPCR, epcr);
+       
+       /* MII regs override strap pins */
+       phy_write(phy, MII_CIS8201_ACSR, 
+                 phy_read(phy, MII_CIS8201_ACSR) | ACSR_PIN_PRIO_SELECT);
+
+       /* Disable TX_EN -> CRS echo mode, otherwise 10/HDX doesn't work */
+       phy_write(phy, MII_CIS8201_10BTCSR,
+                 phy_read(phy, MII_CIS8201_10BTCSR) | TENBTCSR_ECHO_DISABLE);
 
        return 0;
 }
@@ -298,7 +309,7 @@ int mii_phy_probe(struct mii_phy *phy, int address)
 {
        struct mii_phy_def *def;
        int i;
-       u32 id;
+       int id;
 
        phy->autoneg = AUTONEG_DISABLE;
        phy->advertising = 0;
@@ -313,6 +324,8 @@ int mii_phy_probe(struct mii_phy *phy, int address)
 
        /* Read ID and find matching entry */
        id = (phy_read(phy, MII_PHYSID1) << 16) | phy_read(phy, MII_PHYSID2);
+       if (id < 0)
+               return -ENODEV;
        for (i = 0; (def = mii_phy_table[i]) != NULL; i++)
                if ((id & def->phy_id_mask) == def->phy_id)
                        break;