diff options
| author | Florian Fainelli <f.fainelli@gmail.com> | 2013-12-06 16:01:36 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-12-09 20:38:59 -0500 |
| commit | 78de53f05c58784e366b9115575058a5815c89d6 (patch) | |
| tree | cbb2962e425dd04fbd72bba257c95c9457fd4058 | |
| parent | 7cd1463664c2a15721ff4ccfb61d4d970815cb3d (diff) | |
net: pxa168_eth: use phy_init_hw for PHY reset
Instead of open-coding a PHY reset through the MII BMCR register, use
phy_init_hw() which does this for us and ensures that PHY device fixups
are also applied. We also remove a call to ethernet_phy_reset() which is
now unncessary since phy_attach() calls phy_attach_direct() which in
turns calls phy_init_hw().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/marvell/pxa168_eth.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index 2ad32417a52c..452e81de33de 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
| @@ -320,23 +320,6 @@ static void ethernet_phy_set_addr(struct pxa168_eth_private *pep, int phy_addr) | |||
| 320 | wrl(pep, PHY_ADDRESS, reg_data); | 320 | wrl(pep, PHY_ADDRESS, reg_data); |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | static void ethernet_phy_reset(struct pxa168_eth_private *pep) | ||
| 324 | { | ||
| 325 | int data; | ||
| 326 | |||
| 327 | data = phy_read(pep->phy, MII_BMCR); | ||
| 328 | if (data < 0) | ||
| 329 | return; | ||
| 330 | |||
| 331 | data |= BMCR_RESET; | ||
| 332 | if (phy_write(pep->phy, MII_BMCR, data) < 0) | ||
| 333 | return; | ||
| 334 | |||
| 335 | do { | ||
| 336 | data = phy_read(pep->phy, MII_BMCR); | ||
| 337 | } while (data >= 0 && data & BMCR_RESET); | ||
| 338 | } | ||
| 339 | |||
| 340 | static void rxq_refill(struct net_device *dev) | 323 | static void rxq_refill(struct net_device *dev) |
| 341 | { | 324 | { |
| 342 | struct pxa168_eth_private *pep = netdev_priv(dev); | 325 | struct pxa168_eth_private *pep = netdev_priv(dev); |
| @@ -645,7 +628,7 @@ static void eth_port_start(struct net_device *dev) | |||
| 645 | struct ethtool_cmd cmd; | 628 | struct ethtool_cmd cmd; |
| 646 | 629 | ||
| 647 | pxa168_get_settings(pep->dev, &cmd); | 630 | pxa168_get_settings(pep->dev, &cmd); |
| 648 | ethernet_phy_reset(pep); | 631 | phy_init_hw(pep->phy); |
| 649 | pxa168_set_settings(pep->dev, &cmd); | 632 | pxa168_set_settings(pep->dev, &cmd); |
| 650 | } | 633 | } |
| 651 | 634 | ||
| @@ -1382,7 +1365,6 @@ static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr) | |||
| 1382 | static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex) | 1365 | static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex) |
| 1383 | { | 1366 | { |
| 1384 | struct phy_device *phy = pep->phy; | 1367 | struct phy_device *phy = pep->phy; |
| 1385 | ethernet_phy_reset(pep); | ||
| 1386 | 1368 | ||
| 1387 | phy_attach(pep->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_MII); | 1369 | phy_attach(pep->dev, dev_name(&phy->dev), PHY_INTERFACE_MODE_MII); |
| 1388 | 1370 | ||
