Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753585AbbKMGrG (ORCPT ); Fri, 13 Nov 2015 01:47:06 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:17329 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750779AbbKMGrE (ORCPT ); Fri, 13 Nov 2015 01:47:04 -0500 X-AuditID: cbfec7f4-f79c56d0000012ee-9a-56458764ed85 From: Pavel Fedin To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "'Steve Glendinning'" Subject: [PATCH RESEND] net: smsc911x: Reset PHY during initialization Date: Fri, 13 Nov 2015 09:46:59 +0300 Message-id: <000401d11ddf$18dffce0$4a9ff6a0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdEd3xhJglN66BT4S8ij8fpZsIbdeg== Content-language: ru X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t/xa7op7a5hBvNOSlhc3jWHzeLYAjGL 5k+vmByYPf43X2bx+LxJLoApissmJTUnsyy1SN8ugSvj9JqSguWCFVPvzmNvYFzP18XIySEh YCIxccU1FghbTOLCvfVsXYxcHEICSxklZq1tYgNJCAl8Z5TYcTQSwtaWOD3zGDuIzSagLnH6 6wegZg4OEQELiRNtWSBhZgFziQsP7oG1Cgu4STQv/g1mswioSrTOvsMMYvMKWErcX7SLBcIW lPgx+R4LRK+WxPqdx5kgbHmJzWveMkPcpiCx4+xrRohVehIPG0QhSkQkpv27xzyBUXAWkkmz kEyahWTSLCQtCxhZVjGKppYmFxQnpeca6hUn5haX5qXrJefnbmKEhPGXHYyLj1kdYhTgYFTi 4U165hImxJpYVlyZe4hRgoNZSYR3MUiINyWxsiq1KD++qDQntfgQozQHi5I479xd70OEBNIT S1KzU1MLUotgskwcnFINjJX7zqetYVzGWhL2rjSUkSOO9397lcnk2nQlz3xDff5JW/rMVmr9 aI9cK7Em2/38NE/XoPyZJU+MQk131FUcO92s5mPE6CiwtfXlIp+IvHi1/vClT1znntm7+2B6 31+zXfEO2tkcAVaXHWb3qTJvLrUs638csclA0lr3xUnxy1dlPDMnSO1RYinOSDTUYi4qTgQA 5ci17F8CAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2396 Lines: 69 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/