Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753139AbbK3Hb2 (ORCPT ); Mon, 30 Nov 2015 02:31:28 -0500 Received: from mail-bn1on0119.outbound.protection.outlook.com ([157.56.110.119]:2273 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752176AbbK3HbW (ORCPT ); Mon, 30 Nov 2015 02:31:22 -0500 From: Duan Andy To: =?utf-8?B?TG90aGFyIFdhw59tYW5u?= CC: Andrew Lunn , "David S. Miller" , Fabio Estevam , Kevin Hao , Lucas Stach , Philippe Reynes , Russell King , Uwe Kleine-K?nig , "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , Stefan Agner Subject: RE: [PATCH] net: fec: fix enet_out clock handling Thread-Topic: [PATCH] net: fec: fix enet_out clock handling Thread-Index: AQHRKRk2yV8ik/j4gEuk1Xs5hLkIYJ6xaVuggAK83oCAAAYTEA== Date: Mon, 30 Nov 2015 07:31:19 +0000 Message-ID: References: <1448631550-943-1-git-send-email-LW@KARO-electronics.de> <20151130075617.0f880cd1@ipc1.ka-ro> In-Reply-To: <20151130075617.0f880cd1@ipc1.ka-ro> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=fugang.duan@freescale.com; x-originating-ip: [123.151.195.51] x-microsoft-exchange-diagnostics: 1;CY1PR03MB1437;5:zc3L2P9oqwLUgLvRvuEUjw7V56XrlqWfMhUmpNFEWpaA8nzEkBYXaCIINyzNVgxLrzS53IQ44pSrThwgq8z0gTs2qGF2orUEd/uPJg8CAQVJcrHiBVF3xl8ylLTrGJ4f+W6x7f5dalfE2cI715tH3w==;24:JjdP68/zDp0EOWp6lJmr5lEqM+31LHoWNnUYh7fEOxcew4MYeoEAW9F0G9Fi8KR8M8hGjcsezcOkgycPRZnAFytibKFTyDOgy3BHHcYSHMA= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1437; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(10201501046)(3002001);SRVR:CY1PR03MB1437;BCL:0;PCL:0;RULEID:;SRVR:CY1PR03MB1437; x-forefront-prvs: 0776C39A48 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(377454003)(189002)(19580405001)(50986999)(40100003)(122556002)(110136002)(2950100001)(76576001)(5002640100001)(1220700001)(5001960100002)(99286002)(77096005)(10400500002)(5003600100002)(106116001)(33656002)(105586002)(106356001)(54356999)(19580395003)(586003)(86362001)(101416001)(97736004)(81156007)(102836003)(1096002)(87936001)(92566002)(6116002)(3846002)(66066001)(2900100001)(11100500001)(74316001)(76176999)(5008740100001)(5004730100002)(189998001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR03MB1437;H:BN3PR0301MB1219.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2015 07:31:19.2839 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR03MB1437 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id tAU7W6GM017132 Content-Length: 2488 Lines: 55 From: Lothar Waßmann Sent: Monday, November 30, 2015 2:56 PM > To: Duan Fugang-B38611 > Cc: Andrew Lunn; David S. Miller; Estevam Fabio-R49496; Kevin Hao; Lucas > Stach; Philippe Reynes; Russell King; Uwe Kleine-K?nig; linux- > kernel@vger.kernel.org; netdev@vger.kernel.org; Stefan Agner > Subject: Re: [PATCH] net: fec: fix enet_out clock handling > > Hi, > > > From: Lothar Waßmann Sent: Friday, November > > 27, 2015 9:39 PM > > > To: Andrew Lunn; David S. Miller; Estevam Fabio-R49496; Kevin Hao; > > > Lothar Waßmann; Lucas Stach; Duan Fugang-B38611; Philippe Reynes; > > > Russell King; Uwe Kleine-König; linux-kernel@vger.kernel.org; > > > netdev@vger.kernel.org; Stefan Agner > > > Subject: [PATCH] net: fec: fix enet_out clock handling > > > > > > When ENET_OUT is being used as reference clock for an external PHY, > > > the clock must not be disabled while the PHY is active. Otherwise > > > the PHY may lose its internal state and require a reset to become > functional again. > > > > > > A symptom for this bug is a network interface that constantly > > > toggles between UP and DOWN state: > > > fec 800f0000.ethernet eth0: Link is Up - 100Mbps/Full - flow control > > > rx/tx fec 800f0000.ethernet eth0: Link is Down fec 800f0000.ethernet > eth0: > > > Link is Up - 100Mbps/Full - flow control rx/tx fec 800f0000.ethernet > eth0: > > > Link is Down [...] > > > > > > Signed-off-by: Lothar Waßmann > > > --- > > > drivers/net/ethernet/freescale/fec_main.c | 34 > > > +++++++++++++------------ > > > ------ > > > 1 file changed, 14 insertions(+), 20 deletions(-) > > > > > > > When MAC is not ready with clocks disabled, it is not necessary to > supply clock for PHY. In fact, PHY also is not ready, why does it need > clock ? > > For your problem, you must add PHY reset in your dts file to resolve > your problem. > > > The phy-reset-gpio property is set in the DTB. But fec_reset_phy() which > asserts the RESET is only called from within the probe() function. > It should probably be called from fec_restart() instead? > After enet_out clock enable, you can call fec_reset_phy() do phy reset. Don't put it in .fec_restart() function because Cable hotplug test cause phy registers reset to HW default status. Regards, Andy ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?