Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933369AbcJLRpp (ORCPT ); Wed, 12 Oct 2016 13:45:45 -0400 Received: from mail-co1nam03on0100.outbound.protection.outlook.com ([104.47.40.100]:18688 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932324AbcJLRpg (ORCPT ); Wed, 12 Oct 2016 13:45:36 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kyle.roeschley@ni.com; Date: Wed, 12 Oct 2016 10:09:14 -0500 From: Kyle Roeschley To: Jeremy Linton CC: , , Subject: Re: [RFC] net: phy: smsc: Disable auto-negotiation on startup Message-ID: <20161012150914.aoxvdtrf5gh5z5t4@senary> References: <20161010174123.21436-1-kyle.roeschley@ni.com> <4ced57d0-febe-181c-5f41-41ff3e018857@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <4ced57d0-febe-181c-5f41-41ff3e018857@arm.com> User-Agent: NeoMutt/20160916 (1.7.0) X-Originating-IP: [130.164.62.227] X-ClientProxiedBy: BY2PR1001CA0064.namprd10.prod.outlook.com (10.164.163.32) To BN6PR04MB0212.namprd04.prod.outlook.com (10.168.224.21) X-MS-Office365-Filtering-Correlation-Id: ff97eeb7-8423-43e9-55cf-08d3f2b1afc6 X-Microsoft-Exchange-Diagnostics: 1;BN6PR04MB0212;2:/VKclyxWrvldTrju0gaY1Wq0REUa2UMyOydy1cj4kp8uIbh6fj6Bs5cEsx6OvXhMRgloV14iLgOIr0ZZbA+7egeXFmYUJ5NgSrgMQfjObbXEvzTnMBIZqniKXeTNj9kcl4GxqzLlXrZGRHwQCrgk6J2oQNrpkq+FVtcfc1Rk+22aG8M5l7nfnaDPtn6oPI4D61CwcdwkvzUaDWzS8QmJ0g==;3:vrqh1UZQ83VXL+BGL7llA5sSA/MqY54jtzAuMdutntLbirh3lO3sc9OMKBkUP08ZAAmpTAuokWHiKCcx/SvPkuy3txe/uhr0+V3b18WKLA9LDjxPybtjh852sUr738hBzTcGi9CXQeD44MIXMV9+Eg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN6PR04MB0212; X-Microsoft-Exchange-Diagnostics: 1;BN6PR04MB0212;25:LZZlTaB4EdbiO+M59NtV6H5EX4QEuK/mLVOp363/5ISB6FSnwcSwU7JQZVi/o/MRMiqPt9eryaX0yl9KnYSwxUO3s01vqNEI7uhFU+xYPHEnqQK/L54GDshlrkzP+BCVuOiDkPvhx66nRF1ur3LIv5JbzBm/lyTWIjlGcY0aUitxHjT0u7wbVVkqAE8uJIyipgJb4BkRCV0+atvIwOFfR0mHG+4waZoi0JWgVBkMTzBqVyvcWVgeuFUYKtDBty2C4PAVDES6jiC04PqCdWhCqI3grqlWi8b+tEU8ipQ7vehCCMNfXbpp6/NRP26azWZ6nu3lM8ijMtw/2wpfsLiBTGoSHhIEwZ1/w7b7QaRwaJVnx6jAb5fGlOIpNlUxnSyIQswlr8eW4QrNQ77vozF0Z6IMdA/uay89YDaS9F5KtLWhVj+h/Vv5vgPAWQqpiu5wff/I1XzrMEugIX9s6arvHAgBvBC7ivmTaxzJVWBr36gbsJ9j8cCWUQnfAZegbidJf5MaSELDMX08v2qUL4uvY3LnEDIRf0+r1YHplgSir5/QW625KNuW5W756a6/rtxOvW3FNnTRg5AnOQtOsS1IYWXaqN/JfdzvzPE2uuI8sAtLGSH3JXDNpuovpa3Row+p9E7jPU3kdyYyLzdDv56k3N8dxl/Kx52GyE2rgUkVmjo6pz+eLu+Ha2rX2rve5bPlH4InR5QOCjfkr/fXI48Fg+j8rk0cwjJGCqe4HAsr3TfKgh1gGIynBPQpwxMi1cewMGndfG9qCeD6knrhuHASksAC8Dn45pMmVysqXSEYm9ojV9juVQNy4sozYG/odzbEcnEyfSsYg1HqwpLKSehCwA== X-Microsoft-Exchange-Diagnostics: 1;BN6PR04MB0212;31:vIFl7BWQPClOnVm7Bc4196PdIO/g1jO3hwMjOws4QbFercvUVPgPAWkNgw195VsEJuFuAIdds+BcNZc6GYEyjRTqWnioqUGGiHmphif8oZXyoVLbsfgi9SU2UCkn9WPIzQ0//hV5Z3FzqgRbiDnmJGp+H2hc83QYqGMy4qUlDtCqlGZpIjr9NJX+legrByXDue0wQmwPDDypGezcXu9t1FOlvPeqX225/0/ElcIowyAQknvJgigZEnaooKDp/SqKyoDQS8+vlxNsHMbAR6wvHg==;20:D+GRrlFdvB5W5AgN8UvgG+Am2dZfCxRK4IbA6qwFklkdYA23m1V7v0ZhnZ2BrY9nHsiKTvAZhbNRU6jr1pDyIKqhyawLpu5iz8aQsWAZRMAAQWOPJvsGuQnpV3uHRmySZM9Jc5I6bFUW9//FlLZ+UIADaj9rTtObDPGIevnr6Hs1n1rvg+7vqeCODBr7S+0i94gDwHoufMzHZe4seCV23BQP5lsD1RzF2ieX+FteEx0wUsz+MBZ3qwcDgjRsXrxYR3mmCgDDOeLcje9ifae00yHHce8vaXd1m87Et1HEC1Ik58MyHBsm7x06o/Xl7f0Dx20My3wtzKfgb8cSs5C+izOrmXXRPfHgeH9LlWyelBM+6kkrPnv+6LEi8UoNnS0E+7ewYHlxuNEb4M5OpF8m9DdqmRqo3uspT1bCiq9R0cdzFgRaaHc9zfdvmhR+9chCn+ywmJcq+oeCy0hA7H3fR42rd4s9K1CaRYEMXBzX8bP0JGfBJm3FKOjb/9bXN69/c1DTsZMksmyyvOUvMXRidof6U4WqsXh1PUZorMhxpSneqDMmco/R3hJexp+ctP4B1DDZ8CYf9/ZyR0PMIaj6XFafu7W/07cFz9NUFdOhlyc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(145744241990776); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:BN6PR04MB0212;BCL:0;PCL:0;RULEID:;SRVR:BN6PR04MB0212; X-Microsoft-Exchange-Diagnostics: 1;BN6PR04MB0212;4:KL1f8ZgReXmWqDpY5ifFOOcq7BPO1GYc2D7/O19CTyNRyKZuK2zVY2/vHjiCze1bPy61u7cQUWvUlcHfJ1JIXVYKknw2olIKtnPRfQGDodtJka4/13ZS+lak72qQL8jXZpoA2DxAyjKhEVmIDNsWYCF9ofd3mSUFQHWYZHHdoLdmGxatef3MzlEC8ujdoj+QVFKsR550E3TwjZttOzhCYIrGUa12Nq52umMco61JtKr9+Dv+oCTremubTj1OP+PCavZZnrBHFEyFZ2xcUJJiUl3PcwiibGk9xLYXInuovcH4GBM48D9ZwJi9PTjTYHBskHXLfbZg2L7hppjSVRoAm8BzseF4p9GZsxAGO6LBxVl+TRYS9fWDad+Fvh9jlmJlaBps8ZQSCA/7eray0zJu8+56VUsStALtI1/63V7kTPRqkXetmRzhwJj+dmkNVW0E X-Forefront-PRVS: 0093C80C01 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(377454003)(24454002)(86362001)(46406003)(5660300001)(2906002)(4326007)(47776003)(66066001)(6116002)(189998001)(4001350100001)(50466002)(586003)(23726003)(83506001)(1076002)(3846002)(97736004)(15975445007)(19580395003)(7846002)(2950100002)(7736002)(6666003)(42186005)(92566002)(6916009)(9686002)(19580405001)(33716001)(305945005)(68736007)(33646002)(81156014)(50986999)(110136003)(97756001)(81166006)(106356001)(8676002)(77096005)(54356999)(101416001)(76176999)(105586002);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR04MB0212;H:senary;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR04MB0212;23:8iwovlMJLH1tHTthF/+AK490Kc0rAz0XEXqJI/wGg?= =?us-ascii?Q?whqAEGopp8+6Ko0qjUJJ91unks3LQYlpe/lPP5EqIWA+j8zabCBrUNTrzX2p?= =?us-ascii?Q?k7vKvK2K1po2qFSDwj6Xv1lLWKM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iHPsCSBTehMQiL5tMjS9hCFlTvNffjlswKqkAHwWdN9vsqwz?= =?us-ascii?Q?pGNhppGwey3NZcJHcWfy9yorItrm4GKzzVOefTe0N0dXZCbrT8Sz6A5/UD3p?= =?us-ascii?Q?ut5zabKVM8qZOPHr2OFEDrtJ1ieIQhzol5caDGqpObaqnPzknx5KD54acGdG?= =?us-ascii?Q?lXvU6zxonCxkjAoi+raGpK1X1te2a8urATemesxMKqLxhBjrYObEcUvSw=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN6PR04MB0212;6:eYCVHDn0MYEVZZ3dVaziHKzivZJNS7MKgxHWmht58oMT8ULNy2wa3xknemXc2M3fvxuNqRMpfkipG0FkNt6NK5LNts0LSz5t1qoZ39HAF3sR1ZhQrvTORPZmHBHBQgxMxgKpZV1E2i4CztktJmukicUkrYBCTEW5ffdeIfPI3bTh/8LGYcvz18uWcvVUUFSKfsr6IPMo+4hdMxCW9K/DmoV2AQkCF0aq+SjjH6RhmaXgPBNQVWhR9+Sew4zHn5WtEgCa5y0IE6yJTVcW1LvyqNIxUe6inQAMHmI596y5ZqLrCpwdM0cpPH0D+r740JGu;5:cUpy0RlZlFyFkKaY07j0lbEEIvyH1truhcgeCiswPRPThLXIRPiMY0n3crTK9CPdF8sRY230mRL79zoI13R1LVOIfAMBa8u71khHuFJBk/wIANc4Vo0EbdrfCKSmx4SZKqo87hd+La+x6C9rt3qyyw==;24:vMZP1R0lT/eSOZccXrZcifHTsfVNjJCTke6p7dKcccph8h57AWpeAnSu8zn2OtHp2L/rkDfbOVhimjprxLpRjj8byzJwH+ex7iFQsGHISik=;7:0cUognrEpjVTUzIwgzD4989bXqiBSe55S/2fQP8y1KY/FIt32uiCnbKIFbGrd1G4xufggpTpz399ym2nqd4ShwnDhOX/UNm6PUZ+nuL8/efQvEDKb317v8db3qEKASVz303oL7/d6VZ7n5ZIXC5R2yvdUmjPXjUWAiyOtyGDECCkP7n+mhrphpTjGI78eWTMPtceBG0033qOs2oOR8JgaAKKEwEq1wrL38M/CNTdhdm/7PYV1NXVE5kVtXmhzMfAsEdVmbKrSR6V7pwN568aUSKAL7q3YaXlnE5N5npORN04OyMvzp80T+sIYcARLtfDMNB3D+zTnX67atOEFF2+ouiR5RVAD3nkeRfGKUe4AyA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ni.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2016 15:08:55.4970 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR04MB0212 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2269 Lines: 66 On Tue, Oct 11, 2016 at 09:32:30AM -0500, Jeremy Linton wrote: > On 10/10/2016 12:41 PM, Kyle Roeschley wrote: > > 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. > > Hi, > > Which smsc chip/driver? Maybe assuring the device interrupts are enabled > before the phy is started is a solution? > > The whole problem sounds similar to what was recently happening in the > smsc911x driver, but AFAIK that driver is basically only polling at this > point so connecting the phy before the interrupts are enabled shouldn't be a > problem. > We're using the SMSC LAN8720A with the Cadence MACB ethernet controller. Interrupts are enabled before the phy is started, but it looks like the patch Florian pointed me to (https://www.spinics.net/lists/netdev/msg397857.html) fixes my interrupt problem. > > > > 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); > > } > > > > > -- Kyle Roeschley Software Engineer National Instruments