From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE7E118024 for ; Wed, 26 Feb 2025 12:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740573639; cv=none; b=S7hJ9k6+fPCMFZAFgCB5CudxrRzjxQLOizfXUXaosNgBZg8jtiwhv9uz9AT9J+lepvnWelIfkL83HJJ0pq9qmqAdDQJ9F0UasUZv3tC44qla7V7KMaY+YskePj7d30fm3KwhIYwSDHq8YmySAPxcMs6B0PITS7oR+AYMw+dpvdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740573639; c=relaxed/simple; bh=4l7oxSeeX+iwjdikDsl221mshHqE7XJYGKYFrPjhu+I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Q3hQ9Yh0qyjIYXsl343S+ZZiTipauc5SAi32zLSS9GzRUVCvyKMRUGIrINaZVRjcldQCzNyB7mnrFImA+Mqwj5J98UGcKyYQ0l/s4QNMVHVs02k0e+PzDO+YhuksCfXQBcPbmGWrZjYoh0Pyzgad81KUUBW+tHHhiXzpugklCp8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=qeMkGQ3y; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="qeMkGQ3y" 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-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding: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=jY/bwN9A5xa9iSopLwyTQOxIV4QgdsLsdC4BTyAYt0s=; b=qeMkGQ3y0EikusQ5iHd4bfTahQ VIXzKqFJ8IuD3zi7Bds5zQxg6xqFWF1UTAxmGM5ZFoaZpFhfGgwlOywV9EthV0Aw1BXHUkvLrNKAV rmcVXqxqtO4SQUrZ2YNITE4q9QJqb2A+zRm77pMqU3169CUNZCcoFYmCGRod2yFDfu8ydaJ+NHk6a jQVGp+KrPPtvH8pDfAlr5i1MHou26K+PWMKnf+fbN40ZHh1D6KN9GJhwEUQ0jmwijbhhKS9UAj/h4 +kZw30OqsrDFWVsqH1MK6fFHR/ZAS5ERJK8l/v+NOP86YirCEDQ51wEXwnGxoIjp/dfaT3PbslIWO IdQ4fMHQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:32848) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tnGi8-0004Ez-2J; Wed, 26 Feb 2025 12:40:24 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.96) (envelope-from ) id 1tnGi5-000766-0H; Wed, 26 Feb 2025 12:40:21 +0000 Date: Wed, 26 Feb 2025 12:40:20 +0000 From: "Russell King (Oracle)" To: Thierry Reding Cc: Andrew Lunn , Heiner Kallweit , Alexandre Torgue , Andrew Lunn , "David S. Miller" , Emil Renner Berthing , Eric Dumazet , Fabio Estevam , imx@lists.linux.dev, Inochi Amaoto , Jakub Kicinski , Jan Petrous , Jon Hunter , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , Minda Chen , netdev@vger.kernel.org, NXP S32 Linux Team , Paolo Abeni , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Thierry Reding Subject: Re: [PATCH RFC net-next 6/7] net: stmmac: intel: use generic stmmac_set_clk_tx_rate() Message-ID: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) On Tue, Feb 25, 2025 at 09:46:56PM +0100, Thierry Reding wrote: > On Tue, Feb 18, 2025 at 11:15:05AM +0000, Russell King (Oracle) wrote: > > Use the generic stmmac_set_clk_tx_rate() to configure the MAC transmit > > clock. > > > > Signed-off-by: Russell King (Oracle) > > --- > > .../stmicro/stmmac/dwmac-intel-plat.c | 24 +++---------------- > > 1 file changed, 3 insertions(+), 21 deletions(-) > > This isn't quite the same code, but the result should be the same since > clk_set_rate() will be ignored if the clock is NULL, which would be the > case for !dwmac->data->tx_clk_en. You're right, thanks for spotting! I'll move it out of the if() statement so the code has the exact same behaviour. Replacement patch below. > Reviewed-by: Thierry Reding Thanks for the review. 8<==== From: "Russell King (Oracle)" Subject: [PATCH net-next] net: stmmac: intel: use generic stmmac_set_clk_tx_rate() Use the generic stmmac_set_clk_tx_rate() to configure the MAC transmit clock. Note that given the current unpatched driver structure, plat_dat->fix_mac_speed will always be populated with kmb_eth_fix_mac_speed(), even when no clock is present. We preserve this behaviour in this patch by always initialising plat_dat->clk_tx_i and plat_dat->set_clk_tx_rate. Signed-off-by: Russell King (Oracle) --- .../stmicro/stmmac/dwmac-intel-plat.c | 24 +++---------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index 0591756a2100..599def7b3a64 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -22,31 +22,12 @@ struct intel_dwmac { }; struct intel_dwmac_data { - void (*fix_mac_speed)(void *priv, int speed, unsigned int mode); unsigned long ptp_ref_clk_rate; unsigned long tx_clk_rate; bool tx_clk_en; }; -static void kmb_eth_fix_mac_speed(void *priv, int speed, unsigned int mode) -{ - struct intel_dwmac *dwmac = priv; - long rate; - int ret; - - rate = rgmii_clock(speed); - if (rate < 0) { - dev_err(dwmac->dev, "Invalid speed\n"); - return; - } - - ret = clk_set_rate(dwmac->tx_clk, rate); - if (ret) - dev_err(dwmac->dev, "Failed to configure tx clock rate\n"); -} - static const struct intel_dwmac_data kmb_data = { - .fix_mac_speed = kmb_eth_fix_mac_speed, .ptp_ref_clk_rate = 200000000, .tx_clk_rate = 125000000, .tx_clk_en = true, @@ -89,8 +70,6 @@ static int intel_eth_plat_probe(struct platform_device *pdev) * platform_match(). */ dwmac->data = device_get_match_data(&pdev->dev); - if (dwmac->data->fix_mac_speed) - plat_dat->fix_mac_speed = dwmac->data->fix_mac_speed; /* Enable TX clock */ if (dwmac->data->tx_clk_en) { @@ -132,6 +111,9 @@ static int intel_eth_plat_probe(struct platform_device *pdev) } } + plat_dat->clk_tx_i = dwmac->tx_clk; + plat_dat->set_clk_tx_rate = stmmac_set_clk_tx_rate; + plat_dat->bsp_priv = dwmac; plat_dat->eee_usecs_rate = plat_dat->clk_ptp_rate; -- 2.30.2 -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!