From mboxrd@z Thu Jan 1 00:00:00 1970 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 884ADC636CD for ; Fri, 10 Feb 2023 11:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232163AbjBJLEL (ORCPT ); Fri, 10 Feb 2023 06:04:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231429AbjBJLEK (ORCPT ); Fri, 10 Feb 2023 06:04:10 -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 F196D71647; Fri, 10 Feb 2023 03:04:07 -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=OiSEzv9rtDSTvo2Zi5fGTIDoz35QzbSPZrOm1laNUMM=; b=q31jFGPkY6EPYOhhEOFeBuqgBW 9DYtv8WXHGxMdfHJ/89KrDHm9dh9XGlQwu2RZR+kcob86Cka/SdhvlV23IZiQJwxArdcvGBNIn9bA 6YQ0s3K1bsHI04vVpdhl0vpALG0d4hNE5lhaNc+U6ZRbwUC3PEhLGhqyWY+XFq3SA8T7C++E8jiK4 vzufbQ1BC3MoOt4TSNpJ+IeGTpno75pw8TBo5MF0EBC6lzKQILQCGUBT6dnNA3RRk0bIlrajPTdKG 3VxSbk4OXtnWvxaFZvyhf5wayWduKUrImf8HixkA/QfMx6UX3UH08sIMjHSy2OECuJqcz0ZL9xt8X BH16j7Xw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:36512) 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 1pQRBu-0001MT-Sf; Fri, 10 Feb 2023 11:03:42 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pQRBm-0005WD-Us; Fri, 10 Feb 2023 11:03:34 +0000 Date: Fri, 10 Feb 2023 11:03:34 +0000 From: "Russell King (Oracle)" To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , Clark Wang Cc: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Wong Vee Khee , Kurt Kanzenbach , Revanth Kumar Uppala , Tan Tee Min , Thomas Petazzoni , Herve Codina , =?iso-8859-1?Q?Miqu=E8l?= Raynal , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Mohammad Athari Bin Ismail , Jon Hunter , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH net-next 3/6] net: stmmac: start phylink before setting up hardware Message-ID: References: <20230116103926.276869-1-clement.leger@bootlin.com> <20230116103926.276869-4-clement.leger@bootlin.com> <20230207154135.6f0e59f8@fixe.home> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230207154135.6f0e59f8@fixe.home> Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On Tue, Feb 07, 2023 at 03:41:35PM +0100, Clément Léger wrote: > Le Mon, 16 Jan 2023 10:53:49 +0000, > "Russell King (Oracle)" a écrit : > > > On Mon, Jan 16, 2023 at 11:39:23AM +0100, Clément Léger wrote: > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > index f2247b8cf0a3..88c941003855 100644 > > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > @@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev, > > > } > > > } > > > > > > + /* We need to setup the phy & PCS before accessing the stmmac registers > > > + * because in some cases (RZ/N1), if the stmmac IP is not clocked by the > > > + * PCS, hardware init will fail because it lacks a RGMII RX clock. > > > + */ > > > + phylink_start(priv->phylink); > > > > So what happens if you end up with the mac_link_up method being called > > at this point in the driver, before the hardware has been setup ? > > > > If you use a fixed-link, that's a real possibility. > > I actually have this setup. On the board, one GMAC is connected to a > DSA switch using a fixed-link and the other using the PCS such as added > by this series. > > From what I see, indeed, the mac_link_up() function is called before > stmmac_hw_setup(). This does not seems to have any effect on my setup > (except making it working of course) but I agree this is clearly not > ideal. > > What I could do is adding a function in the miic pcs driver that could > be called from my rzn1 stmmac probe function to actually configure the > PCS at probe time based on the detected "phy-mode". Does that seems > better to you ? I think Clark Wang is also working on addressing a very similar problem with stmmac. Please can you check out his work first, he's adding a new function to phylink to bring the PHY up early in the resume path. I would like you both to work together to address what seems to be the same issue. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! From mboxrd@z Thu Jan 1 00:00:00 1970 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 B7444C05027 for ; Fri, 10 Feb 2023 11:05:18 +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:In-Reply-To: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-Owner; bh=Z8KXjf3ONvDZWBxxH76zFXfq4qd3pfhzpTOf5STJF2I=; b=TgDAErjUrTiEEl r5qJU2baV3nNNEshvjte4AsFAo3ef0dVFVJaxf2DmtOVbGiFupGqwWcJX3S28T1Xf+r4RgkHDCHnx tzAxy3lcV/HxXpTGzzt0q2woYgIG8AKNzInP9RIFVAch3VHr5DJUZX3jGeaVrqH3j0Z8XWZkcK006 TqhYUTy3qQDnXpnjFPTt2sTt2NrwLZ7P2bArRRY+Y0/rtSaWlj0YEXpw7fsqZNYb23LoBVPPL5xco HMx1qOHgg//mQT01JbjuTE6TD7p5feH7cEkpESYvHmlrXiKF3kjMGVU9FBrX+nmoUbw5IsEumE79a U+N51C7lolyN4Zzyrbiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQRCQ-005PGm-MX; Fri, 10 Feb 2023 11:04:14 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQRCM-005PEL-2x for linux-arm-kernel@lists.infradead.org; Fri, 10 Feb 2023 11:04:12 +0000 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=OiSEzv9rtDSTvo2Zi5fGTIDoz35QzbSPZrOm1laNUMM=; b=q31jFGPkY6EPYOhhEOFeBuqgBW 9DYtv8WXHGxMdfHJ/89KrDHm9dh9XGlQwu2RZR+kcob86Cka/SdhvlV23IZiQJwxArdcvGBNIn9bA 6YQ0s3K1bsHI04vVpdhl0vpALG0d4hNE5lhaNc+U6ZRbwUC3PEhLGhqyWY+XFq3SA8T7C++E8jiK4 vzufbQ1BC3MoOt4TSNpJ+IeGTpno75pw8TBo5MF0EBC6lzKQILQCGUBT6dnNA3RRk0bIlrajPTdKG 3VxSbk4OXtnWvxaFZvyhf5wayWduKUrImf8HixkA/QfMx6UX3UH08sIMjHSy2OECuJqcz0ZL9xt8X BH16j7Xw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:36512) 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 1pQRBu-0001MT-Sf; Fri, 10 Feb 2023 11:03:42 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pQRBm-0005WD-Us; Fri, 10 Feb 2023 11:03:34 +0000 Date: Fri, 10 Feb 2023 11:03:34 +0000 From: "Russell King (Oracle)" To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , Clark Wang Cc: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Wong Vee Khee , Kurt Kanzenbach , Revanth Kumar Uppala , Tan Tee Min , Thomas Petazzoni , Herve Codina , =?iso-8859-1?Q?Miqu=E8l?= Raynal , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Mohammad Athari Bin Ismail , Jon Hunter , netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH net-next 3/6] net: stmmac: start phylink before setting up hardware Message-ID: References: <20230116103926.276869-1-clement.leger@bootlin.com> <20230116103926.276869-4-clement.leger@bootlin.com> <20230207154135.6f0e59f8@fixe.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230207154135.6f0e59f8@fixe.home> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230210_030410_154369_FBE68991 X-CRM114-Status: GOOD ( 29.27 ) 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: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 07, 2023 at 03:41:35PM +0100, Cl=E9ment L=E9ger wrote: > Le Mon, 16 Jan 2023 10:53:49 +0000, > "Russell King (Oracle)" a =E9crit : > = > > On Mon, Jan 16, 2023 at 11:39:23AM +0100, Cl=E9ment L=E9ger wrote: > > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/driv= ers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > index f2247b8cf0a3..88c941003855 100644 > > > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > > > @@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *de= v, > > > } > > > } > > > = > > > + /* We need to setup the phy & PCS before accessing the stmmac regis= ters > > > + * because in some cases (RZ/N1), if the stmmac IP is not clocked b= y the > > > + * PCS, hardware init will fail because it lacks a RGMII RX clock. > > > + */ > > > + phylink_start(priv->phylink); = > > = > > So what happens if you end up with the mac_link_up method being called > > at this point in the driver, before the hardware has been setup ? > > = > > If you use a fixed-link, that's a real possibility. > = > I actually have this setup. On the board, one GMAC is connected to a > DSA switch using a fixed-link and the other using the PCS such as added > by this series. > = > From what I see, indeed, the mac_link_up() function is called before > stmmac_hw_setup(). This does not seems to have any effect on my setup > (except making it working of course) but I agree this is clearly not > ideal. > = > What I could do is adding a function in the miic pcs driver that could > be called from my rzn1 stmmac probe function to actually configure the > PCS at probe time based on the detected "phy-mode". Does that seems > better to you ? I think Clark Wang is also working on addressing a very similar problem with stmmac. Please can you check out his work first, he's adding a new function to phylink to bring the PHY up early in the resume path. I would like you both to work together to address what seems to be the same issue. -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel