]> err.no Git - linux-2.6/commitdiff
phylib: marvell: add support for TX-only and RX-only Internal Delay
authorKim Phillips <kim.phillips@freescale.com>
Mon, 26 Nov 2007 22:17:52 +0000 (16:17 -0600)
committerJeff Garzik <jeff@garzik.org>
Sat, 1 Dec 2007 21:32:30 +0000 (16:32 -0500)
Previously, Internal Delay specification implied the delay be
applied to both TX and RX.  This patch allows for separate TX/RX-only
internal delay specification.

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Tested-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Li Yang <leoli@freescale.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/phy/marvell.c

index 035fd41fb61f01408517d7fef176b8e42f8173d7..f0574073a2a34a02beb226cd27401ae5191895a3 100644 (file)
@@ -143,21 +143,29 @@ static int m88e1111_config_init(struct phy_device *phydev)
        int err;
 
        if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
-           (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)) {
+           (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) ||
+           (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) ||
+           (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) {
                int temp;
 
-               if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
-                       temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
-                       if (temp < 0)
-                               return temp;
+               temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
+               if (temp < 0)
+                       return temp;
 
+               if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) {
                        temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
-
-                       err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
-                       if (err < 0)
-                               return err;
+               } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) {
+                       temp &= ~MII_M1111_TX_DELAY;
+                       temp |= MII_M1111_RX_DELAY;
+               } else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) {
+                       temp &= ~MII_M1111_RX_DELAY;
+                       temp |= MII_M1111_TX_DELAY;
                }
 
+               err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
+               if (err < 0)
+                       return err;
+
                temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
                if (temp < 0)
                        return temp;