From patchwork Mon Sep 11 15:28:16 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: 13379447 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 711CEEE7FF4 for ; Mon, 11 Sep 2023 15:31:16 +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:MIME-Version: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:In-Reply-To:References: List-Owner; bh=OY+1HabeoH+kdInmpZ3tu3lTAcSi6xDOqym5pnXUmCw=; b=VMsliNSz9Cdfuw nySqPqp7DTxG/bzDffIHbUxsZ1Ht1OT2ZI9G64LSv/ikI4E1wbQtkD2qLUzyhhIJ2R5MK8KwTp9nc FU901UiQk8jSe9DB+GTZZ5eZBZIrRvxNNycqYn8iUzshjjyPsdsSShhf7q8m9ZlBMz4xaeFaSuIoq nSGPAus/Kp45r2XG2FRfRr+gbwgFlE6G7DitEE5f78S8U81+7jjjqJkGX7CtUYgJbgg7bQq1EEmSu KVE2iTs9hYV0IyB4X3qgEADf+yulZExz+maOOjMlIeVqdxkS9aGfHx9aPR2gW7ycK+lKRUacBC0qC tyqqvhAQnkEAvfVmGUZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfisE-000u1T-1a; Mon, 11 Sep 2023 15:30:50 +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 1qfisB-000tB7-0E for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 15:30:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:Content-Type:MIME-Version: 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:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=L3aWAk1k0F3xbo0PvehavMWBi8SSBtH1rAKg3ce9DIM=; b=ty7Ypls+BHIWlRgl2wrP6P562d bKwZytfMDIWEq0e/K6fz5pSdCicwgf+cJmbBsSj/WJ1875CYuX3zbVDxuJJEtgtQiie413huwdi4I ignBXctM0Gofrr8PcOcPw7hIintSS/3Btb3q/PL1GrLSDUqIZOLLcMS2yAoSw4N2vTkuIslrJhI5v sN1adAX3lnSC1UOtWY4vqRv0350qh7E9zzoPKH3gLaYwiWWuqiMKMqFpDXe2vo3U+AgPtYeyn9OGz 9MwLNkCTS3CSaKj1GAS9Bgat9ACvjkeQJltC7ae7avK7b0fRnUBf3zb0OuX3riHKYLYu2NqX2w1Ip gEhfeuvQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:53518) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qfipq-0008BR-2W; Mon, 11 Sep 2023 16:28:22 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qfipk-0001m7-Vh; Mon, 11 Sep 2023 16:28:16 +0100 Date: Mon, 11 Sep 2023 16:28:16 +0100 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 0/6] net: stmmac: add and use library for setting clock Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_083047_107860_0BD9290F X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. 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 Hi, There is a common theme throughout several "bsps" in the stmmac driver which all code up the same thing: for 10M, 100M and 1G, select the appropriate 2.5MHz, 25MHz, or 125MHz clock. Rather than having every BSP implement the same thing but slightly differently, let's provide a single implementation which is passed the struct clk and the speed, and have that do the speed to clock rate decode. Note: only build tested. drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 37 ++++--------- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 27 +++------- .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 35 ++++--------- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 61 ++++++---------------- .../net/ethernet/stmicro/stmmac/dwmac-starfive.c | 29 +++------- .../net/ethernet/stmicro/stmmac/stmmac_plat_lib.c | 29 ++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_plat_lib.h | 8 +++ 8 files changed, 91 insertions(+), 137 deletions(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_plat_lib.c create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_plat_lib.h