Skip to content

Commit

Permalink
net: phy: marvell: Limit errata to 88m1101
Browse files Browse the repository at this point in the history
The 88m1101 has an errata when configuring autoneg. However, it was
being applied to many other Marvell PHYs as well. Limit its scope to
just the 88m1101.

Fixes: 7688467 ("phylib: Add support for Marvell 88e1111S and 88e1145")
Reported-by: Daniel Walker <danielwa@cisco.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Harini Katakam <harinik@xilinx.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andrew Lunn authored and David S. Miller committed May 24, 2017
1 parent cd47512 commit f289978
Showing 1 changed file with 37 additions and 29 deletions.
66 changes: 37 additions & 29 deletions drivers/net/phy/marvell.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,34 +255,6 @@ static int marvell_config_aneg(struct phy_device *phydev)
{
int err;

/* The Marvell PHY has an errata which requires
* that certain registers get written in order
* to restart autonegotiation */
err = phy_write(phydev, MII_BMCR, BMCR_RESET);

if (err < 0)
return err;

err = phy_write(phydev, 0x1d, 0x1f);
if (err < 0)
return err;

err = phy_write(phydev, 0x1e, 0x200c);
if (err < 0)
return err;

err = phy_write(phydev, 0x1d, 0x5);
if (err < 0)
return err;

err = phy_write(phydev, 0x1e, 0);
if (err < 0)
return err;

err = phy_write(phydev, 0x1e, 0x100);
if (err < 0)
return err;

err = marvell_set_polarity(phydev, phydev->mdix_ctrl);
if (err < 0)
return err;
Expand Down Expand Up @@ -316,6 +288,42 @@ static int marvell_config_aneg(struct phy_device *phydev)
return 0;
}

static int m88e1101_config_aneg(struct phy_device *phydev)
{
int err;

/* This Marvell PHY has an errata which requires
* that certain registers get written in order
* to restart autonegotiation
*/
err = phy_write(phydev, MII_BMCR, BMCR_RESET);

if (err < 0)
return err;

err = phy_write(phydev, 0x1d, 0x1f);
if (err < 0)
return err;

err = phy_write(phydev, 0x1e, 0x200c);
if (err < 0)
return err;

err = phy_write(phydev, 0x1d, 0x5);
if (err < 0)
return err;

err = phy_write(phydev, 0x1e, 0);
if (err < 0)
return err;

err = phy_write(phydev, 0x1e, 0x100);
if (err < 0)
return err;

return marvell_config_aneg(phydev);
}

static int m88e1111_config_aneg(struct phy_device *phydev)
{
int err;
Expand Down Expand Up @@ -1892,7 +1900,7 @@ static struct phy_driver marvell_drivers[] = {
.flags = PHY_HAS_INTERRUPT,
.probe = marvell_probe,
.config_init = &marvell_config_init,
.config_aneg = &marvell_config_aneg,
.config_aneg = &m88e1101_config_aneg,
.read_status = &genphy_read_status,
.ack_interrupt = &marvell_ack_interrupt,
.config_intr = &marvell_config_intr,
Expand Down

0 comments on commit f289978

Please sign in to comment.