From patchwork Mon Sep 11 15:29:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13379442 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 07F41EE57DF for ; Mon, 11 Sep 2023 15:30:02 +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:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e2BxfCpjmMeIX6hOuMFhusbAentObbpTaB9I4Qd/vzI=; b=U4LoMuHgoxSzWH jd2A6C0o4jeG7xehFv6h8hFCDgSk1gG4JD8qGCuNO2dLR+TD/baxeJ5JP/j2fdIjpCaBVavSMgtdR DzyTT/4aUS4+HS6/6GdX+TTLYC2sQ/75ODmruu/BENLq3Haj36i+Qps1cxr+oPkIDqdzf7cVU/kYp amZ4h6aBSzLC7TIynHz5F9SjCiNTBBtdC2rufnuBHsWARAD7KxvhWeUeArFQPfEljbBw+b7r8tmsS lki3Q3Qq4BteSr8p5aMrgz6iYZENiXzaaZTrqvb3nZ2mJAZG+Xy4wtrOxnhq1HuZRUOoxSEfVtYtw RO/fyAxTuDeCDi2Su+2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfir9-000tUI-1I; Mon, 11 Sep 2023 15:29:43 +0000 Received: from [2001:4d48:ad52:32c8:5054:ff:fe00:142] (helo=pandora.armlinux.org.uk) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfir6-000tRk-02 for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 15:29:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To: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=xxAFmOFPowfCTWnGhmAR1kdsvUwVwDMZvbxX5Uff/dU=; b=swjus+QVqUNsxtG/Im9quGFkm/ GTxFnWWnojOzz0C+F3mczCeJG9TnQ93EJs1W3sbF4LfUPZso44qoyJy/dFMSUVbSGFfEFBSRQj/l7 uK229TSsg9j7GJ2KblqeX2RTjBEIFLxqbf6sgOHUMDtGtyylTupMq7QmbLOnhzGlnqKqqySgZs4GC stvKK9CaPllVsT3ZTBsjE4I2BXsk27+x21dWOm1jahA80Bftb9zw1MaXiRO1SJiIBNBTszgpuWhpb 22XofLui+pVqBNVWiubDwA/SsUs0m1w4DRSiLj2eyiyFY2vmn46TDZj1nvha6ZInA6djXLpqmBAzn FpKvL7+w==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:58048 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qfiqq-0008EQ-2d; Mon, 11 Sep 2023 16:29:24 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qfiqn-007TPY-Gn; Mon, 11 Sep 2023 16:29:21 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Alexandre Torgue , Jose Abreu Cc: Alexei Starovoitov , bpf@vger.kernel.org, Daniel Borkmann , "David S. Miller" , Emil Renner Berthing , Eric Dumazet , Fabio Estevam , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Maxime Coquelin , netdev@vger.kernel.org, NXP Linux Team , Paolo Abeni , Pengutronix Kernel Team , Samin Guo , Sascha Hauer , Shawn Guo Subject: [PATCH net-next 3/6] net: stmmac: intel-plat: use dwmac_set_tx_clk_gmii() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Mon, 11 Sep 2023 16:29:21 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_082940_057944_9FCFA26D X-CRM114-Status: GOOD ( 11.65 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Signed-off-by: Russell King (Oracle) --- .../stmicro/stmmac/dwmac-intel-plat.c | 35 +++++-------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index d352a14f9d48..8cc22f11072e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -14,6 +14,7 @@ #include "dwmac4.h" #include "stmmac.h" #include "stmmac_platform.h" +#include "stmmac_plat_lib.h" struct intel_dwmac { struct device *dev; @@ -31,32 +32,14 @@ struct intel_dwmac_data { static void kmb_eth_fix_mac_speed(void *priv, unsigned int speed, unsigned int mode) { struct intel_dwmac *dwmac = priv; - unsigned long rate; - int ret; - - rate = clk_get_rate(dwmac->tx_clk); - - switch (speed) { - case SPEED_1000: - rate = 125000000; - break; - - case SPEED_100: - rate = 25000000; - break; - - case SPEED_10: - rate = 2500000; - break; - - default: - dev_err(dwmac->dev, "Invalid speed\n"); - break; - } - - ret = clk_set_rate(dwmac->tx_clk, rate); - if (ret) - dev_err(dwmac->dev, "Failed to configure tx clock rate\n"); + int err; + + err = dwmac_set_tx_clk_gmii(dwmac->tx_clk, speed); + if (err == -ENOTSUPP) + dev_err(dwmac->dev, "invalid speed %dMbps\n", speed); + else if (err) + dev_err(dwmac->dev, "failed to set tx rate for speed %dMbps: %pe\n", + speed, ERR_PTR(err)); } static const struct intel_dwmac_data kmb_data = {