aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorClemens Gruber <clemens.gruber@pqgruber.com>2016-06-11 11:21:26 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-14 15:23:03 -0400
commitfdecf36fcefa9f48c2f2de21c8176f1a8ce2c960 (patch)
tree126c50828db8a17acd57fbb6db4472890b0284db /drivers/net/phy
parentd941ebe88a411aa281cc80477a93feb931a1b50b (diff)
phy: marvell: fix LED configuration via marvell,reg-init
Configuring the PHY LED registers for the Marvell 88E1510 and others is not possible, because regardless of the values in marvell,reg-init, it is later overridden in m88e1121_config_aneg with a non-standard default. This patch moves that default configuration to .config_init to allow setting the LED configuration through marvell,reg-init in the device tree, which should override said default if it exists. Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/marvell.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 280e8795b463..79ccc11facc3 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -407,15 +407,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev)
407 if (err < 0) 407 if (err < 0)
408 return err; 408 return err;
409 409
410 oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE); 410 return genphy_config_aneg(phydev);
411
412 phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
413 phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);
414 phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);
415
416 err = genphy_config_aneg(phydev);
417
418 return err;
419} 411}
420 412
421static int m88e1318_config_aneg(struct phy_device *phydev) 413static int m88e1318_config_aneg(struct phy_device *phydev)
@@ -636,6 +628,28 @@ static int m88e1111_config_init(struct phy_device *phydev)
636 return phy_write(phydev, MII_BMCR, BMCR_RESET); 628 return phy_write(phydev, MII_BMCR, BMCR_RESET);
637} 629}
638 630
631static int m88e1121_config_init(struct phy_device *phydev)
632{
633 int err, oldpage;
634
635 oldpage = phy_read(phydev, MII_MARVELL_PHY_PAGE);
636
637 err = phy_write(phydev, MII_MARVELL_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
638 if (err < 0)
639 return err;
640
641 /* Default PHY LED config: LED[0] .. Link, LED[1] .. Activity */
642 err = phy_write(phydev, MII_88E1121_PHY_LED_CTRL,
643 MII_88E1121_PHY_LED_DEF);
644 if (err < 0)
645 return err;
646
647 phy_write(phydev, MII_MARVELL_PHY_PAGE, oldpage);
648
649 /* Set marvell,reg-init configuration from device tree */
650 return marvell_config_init(phydev);
651}
652
639static int m88e1510_config_init(struct phy_device *phydev) 653static int m88e1510_config_init(struct phy_device *phydev)
640{ 654{
641 int err; 655 int err;
@@ -668,7 +682,7 @@ static int m88e1510_config_init(struct phy_device *phydev)
668 return err; 682 return err;
669 } 683 }
670 684
671 return marvell_config_init(phydev); 685 return m88e1121_config_init(phydev);
672} 686}
673 687
674static int m88e1118_config_aneg(struct phy_device *phydev) 688static int m88e1118_config_aneg(struct phy_device *phydev)
@@ -1196,7 +1210,7 @@ static struct phy_driver marvell_drivers[] = {
1196 .features = PHY_GBIT_FEATURES, 1210 .features = PHY_GBIT_FEATURES,
1197 .flags = PHY_HAS_INTERRUPT, 1211 .flags = PHY_HAS_INTERRUPT,
1198 .probe = marvell_probe, 1212 .probe = marvell_probe,
1199 .config_init = &marvell_config_init, 1213 .config_init = &m88e1121_config_init,
1200 .config_aneg = &m88e1121_config_aneg, 1214 .config_aneg = &m88e1121_config_aneg,
1201 .read_status = &marvell_read_status, 1215 .read_status = &marvell_read_status,
1202 .ack_interrupt = &marvell_ack_interrupt, 1216 .ack_interrupt = &marvell_ack_interrupt,
@@ -1215,7 +1229,7 @@ static struct phy_driver marvell_drivers[] = {
1215 .features = PHY_GBIT_FEATURES, 1229 .features = PHY_GBIT_FEATURES,
1216 .flags = PHY_HAS_INTERRUPT, 1230 .flags = PHY_HAS_INTERRUPT,
1217 .probe = marvell_probe, 1231 .probe = marvell_probe,
1218 .config_init = &marvell_config_init, 1232 .config_init = &m88e1121_config_init,
1219 .config_aneg = &m88e1318_config_aneg, 1233 .config_aneg = &m88e1318_config_aneg,
1220 .read_status = &marvell_read_status, 1234 .read_status = &marvell_read_status,
1221 .ack_interrupt = &marvell_ack_interrupt, 1235 .ack_interrupt = &marvell_ack_interrupt,