From patchwork Thu Mar 16 20:54:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 13178318 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19B0CC6FD1F for ; Thu, 16 Mar 2023 21:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7aL6+PaJKgB9DN/+9+pLLp8j8wCgenWW6NZU9K1Cc7w=; b=ocnr6ck/NP2Huz Dee81zsdOP7aMet9aPr/+4h598UvpTZ18bObAgwLUvIUv7yYBIV7NpuEy5dinMBuuyXFt95ky1v1r 6m9GNFovpGshAGVJScyCMjJmHTDnpO7oZJGZXUrfK43d2jgjyv3sFLfHHxPykZAfqrmjTnELWvVyc XOZ/CHqfK0T+k5/2IkHFYTSsYecZTIEEbCUpEddSvRuHxE7ra21mTw7tv78WEBZ7H9DLm9xwFBsj1 DHagBlZlPBhkwJXlpikx4kkR4tgwWr8SoiZYDhO0uAaRHi3zMikZyJ0KapQJhNefW1cuqMnLKYLzG q/gTV4FcIf6+xbSV6nVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pcusV-00Hb5t-30; Thu, 16 Mar 2023 21:11:15 +0000 Received: from mail-he1eur01on0600.outbound.protection.outlook.com ([2a01:111:f400:fe1e::600] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pcusT-00Hb51-2U for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2023 21:11:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kQb14yN4dTkjDlgAEW3hpG+lMzjcCHph1CuCgkp8DysxG6IgTc9ktm+aTXQhy5BuAZu0GOphW7kOTNShB2rRUS1WajO2DCvjTPJVaK7jFDgB1eVIc2tn0+2ADqgh4KSnAVsETL2JWWjBTB7LDMMRdjjS8+X412CpFAQOIA7ztzQjlj50k7hOPyt16auSHxftIdGTCo4pvBu8b/KiEgBoWQMfXsw4D+KtTd+M+nACfQOeeqODjIRKkoca4pVoFo19oN/XW9HlE++CI8iqLjR3o2IEHYhydaNfEpKWCLpMmPGj16SvBRoe2zWhZLtWTvEb5qkIj3ZW4ik7RXde+GbUSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lXr44p+fst/2hgwuxGVR5dc2IvU2Hpcz5cQ4zHm+/OE=; b=TEYGFNgGQh7WIFr+y6pakOkbZxAMWaXqOmk7LCih31fhePnYpPiN9BTW9s7C2bqEyCZVPh68aE20TCoa7G3cECSfftvR6/GweEyDn0U8thHVLuWZezmCsv9mEMU8FvJxC1kThZzBvO4JG5swjvw+uHCCXMVLPC+IProoVIcKuhWyYbeJg6v8E6n8WRQYcziJXzZSd8adtd/nrYx3popzFYv1u5m+8sdqFvbOn1prMupT0GtK7r6XETeomTGLqQN66wb147U+cm/jpQ9qV3Gp1IwfpnKQAWxTg0ZmFvuwJVcWTbWsW3fsextiBiTR3wj/JURxHqSMwO1LJAI/6toG1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lXr44p+fst/2hgwuxGVR5dc2IvU2Hpcz5cQ4zHm+/OE=; b=eMqYbmJV6aCn9pXLgoM/i2xR17JQ3R8+16x2WCNNhiQwrPrDOFPn8bqlQQSiqP6NzW8IjAipouHA/eMsfdJlnNsh6XgZRgZoed7dibGtXWJQAOEhN1J3D08OYEn+Z7a/Q81t2btDnC0+/o2BNTF1wn0XSPLNr6t+yjB4iX445Ww= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by PAWPR04MB9960.eurprd04.prod.outlook.com (2603:10a6:102:38b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.31; Thu, 16 Mar 2023 20:55:20 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::31d:b51c:db92:cb15]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::31d:b51c:db92:cb15%9]) with mapi id 15.20.6178.031; Thu, 16 Mar 2023 20:55:18 +0000 From: Shenwei Wang To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Russell King Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Shenwei Wang Subject: [PATCH 1/1] net: stmmac: start PHY early in __stmmac_open Date: Thu, 16 Mar 2023 15:54:49 -0500 Message-Id: <20230316205449.1659395-1-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR03CA0288.namprd03.prod.outlook.com (2603:10b6:a03:39e::23) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|PAWPR04MB9960:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a983866-4461-48e0-e06a-08db2660bfdb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3ikPgYo+NfTRz1e7F5Wk5W9+aazDpZJek7FaFEHWoaOtQrslBzKwHY2RDx842x2G9jmqcJnn2ImBhyCDDWK8ZXgp1++u4/eMP85BArlAGjc93Wh5FsxseXxyY4+4PGKfFI4h9kr6atUeeGZg/Wc2oYMOZ9s9+UDNwShXx3W4hiiuuJxAEWL3f3H5gIzzl4KDZ/5xUjd/bVbnKzsm+Z1/MbUzxpssXaYd6g026/jyRG9VAgnKZKHVzEEIbkK3SBCfpaeQ4wzrpfIviC9GNTk/pG0aExa44yvfbRx9dM/DBCqNbCWgylgSGgPDUaxGz5+KOsAcw9ErobDgdmp1POz2jMSE30zAAUn5LBJ3xQUcki1uXyuVKN99aKh5vDRRJp5iHW+M4cYghM6Poi8B2B8F0H2Qv98bkkr5FZuBs7UGi0CFg+D6JSkPCasRSe/pn5FoG0PuvdIWtwBLKZiKv6y07GV5/W6KcTyYipvrc3iuVtEW6gmssbeEEzZy2CdTu0DXl7quRW7H4kYCSSbRAVpnDjyYafcRJe0P8RQ9BAt+VOUbb2VLXwGkSKxWyulpbitd/Jcc9uyizRcFW5qdWnpT0oIhcFwyc4it20+dGPfuTYHAQv+ncm52GOx9UqzcZYSbieAF1i4Zg1mosn2GIwICsjS0ZmJFK2nomcJCf0UQgv9v9IJ1Tsmunj8NxNGrln/BJOSXqccUfN70Xqu2FZVZTw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(376002)(396003)(136003)(366004)(346002)(451199018)(186003)(83380400001)(2616005)(36756003)(86362001)(38100700002)(2906002)(4326008)(38350700002)(66476007)(41300700001)(66946007)(66556008)(8676002)(8936002)(44832011)(7416002)(5660300002)(6506007)(1076003)(110136005)(26005)(478600001)(54906003)(52116002)(316002)(6666004)(6512007)(6486002)(55236004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 41qaYnkTpF18v7XWluB8XFRYkhsDvZCLMOepZ2guW5nwmytm2GAN9b+xIzZ8+MGYaH/E9dUKSXIY0RmEOULChKz7YvJZA7pKKFQDWxidOeKVJSqHr51uMCt+UJnNM8rkLIXyt6YOjU+rHIVRW+06a1Z9LtQ8GIugvolwmo+e8QmdETl4N0pWytAh6D/NrtMH78J1eeaQkrH0JMzqJ471jXlC8QyAUgF/1idXVTIMakjhq0VGkGQq4iYLIhZLq0luiO4Hw45mBfZATjOMacNSLRLo/ylbbd9LKMuYW2PNwNhFIM6kHaCVnAMInP8tZH4U5Gv3r3PvRh/jHPpNtykT2WmOgMMwq/o0B+R2UEJ9vwOKros+8c9K+i0ES0SIOEtNfUqBpou2t78NiGnV3YebgFxfXc4p/kvpBlgWXp7k57mXAjFibTm38yqjHKQQt9WRim3gKLYGzkaGilzToR02K1v8D0gs1NiesgogB+g9EIu0QNbDlL9xhY2psDLCddM5xomDONr47RG2iBfU4s35xetF5dxoJ22Jm5a//Q39RSbHoYBEEMRb2si2RhzXFFDdKcRxqpHZq8FLWXwIEssY4TVL9Zzl462NJX5gB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ossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2023 20:55:18.5142 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: w8oxHlufVYgpJlm0mxaJfLSsju73xibKTd/8WvxkMMdFzK20zWihU/XUtyNLEpqB8PVrkK2FL/+VVT0HI/ez/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR04MB9960 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230316_141113_811901_65FC0E24 X-CRM114-Status: GOOD ( 13.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org By initializing the PHY and establishing the link before setting the MAC relating configurations, this change ensures that the PHY is operational before the MAC logic starts relying on it. This can prevent synchronization errors and improve system stability. This change especially applies to the RMII mode, where the PHY may drive the REF_CLK signal, which requires the PHY to be started and operational before the MAC logic initializes. This change should not impact other modes of operation. Fixes: 74371272f97f ("net: stmmac: Convert to phylink and remove phylib logic") Signed-off-by: Shenwei Wang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 8f543c3ab5c5..4feeca4d0503 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3808,6 +3808,10 @@ static int __stmmac_open(struct net_device *dev, } } + phylink_start(priv->phylink); + /* We may have called phylink_speed_down before */ + phylink_speed_up(priv->phylink); + /* Extra statistics */ memset(&priv->xstats, 0, sizeof(struct stmmac_extra_stats)); priv->xstats.threshold = tc; @@ -3836,10 +3840,6 @@ static int __stmmac_open(struct net_device *dev, stmmac_init_coalesce(priv); - phylink_start(priv->phylink); - /* We may have called phylink_speed_down before */ - phylink_speed_up(priv->phylink); - ret = stmmac_request_irq(dev); if (ret) goto irq_error;