Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753292AbcJJRlM (ORCPT ); Mon, 10 Oct 2016 13:41:12 -0400 Received: from skprod3.natinst.com ([130.164.80.24]:40395 "EHLO ni.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752973AbcJJRlK (ORCPT ); Mon, 10 Oct 2016 13:41:10 -0400 From: Kyle Roeschley To: f.fainelli@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Kyle Roeschley Subject: [RFC] net: phy: smsc: Disable auto-negotiation on startup Date: Mon, 10 Oct 2016 12:41:23 -0500 Message-Id: <20161010174123.21436-1-kyle.roeschley@ni.com> X-Mailer: git-send-email 2.9.3 X-MIMETrack: Itemize by SMTP Server on US-AUS-MGWOut2/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 10/10/2016 12:41:03 PM, Serialize by Router on US-AUS-MGWOut2/AUS/H/NIC(Release 8.5.3FP6 HF1218|December 12, 2014) at 10/10/2016 12:41:03 PM, Serialize complete at 10/10/2016 12:41:03 PM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-10_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1310 Lines: 42 Because the SMSC PHY completes auto-negotiation before the driver is ready to handle interrupts, the PHY state machine never realizes that we have a link. Clear the ANENABLE bit on initialization, which lets genphy_config_aneg do its thing when that code is hit later. While this patch does fix the problem we see (no link on boot without re-plugging the cable), it seems like the generic PHY code should be able to handle auto-negotiation completing before interrupts are enabled. Submitted as an RFC in the hopes that someone has an idea as to how that could be done. This fix is copied from commit 99f81afc139c ("phy: micrel: Disable auto negotiation on startup"). Signed-off-by: Kyle Roeschley --- drivers/net/phy/smsc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index b62c4aa..8de8011 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -62,6 +62,16 @@ static int smsc_phy_config_init(struct phy_device *phydev) return rc; } + if (phy_interrupt_is_valid(phydev)) { + rc = phy_read(phydev, MII_BMCR); + if (rc < 0) + return rc; + + rc = phy_write(phydev, MII_BMCR, rc & ~BMCR_ANENABLE); + if (rc < 0) + return rc; + } + return smsc_phy_ack_interrupt(phydev); } -- 2.9.3