Skip to content

Commit

Permalink
net: smsc911x: Reset PHY during initialization
Browse files Browse the repository at this point in the history
On certain hardware after software reboot the chip may get stuck and fail
to reinitialize during reset. This can be fixed by ensuring that PHY is
reset too.

Old PHY resetting method required operational MDIO interface, therefore
the chip should have been already set up. In order to be able to function
during probe, it is changed to use PMT_CTRL register.

The problem could be observed on SMDK5410 board.

Signed-off-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Fedin authored and David S. Miller committed Nov 16, 2015
1 parent c3d4c68 commit cd998ec
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions drivers/net/ethernet/smsc/smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -809,22 +809,17 @@ static int smsc911x_phy_check_loopbackpkt(struct smsc911x_data *pdata)

static int smsc911x_phy_reset(struct smsc911x_data *pdata)
{
struct phy_device *phy_dev = pdata->phy_dev;
unsigned int temp;
unsigned int i = 100000;

BUG_ON(!phy_dev);
BUG_ON(!phy_dev->bus);

SMSC_TRACE(pdata, hw, "Performing PHY BCR Reset");
smsc911x_mii_write(phy_dev->bus, phy_dev->addr, MII_BMCR, BMCR_RESET);
temp = smsc911x_reg_read(pdata, PMT_CTRL);
smsc911x_reg_write(pdata, PMT_CTRL, temp | PMT_CTRL_PHY_RST_);
do {
msleep(1);
temp = smsc911x_mii_read(phy_dev->bus, phy_dev->addr,
MII_BMCR);
} while ((i--) && (temp & BMCR_RESET));
temp = smsc911x_reg_read(pdata, PMT_CTRL);
} while ((i--) && (temp & PMT_CTRL_PHY_RST_));

if (temp & BMCR_RESET) {
if (unlikely(temp & PMT_CTRL_PHY_RST_)) {
SMSC_WARN(pdata, hw, "PHY reset failed to complete");
return -EIO;
}
Expand Down Expand Up @@ -2296,7 +2291,7 @@ static int smsc911x_init(struct net_device *dev)
}

/* Reset the LAN911x */
if (smsc911x_soft_reset(pdata))
if (smsc911x_phy_reset(pdata) || smsc911x_soft_reset(pdata))
return -ENODEV;

dev->flags |= IFF_MULTICAST;
Expand Down

0 comments on commit cd998ec

Please sign in to comment.