aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/marvell.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2013-05-30 16:08:26 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-31 03:48:22 -0400
commit3da09a5154edb92fe74c266a4fa900bcbed6d44c (patch)
tree499e0f88459a206eb13ac2415ba140984d30e061 /drivers/net/phy/marvell.c
parentf5e1cabf46ed21c736453e38d6ddeadb926fbfea (diff)
phy: Add Marvell 88E1116R phy ID
This phy is on Xilinx ZC702 zynq development board. Signed-off-by: Anirudha Sarangi <anirudh@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/marvell.c')
-rw-r--r--drivers/net/phy/marvell.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 371353c81f3c..df5a9f6d2864 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -116,6 +116,8 @@
116#define MII_M1011_PHY_STATUS_RESOLVED 0x0800 116#define MII_M1011_PHY_STATUS_RESOLVED 0x0800
117#define MII_M1011_PHY_STATUS_LINK 0x0400 117#define MII_M1011_PHY_STATUS_LINK 0x0400
118 118
119#define MII_M1116R_CONTROL_REG_MAC 21
120
119 121
120MODULE_DESCRIPTION("Marvell PHY driver"); 122MODULE_DESCRIPTION("Marvell PHY driver");
121MODULE_AUTHOR("Andy Fleming"); 123MODULE_AUTHOR("Andy Fleming");
@@ -372,6 +374,55 @@ static int m88e1318_config_aneg(struct phy_device *phydev)
372 return m88e1121_config_aneg(phydev); 374 return m88e1121_config_aneg(phydev);
373} 375}
374 376
377static int m88e1116r_config_init(struct phy_device *phydev)
378{
379 int temp;
380 int err;
381
382 temp = phy_read(phydev, MII_BMCR);
383 temp |= BMCR_RESET;
384 err = phy_write(phydev, MII_BMCR, temp);
385 if (err < 0)
386 return err;
387
388 mdelay(500);
389
390 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0);
391 if (err < 0)
392 return err;
393
394 temp = phy_read(phydev, MII_M1011_PHY_SCR);
395 temp |= (7 << 12); /* max number of gigabit attempts */
396 temp |= (1 << 11); /* enable downshift */
397 temp |= MII_M1011_PHY_SCR_AUTO_CROSS;
398 err = phy_write(phydev, MII_M1011_PHY_SCR, temp);
399 if (err < 0)
400 return err;
401
402 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 2);
403 if (err < 0)
404 return err;
405 temp = phy_read(phydev, MII_M1116R_CONTROL_REG_MAC);
406 temp |= (1 << 5);
407 temp |= (1 << 4);
408 err = phy_write(phydev, MII_M1116R_CONTROL_REG_MAC, temp);
409 if (err < 0)
410 return err;
411 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, 0);
412 if (err < 0)
413 return err;
414
415 temp = phy_read(phydev, MII_BMCR);
416 temp |= BMCR_RESET;
417 err = phy_write(phydev, MII_BMCR, temp);
418 if (err < 0)
419 return err;
420
421 mdelay(500);
422
423 return 0;
424}
425
375static int m88e1111_config_init(struct phy_device *phydev) 426static int m88e1111_config_init(struct phy_device *phydev)
376{ 427{
377 int err; 428 int err;
@@ -940,6 +991,19 @@ static struct phy_driver marvell_drivers[] = {
940 .config_intr = &marvell_config_intr, 991 .config_intr = &marvell_config_intr,
941 .driver = { .owner = THIS_MODULE }, 992 .driver = { .owner = THIS_MODULE },
942 }, 993 },
994 {
995 .phy_id = MARVELL_PHY_ID_88E1116R,
996 .phy_id_mask = MARVELL_PHY_ID_MASK,
997 .name = "Marvell 88E1116R",
998 .features = PHY_GBIT_FEATURES,
999 .flags = PHY_HAS_INTERRUPT,
1000 .config_init = &m88e1116r_config_init,
1001 .config_aneg = &genphy_config_aneg,
1002 .read_status = &genphy_read_status,
1003 .ack_interrupt = &marvell_ack_interrupt,
1004 .config_intr = &marvell_config_intr,
1005 .driver = { .owner = THIS_MODULE },
1006 },
943}; 1007};
944 1008
945static int __init marvell_init(void) 1009static int __init marvell_init(void)
@@ -967,6 +1031,7 @@ static struct mdio_device_id __maybe_unused marvell_tbl[] = {
967 { MARVELL_PHY_ID_88E1149R, MARVELL_PHY_ID_MASK }, 1031 { MARVELL_PHY_ID_88E1149R, MARVELL_PHY_ID_MASK },
968 { MARVELL_PHY_ID_88E1240, MARVELL_PHY_ID_MASK }, 1032 { MARVELL_PHY_ID_88E1240, MARVELL_PHY_ID_MASK },
969 { MARVELL_PHY_ID_88E1318S, MARVELL_PHY_ID_MASK }, 1033 { MARVELL_PHY_ID_88E1318S, MARVELL_PHY_ID_MASK },
1034 { MARVELL_PHY_ID_88E1116R, MARVELL_PHY_ID_MASK },
970 { } 1035 { }
971}; 1036};
972 1037