From 3473c2e3e88f4a2046a24f164d7d67ad5db27b1e Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Wed, 9 Dec 2015 15:38:17 +0100 Subject: 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 -> Link stays down, a ping to a valid address does fail. Signed-off-by: Max Krummenacher Acked-by: Marcel Ziswiler --- drivers/net/phy/phy.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- cgit v1.2.3