* [PATCH RESEND] net: smsc911x: Reset PHY during initialization
@ 2015-11-13 6:46 Pavel Fedin
2015-11-16 19:43 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Fedin @ 2015-11-13 6:46 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: 'Steve Glendinning'
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>
---
drivers/net/ethernet/smsc/smsc911x.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index c860c90..219a99b 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -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;
}
@@ -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;
--
2.4.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] net: smsc911x: Reset PHY during initialization
2015-11-13 6:46 [PATCH RESEND] net: smsc911x: Reset PHY during initialization Pavel Fedin
@ 2015-11-16 19:43 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-11-16 19:43 UTC (permalink / raw)
To: p.fedin; +Cc: netdev, linux-kernel, steve.glendinning
From: Pavel Fedin <p.fedin@samsung.com>
Date: Fri, 13 Nov 2015 09:46:59 +0300
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-16 19:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-13 6:46 [PATCH RESEND] net: smsc911x: Reset PHY during initialization Pavel Fedin
2015-11-16 19:43 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox