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 C5EFBCA0FE7 for ; Mon, 25 Aug 2025 15:01:07 +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=sxi9UbEZs/aLfHJ2nrgHWV0k3ei0rAA+caNCt1igJ88=; b=KSPqyRPYHKIMpf N57Mlq1rdqlM9xzNF1qGdnTTfnzB1HNf4UZLEfHr3Pdpv0rHgaF8Dk02XzO8mNARdXaj6rKiKVXEW iIyTf27j/dakvI62zeom0JDHrohXEbtX26uLD6dM1kZn8OpynpfKlwjauoOE3tyqzjkntzHZaUmEd 4KuBYT894i7n9qi6SueU05eHlUZVZbySvMk88F2cp2Ua8pWTIPLf9cWq9rsmipUel15F7nFEX/hG7 9oDxgIw/KxoU1aVt4PL0sX6qPSBriW+KuTb1qXu4aLNF3NnqfwYi1AibiNLeYfQevbjprjmMQiYo5 jc8o4CToHzJgWx8Fbfeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uqYgq-00000008Npz-3U3H; Mon, 25 Aug 2025 15:00:56 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uqXOd-000000086Zb-1i6y; Mon, 25 Aug 2025 13:38:04 +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=PVgYUvPT1vPM01I1nr9R+3H7BRFArSAfjzLQN6iJKvQ=; b=SCimNEDupFMkyQhB1L09lOvN6L 2R2NcLUFXj3aX6q1C9zMzhUzbva/YBhfegk7MxjDN9oyQchc03Y+e3j+lu0irp5X2jaAcQNfcLzkw 57qcs0A5jOaIq5wT7QANf9CQw6k4yxggPLKlR2yYU9Hywo3l9qD2g0f/WNHW+WeGYkILoDqzSx59i 64jBpaJd1/A5X2fUoTAm8taxCXd+syedJ0xfiDBwokuWNqMVpiwgI0EQCCMmjCy8MeQ3DEWfab/9z P/l3yoCWe6alpUfHXrf9VaRE17B1xFYZ0brzJFjmu3wKvk3yrOAqMNfujbdN1WPD7tVxWtSF8RFUT iH3woFiQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:53562) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1uqXOF-000000006XF-25Id; Mon, 25 Aug 2025 14:37:39 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1uqXO9-0000000089m-0a0b; Mon, 25 Aug 2025 14:37:33 +0100 Date: Mon, 25 Aug 2025 14:37:32 +0100 From: "Russell King (Oracle)" To: Marek Szyprowski Cc: Chaoyi Chen , Chaoyi Chen , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Alexandre Torgue , Jonas Karlman , David Wu , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH net-next v3] net: ethernet: stmmac: dwmac-rk: Make the clk_phy could be used for external phy Message-ID: References: <20250815023515.114-1-kernel@airkyi.com> <809848c9-2ffa-4743-adda-b8b714b404de@samsung.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <809848c9-2ffa-4743-adda-b8b714b404de@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250825_063803_446555_F9AA29FE X-CRM114-Status: GOOD ( 26.30 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms 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-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Mon, Aug 25, 2025 at 12:53:37PM +0200, Marek Szyprowski wrote: > On 25.08.2025 11:57, Chaoyi Chen wrote: > > On 8/25/2025 3:23 PM, Marek Szyprowski wrote: > >> On 15.08.2025 04:35, Chaoyi Chen wrote: > >>> From: Chaoyi Chen > >>> > >>> For external phy, clk_phy should be optional, and some external phy > >>> need the clock input from clk_phy. This patch adds support for setting > >>> clk_phy for external phy. > >>> > >>> Signed-off-by: David Wu > >>> Signed-off-by: Chaoyi Chen > >>> --- > >>> > >>> Changes in v3: > >>> - Link to V2: = > >>> https://lore.kernel.org/netdev/20250812012127.197-1-kernel@airkyi.com/ > >>> - Rebase to net-next/main > >>> > >>> Changes in v2: > >>> - Link to V1: = > >>> https://lore.kernel.org/netdev/20250806011405.115-1-kernel@airkyi.com/ > >>> - Remove get clock frequency from DT prop > >>> > >>> =A0=A0 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 11 +++++++---- > >>> =A0=A0 1 file changed, 7 insertions(+), 4 deletions(-) > >>> > >>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c = > >>> b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > >>> index ac8288301994..5d921e62c2f5 100644 > >>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > >>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > >>> @@ -1412,12 +1412,15 @@ static int rk_gmac_clk_init(struct = > >>> plat_stmmacenet_data *plat) > >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 clk_set_rate(plat->stmmac_clk, 5000000= 0); > >>> =A0=A0=A0=A0=A0=A0 } > >>> =A0=A0 -=A0=A0=A0 if (plat->phy_node && bsp_priv->integrated_phy) { > >>> +=A0=A0=A0 if (plat->phy_node) { > >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 bsp_priv->clk_phy =3D of_clk_get(plat-= >phy_node, 0); > >>> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D PTR_ERR_OR_ZERO(bsp_priv->clk_= phy); > >>> -=A0=A0=A0=A0=A0=A0=A0 if (ret) > >>> -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return dev_err_probe(dev, ret, "Ca= nnot get PHY clock\n"); > >>> -=A0=A0=A0=A0=A0=A0=A0 clk_set_rate(bsp_priv->clk_phy, 50000000); > >>> +=A0=A0=A0=A0=A0=A0=A0 /* If it is not integrated_phy, clk_phy is opt= ional */ > >>> +=A0=A0=A0=A0=A0=A0=A0 if (bsp_priv->integrated_phy) { > >>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (ret) > >>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return dev_err_probe(d= ev, ret, "Cannot get PHY = > >>> clock\n"); > >>> +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 clk_set_rate(bsp_priv->clk_phy, 50= 000000); > >>> +=A0=A0=A0=A0=A0=A0=A0 } > > > > I think=A0 we should set bsp_priv->clk_phy to NULL here if we failed to = > > get the clock. > > > > Could you try this on your board? Thank you. > = > Right, the following change also fixes this issue: > = > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c = > b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > index 9fc41207cc45..2d19d48be01f 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c > @@ -1415,6 +1415,8 @@ static int rk_gmac_clk_init(struct = > plat_stmmacenet_data *plat) > =A0=A0=A0=A0=A0=A0=A0 if (plat->phy_node) { > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 bsp_priv->clk_phy =3D of_c= lk_get(plat->phy_node, 0); > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ret =3D PTR_ERR_OR_ZERO(bs= p_priv->clk_phy); > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (ret) > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 bsp_p= riv->clk_phy =3D NULL; Or just: clk =3D of_clk_get(plat->phy_node, 0); if (clk =3D=3D ERR_PTR(-EPROBE_DEFER)) ... else if (!IS_ERR) bsp_priv->clk_phy =3D clk; I don't have a free terminal to work out what "..." should be. -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip