From patchwork Wed Dec 21 08:01:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 13078501 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 386B9C4332F for ; Wed, 21 Dec 2022 08:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234481AbiLUICw (ORCPT ); Wed, 21 Dec 2022 03:02:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234450AbiLUICm (ORCPT ); Wed, 21 Dec 2022 03:02:42 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0EE2164B3; Wed, 21 Dec 2022 00:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XPJpB7vBMkvLeJpNcFOiDUnN6bCJDKNIFJ1tQJAup4XuJxeQxhMzFLP5L/mmV/oYIjM/cp2V3QOHLe8nPrGdE6tvZM485rfQ0DTGASVJI0aVBaKdl0gBoAcUIpK/yLIIuqyELUmhsq+sTtq9XC45E4cq/KjV75FBultRap3bzI/KSha1rVWXXGczx0pPbAgPFNWIpAcaayGx971S/K9M4MdpAV/Emt4FICwOEjbg73RbF3kRHXXLNzgOWIqoU0CP5PH73ZpeZSLNMTzQKaYQPvAfqIhRh1iM8yINSvw++GRJfiBZb0JlRtdHTIKXuZ9oHOw38eS4Lem0fcviRNNjEA== 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=yR60+Ui3v8eqpdeEf/eDfnZJ55leMLByQTG7sD8xCc4=; b=EHp030D5Auxvj1DP9ZQ4EBaqxowiBvM4c8hbly2meNOdAl/UOujTyAxZgejXwXKra6fxJFRXVX5gWEDki/wANYVAs+OTMXe+Xa1qYrlD/wm9Vzs4FiLXuYOQykSMCy+XLzMs1a3nutSnomNAaD7s85C7tinxR+ggeIPhmVGlACoiHuX9Ys4bDQNTUqrBaPmFt3zNjWBjXrlbGOMXaLgCtk5GGXDxHUGww85LPTZu+rIoKxhHw44jw5/P9R9nbcQacFELIZTxO/Hgt44gf0iaA8apwyEDfWDqbI6P11TZivpgwc5yQO2NiP+lrWHoImjR/o7HC4vXj6W6SiGOl6as1g== 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=yR60+Ui3v8eqpdeEf/eDfnZJ55leMLByQTG7sD8xCc4=; b=jnyW7AeQF3iwRZk+dYYRJoAp/tB3DTvOOhTcVeArMAbSw16pagm/MCMM5DPybqVa8snn/GwkV/ypWhfmlfH+OfASiS+p4kgOtS/NZvj6waSY6wU1XIPHKhO1jTUgAP+PGLcrBVph8K2wrnprPhhNDGS0lKKGdCJEibtp1wb3pw0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from HE1PR0402MB2939.eurprd04.prod.outlook.com (2603:10a6:3:db::18) by PAXPR04MB8426.eurprd04.prod.outlook.com (2603:10a6:102:1ca::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 08:02:39 +0000 Received: from HE1PR0402MB2939.eurprd04.prod.outlook.com ([fe80::76a3:36aa:1144:616c]) by HE1PR0402MB2939.eurprd04.prod.outlook.com ([fe80::76a3:36aa:1144:616c%11]) with mapi id 15.20.5924.016; Wed, 21 Dec 2022 08:02:37 +0000 From: Clark Wang To: linux@armlinux.org.uk, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] net: phylink: add a function to resume phy alone to fix resume issue with WoL enabled Date: Wed, 21 Dec 2022 16:01:43 +0800 Message-Id: <20221221080144.2549125-2-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221080144.2549125-1-xiaoning.wang@nxp.com> References: <20221221080144.2549125-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SI2PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:196::10) To HE1PR0402MB2939.eurprd04.prod.outlook.com (2603:10a6:3:db::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB2939:EE_|PAXPR04MB8426:EE_ X-MS-Office365-Filtering-Correlation-Id: a03ec048-9d13-47a2-e959-08dae329b9a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FzTp8Z8gaWD/mKQl7duTK6GJCzaPivDjUZ/MX3iosogk9URIMMNR0DHEu7rCxnQSe0Lt1Y5+ei20PMePVMMbrxc2GEs88BKA672MGt0kHCPrWG08IyNZvSN3gGPJPA3p0vmtbnSvaCdjM7Z1eaPYyCAsQ0KuRWtUSWAlGbXLGBDB5vl2uJt7Q9J5947z9Ofwj3C0+ILezAr/6mlJ4/E1ZjNyC8w6ssh20Tvoa1MFSNgPPPMP/xqbv2LKC26lXXmp6zwXIowGvoiEpk75MOF+vwLbUounem1GdNM+opkGzu72QB3t0plbWK108KVJ80na69m7Q6lzbjyxbLOM1hE9L3JwUcO6H5CkBvJRYLy5EApyFvPULBJ8OVG843Plh+0pxov415mDkz09xRE7ojaOm1qwxcly2cMgYJ2ftzwjKujJGQ6LxnlcEW7AKA7diXW+UhUnE6vxuSrjMuUHV2hGMXzoVNiy6WNuM9myX0qS9bONl2t1yNxR8rD0mQIwbI1ODt9xZuQC8vmGifX5R7G4pD0ft4UFyctw757Bbb/jz1OiVSr8WkYhJW0xeYlM/e63Y4vqDicGnE3FCSMsyNXcjO0lLs48o6BMS03kmcFjHN1wJvnX+wMmoadwtrYnF1zsL3/F5LOhtOIwUywoZTXMV3RSiUExJXb6l02O05uoiwDRlMQ4pQlALPqQohhlZFrxnUUuIdC6lCHykTzCdcz/jQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB2939.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(346002)(39860400002)(396003)(376002)(451199015)(478600001)(6486002)(6506007)(186003)(6512007)(2906002)(26005)(36756003)(52116002)(41300700001)(66476007)(66556008)(66946007)(8676002)(4326008)(5660300002)(7416002)(83380400001)(921005)(1076003)(316002)(8936002)(38350700002)(38100700002)(2616005)(86362001)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nnDqotW4dqL8qKDCIeevYUh5g42AUgFw8SD8JmrkazuCJLTtM3MqUS5FdEC5rUK6qMTNNX5HlztaBcXUYxEbAqBxeeX3roiyLOo/qRBFGVMyULibUWXbiCOzNMuU/8RJDOYoR/z7s/ood9mBUZw6GNMq6NqvsITETgKEzYgS5k4wOqExF+pfOQGZK3ggaIcrEJtGs1X3taC2Ll5mzxwCVRDoUVvGrMlOAemuvsLxcSsBT5wjyFAB8Szpvj/uIRV4AgNxg1/NUIXDOkN+4PxGwVjJQVr/Ts0ig2Fac/OMjGzG76pCRPzSGln3EyHPB1pkg3tYP3lfNjHo8NMVVhSlbyOcBQwST4R8gCzMkWpPW6K/xt5peY0yWI3Un1YNHx14K5VH0CmrbFy+WgVugZ1UhDzDChEOIZ8heP4L//TMteg6XbPMtY/kpKy3rz/RRb3SojqPycouUO1p/gKXZ9AYrAcybQcF7n4jEzKsSrhicVZJhvl6DdbDPFX315ozL5+T7z76Od3HLEIFT606b1iAIOhmxrEjejI7J7iKFLOBOfvWQiKjIJa1v/CSir7HF12lxXjmPKMZskqyfDfP/P8nvfSe5SYFjkTEmIGlzQnQRBq7JG3jXr9AxqK8KV3ZGzPlWvrvGUyxo+afHf/lVHwDrTB8KQu/fGlle7gViCs2Jx73nfBACr2zp7eny2J6CbHkzJFwQkH1BmhB+cTqWhQawZNbmtHgdvBK9G13lwzG2n6WYORdc6/c43aVH6IM79F9nBiKMiQwqeSbcpUPoMWYBIpp6kNbjJa3uEztrfKUtvaTRDA1zQhpO4uxUPRlZDaiLD83MQ4bqxLmJI1GpAtg/9QJ6GDr33XzKEGWGEIj3zcxl8ORFbFNjwhP19rkKeVCAN9GlbwrS43sTs51XevJ1BDHBm6iy+6nt3yD/grNV5p//3fSgQNPeVAO8pW6Loq5vE7s7uyRjBJM+IdaFuLTwhuOCiecvxtwkWbZCzag+393pNSRbXnDDwatuPvaf+N4KcwttVgKKAwxXUrF9QC9VggwDRqZG9yevUYpK7wydKN6XTr5wPjCcP/OgqseQcUu6Q+UQafQivPEkRoqo1rcdOQGhPpZz8x1BhCNmPPcTabELLVT+Qzy5XIzvNvVC4sAObfMKzrP2cr68b2ximfCEtkU7wBcg2rAr5M+kXSWgdZB43szpbWnpR98BBzvaGIvMozynK15SsE7VQHPtCFCe1XIjwiPVzXXeoxbgbARwemx30H67srOzH2jFMqMtHvcdHToUA/0XPUOwncesL6O5ss7uuHeHWh83+asWdsdnoaDeIme5hxXdHXu71tVJLzzy+sTnZEojq0sN5MElAGO6hf55GljVJd38QcHaQqvJOpg/KaR4sYCrnVKTAqLBByiK67LTx1vt2vVLqTQS3FXUGRLAW8IIxi0qMkTtKP/rOxPfkGy6iyvFkCYNI/45YC9WG0oDxOaSifEOXkIdSXnopSE4B0sEE7Vknu2BjlYMfvqNbLGbhzvwnJZnjmrzftUfQuTK+JFIpNnlVoYXl4M4vPehkas4hFwdGtDjX0otgOAjo1Ui5ZM5NN62z7OvCTs X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a03ec048-9d13-47a2-e959-08dae329b9a2 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB2939.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 08:02:37.6315 (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: bFU6aLxemrPp9ObViBn+aOr5Uis5rWBUE2ai7aaMIhN1hPISZgCCwLKr5pwr/G21eBNiA6WNGrkyvR43wzekBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8426 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Issue we met: On some platforms, mac cannot work after resumed from the suspend with WoL enabled. The cause of the issue: 1. phylink_resolve() is in a workqueue which will not be executed immediately. This is the call sequence: phylink_resolve()->phylink_link_up()->pl->mac_ops->mac_link_up() For stmmac driver, mac_link_up() will set the correct speed/duplex... values which are from link_state. 2. In stmmac_resume(), it will call stmmac_hw_setup() after called the phylink_resume(), because mac need phy rx_clk to do the reset. stmmac_core_init() is called in function stmmac_hw_setup(), which will reset the mac and set the speed/duplex... to default value. Conclusion: Because phylink_resolve() cannot determine when it is called, it cannot be guaranteed to be called after stmmac_core_init(). Once stmmac_core_init() is called after phylink_resolve(), the mac will be misconfigured and cannot be used. In order to avoid this problem, add a function called phylink_phy_resume() to resume phy separately. This eliminates the need to call phylink_resume() before stmmac_hw_setup(). Add another judgement before called phy_start() in phylink_start(). This way phy_start() will not be called multiple times when resumes. At the same time, it may not affect other drivers that do not use phylink_phy_resume(). Signed-off-by: Clark Wang --- drivers/net/phy/phylink.c | 21 ++++++++++++++++++++- include/linux/phylink.h | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 09cc65c0da93..5bab59142579 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1939,7 +1939,7 @@ void phylink_start(struct phylink *pl) } if (poll) mod_timer(&pl->link_poll, jiffies + HZ); - if (pl->phydev) + if (pl->phydev && pl->phydev->state < PHY_UP) phy_start(pl->phydev); if (pl->sfp_bus) sfp_upstream_start(pl->sfp_bus); @@ -2020,6 +2020,25 @@ void phylink_suspend(struct phylink *pl, bool mac_wol) } EXPORT_SYMBOL_GPL(phylink_suspend); +/** + * phylink_phy_resume() - resume phy alone + * @pl: a pointer to a &struct phylink returned from phylink_create() + * + * In the MAC driver using phylink, if the MAC needs the clock of the phy + * when it resumes, can call this function to resume the phy separately. + * Then proceed to MAC resume operations. + */ +void phylink_phy_resume(struct phylink *pl) +{ + ASSERT_RTNL(); + + if (!test_bit(PHYLINK_DISABLE_MAC_WOL, &pl->phylink_disable_state) + && pl->phydev) + phy_start(pl->phydev); + +} +EXPORT_SYMBOL_GPL(phylink_phy_resume); + /** * phylink_resume() - handle a network device resume event * @pl: a pointer to a &struct phylink returned from phylink_create() diff --git a/include/linux/phylink.h b/include/linux/phylink.h index c492c26202b5..6edfab5f754c 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -589,6 +589,7 @@ void phylink_stop(struct phylink *); void phylink_suspend(struct phylink *pl, bool mac_wol); void phylink_resume(struct phylink *pl); +void phylink_phy_resume(struct phylink *pl); void phylink_ethtool_get_wol(struct phylink *, struct ethtool_wolinfo *); int phylink_ethtool_set_wol(struct phylink *, struct ethtool_wolinfo *); From patchwork Wed Dec 21 08:01:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 13078500 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EA3AC10F1B for ; Wed, 21 Dec 2022 08:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234470AbiLUICt (ORCPT ); Wed, 21 Dec 2022 03:02:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234456AbiLUICp (ORCPT ); Wed, 21 Dec 2022 03:02:45 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2040.outbound.protection.outlook.com [40.107.14.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D86FC15FF6; Wed, 21 Dec 2022 00:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jrzKt3adAGZfFvbgFyWnPxFlz3eOzBP8JGvKx2xI5XFtwjreavfePL1CmK9XRH6jWbfzU5QS+8ohihCJmV9EKuJ1srqqHR3MJaVvVEsXax0zFJ665cxc2m8kr3AlBN4bG2dYUHZveGjtb6KeUlts7SyEC5Av1dTl/0I2a6eOHaNkMyZywC91inv17TJo/mf7Mw4upeSIKNbBcRgByno+t88kBR6opHolwt3Sae7e2oXxkiaPgIksj09TFT6TViLXgWy1xjeVEEE4k3s69wZs7Q8/D6JyYmqEsutAxgMJIFkjmwA4Uhg01xEpQwJs4xrth8qffms/NfodI+cob3/fGQ== 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=uocUIT9079Ltf+3eXIeJi8GnjNsBVSY0m8bP2M/6vwA=; b=MRNbQHBHKRK0Ryi6qkp6JDvaFckltqEpwt4zh11u2EgeAfm5dBniVAnguKlPvxRsgFsHBaNieugTWVybTiIb8gR3a0vR/2G8n5zcB6vuQriFAQ7ZChKSefF2eZ/QTG3CsI9yThypqTmyvgWsGSBRiQxMsk6kFUIoPKZuqcTLUkizNJkLGO0R6oSdaW2kY3kM3HRUQ+hcspbn0D0vrbZJg7s3c+qybCnpdDMvybDdFQP1mhvNYTdljQSb9IvRVJWabDbptMbh8jnmEgOoecuKmz4v/8Bnf5seh5dl31N2h+30Q/hLwpqUZjBSpVYNRaitei32EYblAduQikcuYgZShg== 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=uocUIT9079Ltf+3eXIeJi8GnjNsBVSY0m8bP2M/6vwA=; b=l7lvTbcanP+CI7bdxyzidKyjKA56IZqT1GSajYxaBwEv7yW4xAcqhGV49b5Z0q+nNK9jDh5Nc/9OKNojiZ5CalT8LW/6s18ORWw/rvlIYC+kGteOF0h7gX/8CR9lPKWMH/8rNcrqUhiDVftaOtGU9UYXw82zaCae/VaHm1/iXoI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from HE1PR0402MB2939.eurprd04.prod.outlook.com (2603:10a6:3:db::18) by PAXPR04MB8426.eurprd04.prod.outlook.com (2603:10a6:102:1ca::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 08:02:42 +0000 Received: from HE1PR0402MB2939.eurprd04.prod.outlook.com ([fe80::76a3:36aa:1144:616c]) by HE1PR0402MB2939.eurprd04.prod.outlook.com ([fe80::76a3:36aa:1144:616c%11]) with mapi id 15.20.5924.016; Wed, 21 Dec 2022 08:02:42 +0000 From: Clark Wang To: linux@armlinux.org.uk, peppe.cavallaro@st.com, alexandre.torgue@foss.st.com, joabreu@synopsys.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] net: stmmac: resume phy separately before calling stmmac_hw_setup() Date: Wed, 21 Dec 2022 16:01:44 +0800 Message-Id: <20221221080144.2549125-3-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221221080144.2549125-1-xiaoning.wang@nxp.com> References: <20221221080144.2549125-1-xiaoning.wang@nxp.com> X-ClientProxiedBy: SI2PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:196::10) To HE1PR0402MB2939.eurprd04.prod.outlook.com (2603:10a6:3:db::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0402MB2939:EE_|PAXPR04MB8426:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a95fdf1-618e-4dc2-0750-08dae329bc7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lwA+oJWn2fgqD9tae56bDtEC8n1O4I4m79+VvJC/Z3IDW/51NC8nE1P9xtKDyRMuL+1SLA7peYVZbC6pzRwHoFjqK4hdCHL+hzRZQMbe3ud0f3gsn/OsW6hxp/F9fjlOo0XmTBYtNix0DqUInyvB4VO/uppj1QGRo+YyHydeB93TW+MNPbh2AVoECBtSebNnFKAUMK/6mJd8BGHnwpc8FaCIOBUSQiU7c1MMThPr9qaa12jE+0hBnmOkGOXE1HGjBYaAdJClqOlU6cNsAqOnBq14pYq9VtukSyk8BOVKPaLRXXurB3X8ZjW7wxlJ/Q/eUPOiTViYPnHT4a5Ygd64eTDMbRqgKknPs/y93ZmLy4mrsZmMS2TVeP3ECKTUn6tLxcJq07ZixdXqMF5eSRPzSvV6Dx3xtM7MHGUotVaRaqzIIFzNSDu6GBps2zBq1W68elR2Gh0MmqVYjV+xu4dly/pUQMvMWhEcMP4r2JVCuX1Tx5u4kp9ZgS2Woj4YFbiFQL8grrpa2YgcA4OBvIwkKoi2R/CW6BD9kbK6ny+yf8weUJF2A5Lty6VsKF+/WF2H/vMTisszebBI9ayiAYRYzMO6fRQh8GtaEQXOG5bDjew+AlAVsViwLp+vrekdNUo/sbL/ioJk9B56TDt6J+1jDbZfQaF7zyUCBnjVUH2J493plFmVrqINnjOVHIrXuCJbGmcpZXV0KweLFGKt1Fcjxg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:HE1PR0402MB2939.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(346002)(39860400002)(396003)(376002)(451199015)(478600001)(6486002)(6506007)(186003)(6512007)(2906002)(26005)(36756003)(52116002)(41300700001)(66476007)(66556008)(66946007)(8676002)(4326008)(5660300002)(7416002)(83380400001)(921005)(1076003)(316002)(8936002)(38350700002)(38100700002)(2616005)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cb/jqMKrevFSKhDf6sLL3E5E7DKHdb9eDZ6C1BE78sc9ZYaNjzBLplf/4LAZevXkY8u9hAb6dizJJH4YbYeYndpjzz1F/X2EfZlNWA90u2tIj49Txi3IWUE1VX+wstBLnoYkM3moLpo8hLJ/ue0M2q3VC6TJS9CljwXHuRRd0ye/B2gA/z7SrWcpDPralf0mB1mAEU27wGd26NFkQTPeS7u3e67aK7NJrNFvibynQ+6NscS3ooHHRbKHj4w8Yxm38C95QiwLvEHWL2cuuoxqhtTK15LAHrEKXQGYIwizoM3iolHsn64T93mpmfI9GmpWTKWoX1Y1I8tMlbHSdG2UKuiX3H4HWqj6gmk80GWDZltcFSkJRy6EMJIAXhb/hVVo+i/ZZdgLh24hfFoux5/Q0vV+PyHKoAdwqGlGXxMRo49o/dBZdbW2UETFNiYzlowcE2TuJWjvhDSVYCp8Z/SQwWDVk+eXhIws3/NIT7oE3kr/oDSQTN6a4Nz2ERkz4JPJeyht6VqcE+NtzIoCZ/kcHIi+1lN+rT95b0cOnRfbfqfkXtsE/uxHQB5UUWvoIkxeLWcFDEsBaHel1dNs2YO9nPIgr69NT7DymAl1nVpBJgOEoackMTMlM3QDdOi3jopSqMFjtBZI4C7gykNuEGQ9i9DsvmJddN8cMXFs1HYA2ud0ydZoL0rjksanFw0GMgr0Z1CA5xUhfC9rwV7pwJVPjj0b7YdO4BWrzT7cHfEriawcoT6ztaqzZd6BlEzSNqXC6MJCIv4JhdvKgmpx8H5kmZRwLa1CD7dzNr9zDiEv4YhN5+MzDr0KeYt3f7tiJqtIHaO3873VyYY0PssPFeK9gIJHq8oV09IH74mEPWzkEr/UsduvJwVUlUCtgoYXYs4k6LDb7jehsk8z9hWsyodT6QoB7Jvd/ZeOf6y4FOM9PoggW8/Suw023lCBGEqXBiEI2N2+WXg0WxDzVymgQtI7mQFOQQ5zuBecbx1urVc8jkDdlai6E2WjEaO5sQmhlU7tLRmTvdNoCEgTIZZo2mGLcSnrOQwnJKWF5y3GHe5K1ipsjKjg/qKzNt5gS+2RMpyVecCPt8pCWaoHnP/OGeQxIa4JtAN4tQ7UmXKBnt7fA3f9SrnjVjXb+5RRU7rkWGsZy9HrrOX+MIoGukzh5dckAxom9pD+RTevyr/5ara6wRO/c5NEpTlU/qBJYY4TkwJ6vMc9QLBAA5wE/W7m4LYI9VwhNVr7yYtK5a67tPbDKYHYaNF8NvWivVkozcV6gtM4f/FrorPDJbvmuN8ECpNwW6ZfIIba3o3gsMlcFjwmkZE4W9BtztLzewpO6dmgigwduKAP5c7ZeoEawQ0U88knl/PlceJaZvzU8PXPp4IRUhww/8LFuvOx/IxTMqs1vkQb5XXE/LCHr+GY9qcManp0Xsho4Hgrajgz+faMMdj8Ptpi28+i18V2LKZHNBg3op9+FbCUL5bozribU+JFgXyy/bcZHEHgkN9M1qR+xSC2S5v3tk9/DGyRI5eKCC0SViglNGO/gKBXx82ebDBcI9ago2RRnQD3Lyzzybt+SaJ2DTTLHMKs/2CNAedUCtSMpRqF X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a95fdf1-618e-4dc2-0750-08dae329bc7a X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB2939.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 08:02:42.4436 (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: AQ19MTJ+keJQGMjcedrJT/8GOVa4mVi2s05Pn5AF2UQUgf8entqhxGw13hFNtBz4MVqM1SCtuLYhSRv58u0HUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8426 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org On some platforms, mac cannot work after resumed from the suspend with WoL enabled. We found the stmmac_hw_setup() when system resumes will called after the stmmac_mac_link_up(). So the correct values set in stmmac_mac_link_up() are overwritten by stmmac_core_init() in phylink_resume(). So call the new added function in phylink to resume phy fristly. Then can call the stmmac_hw_setup() before calling phy_resume(). Signed-off-by: Clark Wang Reviewed-by: Piotr Raczynski --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c6951c976f5d..d0bdc9b6dbe8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7532,16 +7532,9 @@ int stmmac_resume(struct device *dev) } rtnl_lock(); - if (device_may_wakeup(priv->device) && priv->plat->pmt) { - phylink_resume(priv->phylink); - } else { - phylink_resume(priv->phylink); - if (device_may_wakeup(priv->device)) - phylink_speed_up(priv->phylink); - } - rtnl_unlock(); - rtnl_lock(); + phylink_phy_resume(priv->phylink); + mutex_lock(&priv->lock); stmmac_reset_queues_param(priv); @@ -7559,6 +7552,11 @@ int stmmac_resume(struct device *dev) stmmac_enable_all_dma_irq(priv); mutex_unlock(&priv->lock); + + phylink_resume(priv->phylink); + if (device_may_wakeup(priv->device) && !priv->plat->pmt) + phylink_speed_up(priv->phylink); + rtnl_unlock(); netif_device_attach(ndev);