Commit 990875b2 authored by Maxim Kochetkov's avatar Maxim Kochetkov Committed by David S. Miller
Browse files

net: phy: marvell: fix m88e1011_set_downshift



Changing downshift params without software reset has no effect,
so call genphy_soft_reset() after change downshift params.

As the datasheet says:
Changes to these bits are disruptive to the normal operation therefore,
any changes to these registers must be followed by software reset
to take effect.

Fixes: 911af5e1 ("net: phy: marvell: fix downshift function naming")
Signed-off-by: default avatarMaxim Kochetkov <fido_max@inbox.ru>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eefb45ee
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -1025,24 +1025,30 @@ static int m88e1011_get_downshift(struct phy_device *phydev, u8 *data)

static int m88e1011_set_downshift(struct phy_device *phydev, u8 cnt)
{
	int val;
	int val, err;

	if (cnt > MII_M1011_PHY_SCR_DOWNSHIFT_MAX)
		return -E2BIG;

	if (!cnt)
		return phy_clear_bits(phydev, MII_M1011_PHY_SCR,
	if (!cnt) {
		err = phy_clear_bits(phydev, MII_M1011_PHY_SCR,
				     MII_M1011_PHY_SCR_DOWNSHIFT_EN);

	} else {
		val = MII_M1011_PHY_SCR_DOWNSHIFT_EN;
		val |= FIELD_PREP(MII_M1011_PHY_SCR_DOWNSHIFT_MASK, cnt - 1);

	return phy_modify(phydev, MII_M1011_PHY_SCR,
		err = phy_modify(phydev, MII_M1011_PHY_SCR,
				 MII_M1011_PHY_SCR_DOWNSHIFT_EN |
				 MII_M1011_PHY_SCR_DOWNSHIFT_MASK,
				 val);
	}

	if (err < 0)
		return err;

	return genphy_soft_reset(phydev);
}

static int m88e1011_get_tunable(struct phy_device *phydev,
				struct ethtool_tunable *tuna, void *data)
{