diff options
Diffstat (limited to 'drivers/net/phy/marvell.c')
-rw-r--r-- | drivers/net/phy/marvell.c | 35 |
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 | ||
181 | static int m88e1121_config_aneg(struct phy_device *phydev) | 187 | static 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 | ||