diff options
author | Woojung Huh <woojung.huh@microchip.com> | 2016-11-17 23:10:02 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-18 19:57:33 +0100 |
commit | f6e3ef3e4d3546b17e9901925276b70a9ea02d94 (patch) | |
tree | 5507a5d63ecd5a8f7431fb03ecc5523c42030792 /drivers/net/phy | |
parent | Merge branch 'net-marvell-freescale-compile-test' (diff) | |
download | linux-f6e3ef3e4d3546b17e9901925276b70a9ea02d94.tar.xz linux-f6e3ef3e4d3546b17e9901925276b70a9ea02d94.zip |
lan78xx: relocate mdix setting to phy driver
Relocate mdix code to phy driver to be called at config_init().
Signed-off-by: Woojung Huh <woojung.huh@microchip.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/microchip.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c index 7c00e508a101..eb4db2200287 100644 --- a/drivers/net/phy/microchip.c +++ b/drivers/net/phy/microchip.c @@ -106,6 +106,40 @@ static int lan88xx_set_wol(struct phy_device *phydev, return 0; } +static void lan88xx_set_mdix(struct phy_device *phydev) +{ + int buf; + int val; + + switch (phydev->mdix) { + case ETH_TP_MDI: + val = LAN88XX_EXT_MODE_CTRL_MDI_; + break; + case ETH_TP_MDI_X: + val = LAN88XX_EXT_MODE_CTRL_MDI_X_; + break; + case ETH_TP_MDI_AUTO: + val = LAN88XX_EXT_MODE_CTRL_AUTO_MDIX_; + break; + default: + return; + } + + phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, LAN88XX_EXT_PAGE_SPACE_1); + buf = phy_read(phydev, LAN88XX_EXT_MODE_CTRL); + buf &= ~LAN88XX_EXT_MODE_CTRL_MDIX_MASK_; + buf |= val; + phy_write(phydev, LAN88XX_EXT_MODE_CTRL, buf); + phy_write(phydev, LAN88XX_EXT_PAGE_ACCESS, LAN88XX_EXT_PAGE_SPACE_0); +} + +static int lan88xx_config_aneg(struct phy_device *phydev) +{ + lan88xx_set_mdix(phydev); + + return genphy_config_aneg(phydev); +} + static struct phy_driver microchip_phy_driver[] = { { .phy_id = 0x0007c130, @@ -120,7 +154,7 @@ static struct phy_driver microchip_phy_driver[] = { .remove = lan88xx_remove, .config_init = genphy_config_init, - .config_aneg = genphy_config_aneg, + .config_aneg = lan88xx_config_aneg, .read_status = genphy_read_status, .ack_interrupt = lan88xx_phy_ack_interrupt, |