summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-12-09 15:38:17 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-12-15 13:44:12 +0100
commit3473c2e3e88f4a2046a24f164d7d67ad5db27b1e (patch)
treec5ba185df404bc851ad86c6f1b034e5efe5ea79f
parent24fa00c8b43358ea4bf9c1200d209656c36f27e1 (diff)
phy.c: clear flags for special PHY modes on phy_reset
Clear the following flags on SW reset: BMCR_PDOWN|BMCR_LOOPBACK|BMCR_CTST They are cleared by a HW/POR reset but not if the PHY goes through a SW reset. If the BMCR_PDOWN bit is set on reboot U-Boot fails to use Ethernet otherwise. Steps to reproduce the issue without the patch (from within Linux): Don't use phy_reset or use the unpatched version in U-Boot. Then: ip link set down eth0 reboot stop in U-Boot ping <connected host> -> Link stays down, a ping to a valid address does fail. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--drivers/net/phy/phy.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index df7e9450c2..48e86d76af 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -696,6 +696,12 @@ int phy_reset(struct phy_device *phydev)
reg |= BMCR_RESET;
+#ifdef CONFIG_MX6
+ /* at least on a Micrel KSZ8041 the following bits do not get
+ * cleared by a SW reset, but they should */
+ reg &= ~(BMCR_PDOWN|BMCR_LOOPBACK|BMCR_CTST);
+#endif
+
if (phy_write(phydev, devad, MII_BMCR, reg) < 0) {
debug("PHY reset failed\n");
return -1;