aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/marvell.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/marvell.c')
-rw-r--r--drivers/net/phy/marvell.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index eb6411c4694f..7a3ec9d39a9a 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -69,6 +69,11 @@
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_LED_CTRL 16
73#define MII_88E1121_PHY_LED_PAGE 3
74#define MII_88E1121_PHY_LED_DEF 0x0030
75#define MII_88E1121_PHY_PAGE 22
76
72#define MII_M1011_PHY_STATUS 0x11 77#define MII_M1011_PHY_STATUS 0x11
73#define MII_M1011_PHY_STATUS_1000 0x8000 78#define MII_M1011_PHY_STATUS_1000 0x8000
74#define MII_M1011_PHY_STATUS_100 0x4000 79#define MII_M1011_PHY_STATUS_100 0x4000
@@ -154,6 +159,30 @@ static int marvell_config_aneg(struct phy_device *phydev)
154 return err; 159 return err;
155} 160}
156 161
162static int m88e1121_config_aneg(struct phy_device *phydev)
163{
164 int err, temp;
165
166 err = phy_write(phydev, MII_BMCR, BMCR_RESET);
167 if (err < 0)
168 return err;
169
170 err = phy_write(phydev, MII_M1011_PHY_SCR,
171 MII_M1011_PHY_SCR_AUTO_CROSS);
172 if (err < 0)
173 return err;
174
175 temp = phy_read(phydev, MII_88E1121_PHY_PAGE);
176
177 phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
178 phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);
179 phy_write(phydev, MII_88E1121_PHY_PAGE, temp);
180
181 err = genphy_config_aneg(phydev);
182
183 return err;
184}
185
157static int m88e1111_config_init(struct phy_device *phydev) 186static int m88e1111_config_init(struct phy_device *phydev)
158{ 187{
159 int err; 188 int err;
@@ -429,6 +458,18 @@ static int marvell_read_status(struct phy_device *phydev)
429 return 0; 458 return 0;
430} 459}
431 460
461static int m88e1121_did_interrupt(struct phy_device *phydev)
462{
463 int imask;
464
465 imask = phy_read(phydev, MII_M1011_IEVENT);
466
467 if (imask & MII_M1011_IMASK_INIT)
468 return 1;
469
470 return 0;
471}
472
432static struct phy_driver marvell_drivers[] = { 473static struct phy_driver marvell_drivers[] = {
433 { 474 {
434 .phy_id = 0x01410c60, 475 .phy_id = 0x01410c60,
@@ -482,6 +523,19 @@ static struct phy_driver marvell_drivers[] = {
482 .driver = {.owner = THIS_MODULE,}, 523 .driver = {.owner = THIS_MODULE,},
483 }, 524 },
484 { 525 {
526 .phy_id = 0x01410cb0,
527 .phy_id_mask = 0xfffffff0,
528 .name = "Marvell 88E1121R",
529 .features = PHY_GBIT_FEATURES,
530 .flags = PHY_HAS_INTERRUPT,
531 .config_aneg = &m88e1121_config_aneg,
532 .read_status = &marvell_read_status,
533 .ack_interrupt = &marvell_ack_interrupt,
534 .config_intr = &marvell_config_intr,
535 .did_interrupt = &m88e1121_did_interrupt,
536 .driver = { .owner = THIS_MODULE },
537 },
538 {
485 .phy_id = 0x01410cd0, 539 .phy_id = 0x01410cd0,
486 .phy_id_mask = 0xfffffff0, 540 .phy_id_mask = 0xfffffff0,
487 .name = "Marvell 88E1145", 541 .name = "Marvell 88E1145",