Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754005AbdLFBuX (ORCPT ); Tue, 5 Dec 2017 20:50:23 -0500 Received: from mail-ve1eur01on0063.outbound.protection.outlook.com ([104.47.1.63]:18304 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753674AbdLFBuS (ORCPT ); Tue, 5 Dec 2017 20:50:18 -0500 From: Andy Duan To: Richard Leitner , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "andrew@lunn.ch" , "f.fainelli@gmail.com" , "frowand.list@gmail.com" CC: "davem@davemloft.net" , "geert+renesas@glider.be" , "sergei.shtylyov@cogentembedded.com" , "baruch@tkos.co.il" , "david.wu@rock-chips.com" , "lukma@denx.de" , "netdev@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "richard.leitner@skidata.com" Subject: RE: [PATCH net-next v3 4/4] net: fec: add phy_reset_after_clk_enable() support Thread-Topic: [PATCH net-next v3 4/4] net: fec: add phy_reset_after_clk_enable() support Thread-Index: AQHTbcywCErLmvbit0yBnahadCjONaM1im7w Date: Wed, 6 Dec 2017 01:50:14 +0000 Message-ID: References: <20171205132600.13796-1-dev@g0hl1n.net> <20171205132600.13796-5-dev@g0hl1n.net> In-Reply-To: <20171205132600.13796-5-dev@g0hl1n.net> Accept-Language: zh-CN, 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@nxp.com; x-originating-ip: [199.59.231.64] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB6PR0401MB2261;6:PvqMIXqcdCMnhcRIlSOx+PrKSn39+ajmefJNcsAIrX8mveMWXpxr4GxtxyFfPMpuCpr41P9ozpT0Kec1TncDLZHtG3Wl7D8EVqoNqj1pFbEhItNMhxLyItPC/k0EXEofyTJLtv+VkDACKa1V9+sXaiwusJqFsAHClXAW5AmukNB8MI8DV4b9/sonGlrwVmpmv9Wsy2Mu4ef4f/eOAUPGRSPY7Nq7y8B0tG3yo1zXRCG6zXbBHYC8iylNoin0SXX3EW47Qxot+gDqjvQQmCXNjEzrhKN1L96mlLCn94huoHCACfy50TQZR/x292vWaVnTPWFNiYDwHe1fdDZBXPxvAIEESe9j6s3iFEjkonCoanw=;5:9jlRskf/Ektx2JQlZw2qXfjZfCvgOju+izYH+F4oP0Fn69chFXY/BSpIHqU9wy83X7SG0vV+xa8+KKJQQPA6/EfOBbFzHYXJoO/mvQ8q5QhvLF65+EUNmXTX8zNHWnhlqbxFLRv8MSDDi1Lwcx/boJ+oyR9YADNMntUSN/LaObA=;24:VUpF4gVjcYVU6SJGwQ21ptPFgrlJaXQl1c1NkgXr3oTkqrPSOTmYJRrPO8uQXaR9LjlTzLH+nAD4DPvK2DpLGZ0XOn3fZp3LJI0gfjXm7vU=;7:t2akiTgaro1LvODH+wbeBAjPXTFHnn/0Xkyh2W66kSSVKZEyyDxHhiLeZpr0Bc7m4fIE9S0zQizPALYzT8gEPE7bJkTpsIPDzl6ji++ZgBe/B56J0+dc1gC5AvQV6vOahsnYtc0M6or+/RINr1wrZ5PIIx9sPwYnBNwBfQ3lNj5KpnNA9xM1k4BxFKKpopfwh8Rz4IlmozCkvoYSay9sDBA02V6jbV4C1ujLPVvotliG75/O9xRrSF1vj/22eWj/ x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: bb5e2daa-047c-44e8-7b78-08d53c4bb1cc x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603286);SRVR:DB6PR0401MB2261; x-ms-traffictypediagnostic: DB6PR0401MB2261: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(189930954265078)(185117386973197)(45079756050767); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231022)(6055026)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123558100)(20161123555025)(6072148)(201708071742011);SRVR:DB6PR0401MB2261;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:DB6PR0401MB2261; x-forefront-prvs: 05134F8B4F x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(376002)(39860400002)(366004)(199004)(189003)(5250100002)(74316002)(478600001)(6306002)(305945005)(106356001)(33656002)(105586002)(229853002)(101416001)(7696005)(102836003)(110136005)(25786009)(3660700001)(3280700002)(316002)(54906003)(14454004)(2900100001)(2501003)(6246003)(66066001)(7736002)(2950100002)(45080400002)(99286004)(97736004)(2906002)(81166006)(6436002)(7416002)(2201001)(6116002)(53936002)(8936002)(86362001)(68736007)(6506006)(575784001)(39060400002)(76176011)(9686003)(5660300001)(3846002)(8676002)(4326008)(81156014)(55016002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0401MB2261;H:DB6PR0401MB2264.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb5e2daa-047c-44e8-7b78-08d53c4bb1cc X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Dec 2017 01:50:14.4881 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2261 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 quoted-printable to 8bit by nfs id vB61oRhu002192 Content-Length: 2939 Lines: 69 From: Richard Leitner Sent: Tuesday, December 05, 2017 9:26 PM >Some PHYs (for example the SMSC LAN8710/LAN8720) doesn't allow turning >the refclk on and off again during operation (according to their datasheet). >Nonetheless exactly this behaviour was introduced for power saving reasons >by commit e8fcfcd5684a ("net: fec: optimize the clock management to save >power"). >Therefore add support for the phy_reset_after_clk_enable function from >phylib to mitigate this issue. > >Generally speaking this issue is only relevant if the ref clk for the PHY is >generated by the SoC and therefore the PHY is configured to "REF_CLK In >Mode". In our specific case (PCB) this problem does occur at about every 10th >to 50th POR of an LAN8710 connected to an i.MX6SOLO SoC. The typical >symptom of this problem is a "swinging" ethernet link. >Similar issues were reported by users of the NXP forum: > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F >%2Fcommunity.nxp.com%2Fthread%2F389902&data=02%7C01%7Cfugang.du >an%40nxp.com%7C7f9fee272fc44662c2a108d53be3d1ee%7C686ea1d3bc2b4c6 >fa92cd99c5c301635%7C0%7C0%7C636480772022331090&sdata=7RdUsoWVWu >o1nM5zKwLt7%2F6U3dxgDJtBDGlQCUWC6IM%3D&reserved=0 > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F >%2Fcommunity.nxp.com%2Fmessage%2F309354&data=02%7C01%7Cfugang.d >uan%40nxp.com%7C7f9fee272fc44662c2a108d53be3d1ee%7C686ea1d3bc2b4 >c6fa92cd99c5c301635%7C0%7C0%7C636480772022331090&sdata=D56KilGWD3 >kLABxc0yOI%2B44Y%2FhLfrGtdAvupCEyvI%2BI%3D&reserved=0 >With this patch applied the issue didn't occur for at least a few hundret PORs >of our board. > >Fixes: e8fcfcd5684a ("net: fec: optimize the clock management to save >power") >Signed-off-by: Richard Leitner >--- > drivers/net/ethernet/freescale/fec_main.c | 7 +++++++ > 1 file changed, 7 insertions(+) > >diff --git a/drivers/net/ethernet/freescale/fec_main.c >b/drivers/net/ethernet/freescale/fec_main.c >index 610573855213..8c3d0fb7db20 100644 >--- a/drivers/net/ethernet/freescale/fec_main.c >+++ b/drivers/net/ethernet/freescale/fec_main.c >@@ -1862,6 +1862,8 @@ static int fec_enet_clk_enable(struct net_device >*ndev, bool enable) > ret = clk_prepare_enable(fep->clk_ref); > if (ret) > goto failed_clk_ref; >+ >+ phy_reset_after_clk_enable(ndev->phydev); > } else { > clk_disable_unprepare(fep->clk_ahb); > clk_disable_unprepare(fep->clk_enet_out); >@@ -2860,6 +2862,11 @@ fec_enet_open(struct net_device *ndev) > if (ret) > goto err_enet_mii_probe; > >+ /* reset phy if needed here, due to the fact this is the first time we >+ * have the net_device to phy_driver link >+ */ >+ phy_reset_after_clk_enable(ndev->phydev); >+ The patch series look better. But why does it need to reset phy here since phy already is hard reset after clock enable. > if (fep->quirks & FEC_QUIRK_ERR006687) > imx6q_cpuidle_fec_irqs_used(); > >-- >2.11.0