]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
dm9161: add configuration for MII/RMII
authorfrederic Rodo <f.rodo@til-technologies.fr>
Wed, 27 Feb 2008 11:58:37 +0000 (12:58 +0100)
committerJeff Garzik <jeff@garzik.org>
Wed, 5 Mar 2008 11:26:56 +0000 (06:26 -0500)
Signed-off-by: Frederic Rodo <f.rodo@til-technologies.fr>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/phy/davicom.c

index 7ed632db00d77dac9fb36df9629d74ea8e217b6d..d926168bc7809c62e46d32d5d9fe98e493ad6e7e 100644 (file)
@@ -37,6 +37,7 @@
 
 #define MII_DM9161_SCR         0x10
 #define MII_DM9161_SCR_INIT    0x0610
+#define MII_DM9161_SCR_RMII    0x0100
 
 /* DM9161 Interrupt Register */
 #define MII_DM9161_INTR        0x15
@@ -103,7 +104,7 @@ static int dm9161_config_aneg(struct phy_device *phydev)
 
 static int dm9161_config_init(struct phy_device *phydev)
 {
-       int err;
+       int err, temp;
 
        /* Isolate the PHY */
        err = phy_write(phydev, MII_BMCR, BMCR_ISOLATE);
@@ -111,9 +112,19 @@ static int dm9161_config_init(struct phy_device *phydev)
        if (err < 0)
                return err;
 
-       /* Do not bypass the scrambler/descrambler */
-       err = phy_write(phydev, MII_DM9161_SCR, MII_DM9161_SCR_INIT);
+       switch (phydev->interface) {
+       case PHY_INTERFACE_MODE_MII:
+               temp = MII_DM9161_SCR_INIT;
+               break;
+       case PHY_INTERFACE_MODE_RMII:
+               temp =  MII_DM9161_SCR_INIT | MII_DM9161_SCR_RMII;
+               break;
+       default:
+               return -EINVAL;
+       }
 
+       /* Do not bypass the scrambler/descrambler */
+       err = phy_write(phydev, MII_DM9161_SCR, temp);
        if (err < 0)
                return err;