diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2013-12-06 16:01:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-09 20:38:59 -0500 |
commit | 7cd1463664c2a15721ff4ccfb61d4d970815cb3d (patch) | |
tree | 830fb41aa25cf2a85f6067cce2f087ad84ac1f86 | |
parent | 87aa9f9c61ad56d505641681812e92ad976f8608 (diff) |
net: mv643xx_eth: use phy_init_hw to reset PHY
Instead of open-coding a PHY reset through the MII BMCR register, use
phy_init_hw() which does that for us and will also make sure that PHY
fixups are applied if required. We also remove a call to phy_reset()
due to the following sequence of calls in the driver:
phy_scan()
-> phy_connect()
-> phy_connect_direct()
-> phy_attach_direct()
-> phy_init_hw()
and we only have a call to phy_init() after phy_scan().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/marvell/mv643xx_eth.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index fa905052fbf4..b3d9327f78b9 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -2066,23 +2066,6 @@ static inline void oom_timer_wrapper(unsigned long data) | |||
2066 | napi_schedule(&mp->napi); | 2066 | napi_schedule(&mp->napi); |
2067 | } | 2067 | } |
2068 | 2068 | ||
2069 | static void phy_reset(struct mv643xx_eth_private *mp) | ||
2070 | { | ||
2071 | int data; | ||
2072 | |||
2073 | data = phy_read(mp->phy, MII_BMCR); | ||
2074 | if (data < 0) | ||
2075 | return; | ||
2076 | |||
2077 | data |= BMCR_RESET; | ||
2078 | if (phy_write(mp->phy, MII_BMCR, data) < 0) | ||
2079 | return; | ||
2080 | |||
2081 | do { | ||
2082 | data = phy_read(mp->phy, MII_BMCR); | ||
2083 | } while (data >= 0 && data & BMCR_RESET); | ||
2084 | } | ||
2085 | |||
2086 | static void port_start(struct mv643xx_eth_private *mp) | 2069 | static void port_start(struct mv643xx_eth_private *mp) |
2087 | { | 2070 | { |
2088 | u32 pscr; | 2071 | u32 pscr; |
@@ -2095,7 +2078,7 @@ static void port_start(struct mv643xx_eth_private *mp) | |||
2095 | struct ethtool_cmd cmd; | 2078 | struct ethtool_cmd cmd; |
2096 | 2079 | ||
2097 | mv643xx_eth_get_settings(mp->dev, &cmd); | 2080 | mv643xx_eth_get_settings(mp->dev, &cmd); |
2098 | phy_reset(mp); | 2081 | phy_init_hw(mp->phy); |
2099 | mv643xx_eth_set_settings(mp->dev, &cmd); | 2082 | mv643xx_eth_set_settings(mp->dev, &cmd); |
2100 | } | 2083 | } |
2101 | 2084 | ||
@@ -2763,8 +2746,6 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex) | |||
2763 | { | 2746 | { |
2764 | struct phy_device *phy = mp->phy; | 2747 | struct phy_device *phy = mp->phy; |
2765 | 2748 | ||
2766 | phy_reset(mp); | ||
2767 | |||
2768 | if (speed == 0) { | 2749 | if (speed == 0) { |
2769 | phy->autoneg = AUTONEG_ENABLE; | 2750 | phy->autoneg = AUTONEG_ENABLE; |
2770 | phy->speed = 0; | 2751 | phy->speed = 0; |