diff options
author | Andrew Lunn <andrew@lunn.ch> | 2017-07-30 22:41:49 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-01 03:00:23 +0200 |
commit | fecd5e910ebed27fa68c34bf7ecc300a12950897 (patch) | |
tree | ecd89ae49b4555bfad33cf3aa74e80cda133e317 /drivers/net/phy/marvell.c | |
parent | net: phy: marvell: Refactor m88e1121 RGMII delay configuration (diff) | |
download | linux-fecd5e910ebed27fa68c34bf7ecc300a12950897.tar.xz linux-fecd5e910ebed27fa68c34bf7ecc300a12950897.zip |
net: phy: marvell: Use the set_polarity helper
Some of the init functions unilaterally enable set auto cross over
without using the helper. Make use of the helper, and respect the
phydev MDI configuration.
Clean up the #define used while setting polarity, and the other
functions of the bits in the register.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r-- | drivers/net/phy/marvell.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 408442bdef0a..34fd15b904e7 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -55,10 +55,12 @@ #define MII_M1011_IMASK_INIT 0x6400 #define MII_M1011_IMASK_CLEAR 0x0000 -#define MII_M1011_PHY_SCR 0x10 -#define MII_M1011_PHY_SCR_MDI 0x0000 -#define MII_M1011_PHY_SCR_MDI_X 0x0020 -#define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060 +#define MII_M1011_PHY_SCR 0x10 +#define MII_M1011_PHY_SCR_DOWNSHIFT_EN BIT(11) +#define MII_M1011_PHY_SCR_DOWNSHIFT_SHIFT 12 +#define MII_M1011_PHY_SCR_MDI (0x0 << 5) +#define MII_M1011_PHY_SCR_MDI_X (0x1 << 5) +#define MII_M1011_PHY_SCR_AUTO_CROSS (0x3 << 5) #define MII_M1111_PHY_LED_CONTROL 0x18 #define MII_M1111_PHY_LED_DIRECT 0x4100 @@ -486,8 +488,7 @@ static int m88e1121_config_aneg(struct phy_device *phydev) if (err < 0) return err; - err = phy_write(phydev, MII_M1011_PHY_SCR, - MII_M1011_PHY_SCR_AUTO_CROSS); + err = marvell_set_polarity(phydev, phydev->mdix_ctrl); if (err < 0) return err; @@ -655,10 +656,13 @@ static int m88e1116r_config_init(struct phy_device *phydev) if (err < 0) return err; + err = marvell_set_polarity(phydev, phydev->mdix_ctrl); + if (err < 0) + return err; + temp = phy_read(phydev, MII_M1011_PHY_SCR); - temp |= (7 << 12); /* max number of gigabit attempts */ - temp |= (1 << 11); /* enable downshift */ - temp |= MII_M1011_PHY_SCR_AUTO_CROSS; + temp |= (7 << MII_M1011_PHY_SCR_DOWNSHIFT_SHIFT); + temp |= MII_M1011_PHY_SCR_DOWNSHIFT_EN; err = phy_write(phydev, MII_M1011_PHY_SCR, temp); if (err < 0) return err; @@ -891,8 +895,7 @@ static int m88e1118_config_aneg(struct phy_device *phydev) if (err < 0) return err; - err = phy_write(phydev, MII_M1011_PHY_SCR, - MII_M1011_PHY_SCR_AUTO_CROSS); + err = marvell_set_polarity(phydev, phydev->mdix_ctrl); if (err < 0) return err; |