* [PATCH] net: marvell: Add separate config ANEG function for Marvell 88E1111
@ 2016-06-27 7:39 Harini Katakam
2016-06-29 8:09 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Harini Katakam @ 2016-06-27 7:39 UTC (permalink / raw)
To: f.fainelli, harinikatakamlinux
Cc: netdev, linux-kernel, harinik, punnaia, michals
Marvell 88E1111 currently uses the generic marvell config ANEG function.
This function has a sequence accessing Page 5 and Register 31,
both of which are not defined or reserved for this PHY.
Hence this patch adds a new config ANEG function for Marvell 88E1111
without these erroneous accesses.
Signed-off-by: Harini Katakam <harinik@xilinx.com>
---
drivers/net/phy/marvell.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 280e879..783d0ca 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -285,6 +285,48 @@ static int marvell_config_aneg(struct phy_device *phydev)
return 0;
}
+static int m88e1111_config_aneg(struct phy_device *phydev)
+{
+ int err;
+
+ /* The Marvell PHY has an errata which requires
+ * that certain registers get written in order
+ * to restart autonegotiation
+ */
+ err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+
+ err = marvell_set_polarity(phydev, phydev->mdix);
+ if (err < 0)
+ return err;
+
+ err = phy_write(phydev, MII_M1111_PHY_LED_CONTROL,
+ MII_M1111_PHY_LED_DIRECT);
+ if (err < 0)
+ return err;
+
+ err = genphy_config_aneg(phydev);
+ if (err < 0)
+ return err;
+
+ if (phydev->autoneg != AUTONEG_ENABLE) {
+ int bmcr;
+
+ /* A write to speed/duplex bits (that is performed by
+ * genphy_config_aneg() call above) must be followed by
+ * a software reset. Otherwise, the write has no effect.
+ */
+ bmcr = phy_read(phydev, MII_BMCR);
+ if (bmcr < 0)
+ return bmcr;
+
+ err = phy_write(phydev, MII_BMCR, bmcr | BMCR_RESET);
+ if (err < 0)
+ return err;
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_OF_MDIO
/*
* Set and/or override some configuration registers based on the
@@ -1161,7 +1203,7 @@ static struct phy_driver marvell_drivers[] = {
.flags = PHY_HAS_INTERRUPT,
.probe = marvell_probe,
.config_init = &m88e1111_config_init,
- .config_aneg = &marvell_config_aneg,
+ .config_aneg = &m88e1111_config_aneg,
.read_status = &marvell_read_status,
.ack_interrupt = &marvell_ack_interrupt,
.config_intr = &marvell_config_intr,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: marvell: Add separate config ANEG function for Marvell 88E1111
2016-06-27 7:39 [PATCH] net: marvell: Add separate config ANEG function for Marvell 88E1111 Harini Katakam
@ 2016-06-29 8:09 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-06-29 8:09 UTC (permalink / raw)
To: harini.katakam
Cc: f.fainelli, harinikatakamlinux, netdev, linux-kernel, harinik,
punnaia, michals
From: Harini Katakam <harini.katakam@xilinx.com>
Date: Mon, 27 Jun 2016 13:09:59 +0530
> Marvell 88E1111 currently uses the generic marvell config ANEG function.
> This function has a sequence accessing Page 5 and Register 31,
> both of which are not defined or reserved for this PHY.
> Hence this patch adds a new config ANEG function for Marvell 88E1111
> without these erroneous accesses.
>
> Signed-off-by: Harini Katakam <harinik@xilinx.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-29 8:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-27 7:39 [PATCH] net: marvell: Add separate config ANEG function for Marvell 88E1111 Harini Katakam
2016-06-29 8:09 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).