Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2261278rwb; Wed, 30 Nov 2022 04:39:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf70KJZUdRlb39AAOC2hi0ePSl1uhj1dgxkwFRCw2BnL+lewmd8XizCjJFp5Q1ryD9zQZMYq X-Received: by 2002:a17:903:2686:b0:189:8f60:54a9 with SMTP id jf6-20020a170903268600b001898f6054a9mr13387767plb.65.1669811951848; Wed, 30 Nov 2022 04:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669811951; cv=none; d=google.com; s=arc-20160816; b=Lo42+Hy4nsaahuYVzizKO6t9qPIHoY2nEkIZ/79y0uV/31LwJetsdMotB+bOxHfJBw y4m4YmUGqYXHo5q9qj3ydkidTCEdHrE9pTlHN02jpIRQ2X4HlB6YgQirtE+0P5faY5o4 xhQwom8Ii9SNaTA2KKhODXMsF7jwMwxveN7x1LfgRiWdpmLMsqqF4UYw9IOipRu7a3Ul WT3vGHSgPEe1AZGtb6dAXOdlXKMS1LOjPbadp7/wQd41zRx/MwyWZF5fC5G4LD+9CDRJ yBdFHbO/Y/gH3IlIvQJ75yiUc1VK8p11vjL7KG0p80Ebg/B9mUL28h2C6z87xD8H3fAi Abqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SeprZaUCrg6YMDUQVxQrpsNw17qVCxSs694K/ikvslE=; b=Mn4zZnTkDrj5Dq7vJb3KHwbU4LW6Cml4j5LHAosNj1Qiafewnrz/iz+DWLXIy90bMg WK5NLMRF92se8S233mwCZRS53gvaN9WhCICd27ySVfg9DPMwbAggIKHCNgI89JbB/bxj VgJvLh7X9XsDBkH4A5O+XuWu7z3Z4PhQR47xe4kT4DCa0OTycs0iGdokJjdRybenVbPG Row2263fecBphG30m5MbFZFOvOfQ4b2f7XxYHSlL5iJZ0TNdToaMmy4kt7800LgdqtB3 i9/gpxOPVJprST0dL+htiLjfMkagruBENn5znEQxEmjXgiHiXZK//Pnn3RjhgywxNz5L Fv1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=DnY+sP3E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x64-20020a638643000000b00477ba9ec461si1115481pgd.879.2022.11.30.04.39.00; Wed, 30 Nov 2022 04:39:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=DnY+sP3E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbiK3Lvi (ORCPT + 84 others); Wed, 30 Nov 2022 06:51:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234475AbiK3LvQ (ORCPT ); Wed, 30 Nov 2022 06:51:16 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EA597B4E9; Wed, 30 Nov 2022 03:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SeprZaUCrg6YMDUQVxQrpsNw17qVCxSs694K/ikvslE=; b=DnY+sP3ETdi6+M6MeNzJpuGBM6 3Q6mYmwux7sT7CkxU9xl+BfJZD/l/CWSP7TJ89V45p9uBVpPkx93KWoG0cc3IYXfqmRGy6/3sjbb2 78COo1ggeQOWJ9vPx3R3AMbUuwvnNPNDg8DA8Wn0cCOnN3ofoQnrNeLi2AjJnyFeBHVx8YX2IsuR+ 3P1WvrTUBxgG1MZWTnEC21nXmOBjnawcYVt7AfFcfeJ1MJ242SqdZYl8tm1PRWZQbayVKpSx/BaSs y2BgKvCaFE3O/hRa66dxpbjWwiBKoPLlN/07nYrBtiDMqM2mwRX64X7uXf/sM9qJS6/C7lpYN12V0 t/t3DfAA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35498) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p0Lc5-0001fp-7X; Wed, 30 Nov 2022 11:50:53 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1p0Lc2-0002TM-C2; Wed, 30 Nov 2022 11:50:50 +0000 Date: Wed, 30 Nov 2022 11:50:50 +0000 From: "Russell King (Oracle)" To: Clark Wang Cc: "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" , "netdev@vger.kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/2] net: phylink: add sync flag mac_ready to fix resume issue with WoL enabled Message-ID: References: <20221130111148.1064475-1-xiaoning.wang@nxp.com> <20221130111148.1064475-2-xiaoning.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 30, 2022 at 11:32:09AM +0000, Clark Wang wrote: > Hi Russell, > > > -----Original Message----- > > From: Russell King > > Sent: 2022年11月30日 19:24 > > To: Clark Wang > > Cc: 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; netdev@vger.kernel.org; > > linux-stm32@st-md-mailman.stormreply.com; > > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org > > Subject: Re: [PATCH 1/2] net: phylink: add sync flag mac_ready to fix resume > > issue with WoL enabled > > > > On Wed, Nov 30, 2022 at 07:11:47PM +0800, Clark Wang wrote: > > > 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(). stmmac_core_init() is called in function > > > stmmac_hw_setup(), > > > > ... and that is where the problem is. Don't call phylink_resume() before your > > hardware is ready to see a link-up event. > > Thank you very much for your reply! > > You are right. > > However, stmmac requires RXC to have a clock input when performing a reset(in stmmac_hw_setup()). On our board, RXC is provided by the phy. > > In WoL mode, this is not a problem, because the phy will not be down when suspend. RXC will keep output. But in normal suspend(without WoL), the phy will be down, which does not guarantee the output of the RXC of the phy. Therefore, the previous code will call phylink_resume() before stmmac_hw_setup(). I think we need phylink_phy_resume() which stmmac can use to resume the PHY without resuming phylink, assuming that will output the RXC. Which PHY driver(s) are used with stmmac? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!