aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-03-01 16:52:09 -0500
committerDavid S. Miller <davem@davemloft.net>2016-03-01 16:52:09 -0500
commitf0da74bc8140001c6afd2a176e397c3c3aaca37a (patch)
tree9a5f0505739358bb9ad908e4d7a959849199cf00
parentppp: lock ppp->flags in ppp_read() and ppp_poll() (diff)
parentphy: micrel: Disable auto negotiation on startup (diff)
downloadlinux-dev-f0da74bc8140001c6afd2a176e397c3c3aaca37a.tar.xz
linux-dev-f0da74bc8140001c6afd2a176e397c3c3aaca37a.zip
Merge branch 'phy-micrel-fixes'
Alexandre Belloni says: ==================== phy: micrel: fix issues with interrupt on atmel boards Since the phy is not polled anymore, there were issues getting a link on the sama5d* xplained boards. I'm not too sure about were those fixes should go and I'm wondering whether the first one shoud be made generic. For the second one, I found the PHY_HAS_MAGICANEG flag that is not used and I wondering whether this is related to that kind of issue. I had a quick look at the history and could'nt find its use. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/micrel.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 03833dbfca67..dc85f7095e51 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -297,6 +297,17 @@ static int kszphy_config_init(struct phy_device *phydev)
if (priv->led_mode >= 0)
kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode);
+ if (phy_interrupt_is_valid(phydev)) {
+ int ctl = phy_read(phydev, MII_BMCR);
+
+ if (ctl < 0)
+ return ctl;
+
+ ret = phy_write(phydev, MII_BMCR, ctl & ~BMCR_ANENABLE);
+ if (ret < 0)
+ return ret;
+ }
+
return 0;
}
@@ -635,6 +646,21 @@ static void kszphy_get_stats(struct phy_device *phydev,
data[i] = kszphy_get_stat(phydev, i);
}
+static int kszphy_resume(struct phy_device *phydev)
+{
+ int value;
+
+ mutex_lock(&phydev->lock);
+
+ value = phy_read(phydev, MII_BMCR);
+ phy_write(phydev, MII_BMCR, value & ~BMCR_PDOWN);
+
+ kszphy_config_intr(phydev);
+ mutex_unlock(&phydev->lock);
+
+ return 0;
+}
+
static int kszphy_probe(struct phy_device *phydev)
{
const struct kszphy_type *type = phydev->drv->driver_data;
@@ -844,7 +870,7 @@ static struct phy_driver ksphy_driver[] = {
.get_strings = kszphy_get_strings,
.get_stats = kszphy_get_stats,
.suspend = genphy_suspend,
- .resume = genphy_resume,
+ .resume = kszphy_resume,
}, {
.phy_id = PHY_ID_KSZ8061,
.name = "Micrel KSZ8061",