diff options
Diffstat (limited to 'drivers/net/phy/marvell.c')
-rw-r--r-- | drivers/net/phy/marvell.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 6f69b9ba0df8..64c7fbe0a8e7 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/unistd.h> | 19 | #include <linux/unistd.h> |
20 | #include <linux/slab.h> | ||
21 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
22 | #include <linux/init.h> | 21 | #include <linux/init.h> |
23 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
@@ -63,6 +62,7 @@ | |||
63 | #define MII_M1111_HWCFG_MODE_COPPER_RGMII 0xb | 62 | #define MII_M1111_HWCFG_MODE_COPPER_RGMII 0xb |
64 | #define MII_M1111_HWCFG_MODE_FIBER_RGMII 0x3 | 63 | #define MII_M1111_HWCFG_MODE_FIBER_RGMII 0x3 |
65 | #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK 0x4 | 64 | #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK 0x4 |
65 | #define MII_M1111_HWCFG_MODE_COPPER_RTBI 0x9 | ||
66 | #define MII_M1111_HWCFG_FIBER_COPPER_AUTO 0x8000 | 66 | #define MII_M1111_HWCFG_FIBER_COPPER_AUTO 0x8000 |
67 | #define MII_M1111_HWCFG_FIBER_COPPER_RES 0x2000 | 67 | #define MII_M1111_HWCFG_FIBER_COPPER_RES 0x2000 |
68 | 68 | ||
@@ -269,6 +269,43 @@ static int m88e1111_config_init(struct phy_device *phydev) | |||
269 | return err; | 269 | return err; |
270 | } | 270 | } |
271 | 271 | ||
272 | if (phydev->interface == PHY_INTERFACE_MODE_RTBI) { | ||
273 | temp = phy_read(phydev, MII_M1111_PHY_EXT_CR); | ||
274 | if (temp < 0) | ||
275 | return temp; | ||
276 | temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY); | ||
277 | err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp); | ||
278 | if (err < 0) | ||
279 | return err; | ||
280 | |||
281 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | ||
282 | if (temp < 0) | ||
283 | return temp; | ||
284 | temp &= ~(MII_M1111_HWCFG_MODE_MASK | MII_M1111_HWCFG_FIBER_COPPER_RES); | ||
285 | temp |= 0x7 | MII_M1111_HWCFG_FIBER_COPPER_AUTO; | ||
286 | err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); | ||
287 | if (err < 0) | ||
288 | return err; | ||
289 | |||
290 | /* soft reset */ | ||
291 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | ||
292 | if (err < 0) | ||
293 | return err; | ||
294 | do | ||
295 | temp = phy_read(phydev, MII_BMCR); | ||
296 | while (temp & BMCR_RESET); | ||
297 | |||
298 | temp = phy_read(phydev, MII_M1111_PHY_EXT_SR); | ||
299 | if (temp < 0) | ||
300 | return temp; | ||
301 | temp &= ~(MII_M1111_HWCFG_MODE_MASK | MII_M1111_HWCFG_FIBER_COPPER_RES); | ||
302 | temp |= MII_M1111_HWCFG_MODE_COPPER_RTBI | MII_M1111_HWCFG_FIBER_COPPER_AUTO; | ||
303 | err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp); | ||
304 | if (err < 0) | ||
305 | return err; | ||
306 | } | ||
307 | |||
308 | |||
272 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); | 309 | err = phy_write(phydev, MII_BMCR, BMCR_RESET); |
273 | if (err < 0) | 310 | if (err < 0) |
274 | return err; | 311 | return err; |