aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2010-08-02 05:44:53 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-03 01:07:45 -0400
commitc477d0447db08068a497e7beb892b2b2a7bff64b (patch)
treebee8b5f66ec1c8e55ced27d1836c63c0cf9d7f84 /drivers/net/phy
parent66d50d25502cd9b7d6e3ebbf4e241259c1283eaf (diff)
phy/marvell: add 88e1121 interface mode support
This patch adds support for RGMII RX/TX delay configuration on marvell 88e1121 and derivatives. With this patch, PHY_INTERFACE_MODE_RGMII_*ID modes are now supported on these devices. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/marvell.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 78b74e83ce5d..b1413aed3f98 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -69,6 +69,12 @@
69#define MII_M1111_COPPER 0 69#define MII_M1111_COPPER 0
70#define MII_M1111_FIBER 1 70#define MII_M1111_FIBER 1
71 71
72#define MII_88E1121_PHY_MSCR_PAGE 2
73#define MII_88E1121_PHY_MSCR_REG 21
74#define MII_88E1121_PHY_MSCR_RX_DELAY BIT(5)
75#define MII_88E1121_PHY_MSCR_TX_DELAY BIT(4)
76#define MII_88E1121_PHY_MSCR_DELAY_MASK (~(0x3 << 4))
77
72#define MII_88E1121_PHY_LED_CTRL 16 78#define MII_88E1121_PHY_LED_CTRL 16
73#define MII_88E1121_PHY_LED_PAGE 3 79#define MII_88E1121_PHY_LED_PAGE 3
74#define MII_88E1121_PHY_LED_DEF 0x0030 80#define MII_88E1121_PHY_LED_DEF 0x0030
@@ -180,7 +186,30 @@ static int marvell_config_aneg(struct phy_device *phydev)
180 186
181static int m88e1121_config_aneg(struct phy_device *phydev) 187static int m88e1121_config_aneg(struct phy_device *phydev)
182{ 188{
183 int err, temp; 189 int err, oldpage, mscr;
190
191 oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE);
192
193 err = phy_write(phydev, MII_88E1121_PHY_PAGE,
194 MII_88E1121_PHY_MSCR_PAGE);
195 if (err < 0)
196 return err;
197 mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) &
198 MII_88E1121_PHY_MSCR_DELAY_MASK;
199
200 if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID)
201 mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY |
202 MII_88E1121_PHY_MSCR_TX_DELAY);
203 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
204 mscr |= MII_88E1121_PHY_MSCR_RX_DELAY;
205 else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
206 mscr |= MII_88E1121_PHY_MSCR_TX_DELAY;
207
208 err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr);
209 if (err < 0)
210 return err;
211
212 phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage);
184 213
185 err = phy_write(phydev, MII_BMCR, BMCR_RESET); 214 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
186 if (err < 0) 215 if (err < 0)
@@ -191,11 +220,11 @@ static int m88e1121_config_aneg(struct phy_device *phydev)
191 if (err < 0) 220 if (err < 0)
192 return err; 221 return err;
193 222
194 temp = phy_read(phydev, MII_88E1121_PHY_PAGE); 223 oldpage = phy_read(phydev, MII_88E1121_PHY_PAGE);
195 224
196 phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE); 225 phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
197 phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF); 226 phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);
198 phy_write(phydev, MII_88E1121_PHY_PAGE, temp); 227 phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage);
199 228
200 err = genphy_config_aneg(phydev); 229 err = genphy_config_aneg(phydev);
201 230