Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f0da74bc authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parents edffc217 99f81afc
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -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",