提交 01b0114e 编写于 作者: F Florian Fainelli 提交者: David S. Miller

net: tc35815: use phy_init_hw for PHY reset

Instead of open-coding the PHY reset through MII BMCR, use phy_init_hw()
which does that for us and also makes sure that any PHY specific fixups
are applied.
Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 78de53f0
...@@ -1170,19 +1170,12 @@ static int tc35815_tx_full(struct net_device *dev) ...@@ -1170,19 +1170,12 @@ static int tc35815_tx_full(struct net_device *dev)
static void tc35815_restart(struct net_device *dev) static void tc35815_restart(struct net_device *dev)
{ {
struct tc35815_local *lp = netdev_priv(dev); struct tc35815_local *lp = netdev_priv(dev);
int ret;
if (lp->phy_dev) { if (lp->phy_dev) {
int timeout; ret = phy_init_hw(lp->phy_dev);
if (ret)
phy_write(lp->phy_dev, MII_BMCR, BMCR_RESET); printk(KERN_ERR "%s: PHY init failed.\n", dev->name);
timeout = 100;
while (--timeout) {
if (!(phy_read(lp->phy_dev, MII_BMCR) & BMCR_RESET))
break;
udelay(1);
}
if (!timeout)
printk(KERN_ERR "%s: BMCR reset failed.\n", dev->name);
} }
spin_lock_bh(&lp->rx_lock); spin_lock_bh(&lp->rx_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册