From patchwork Thu Sep 14 13:50:23 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: 13385461 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 6236524209; Thu, 14 Sep 2023 13:50:40 +0000 (UTC) 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 6924A10C7; Thu, 14 Sep 2023 06:50:40 -0700 (PDT) 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=RPqNFZg2BovBFcxN8fL9WiXVlKTruIYUJDcYs8EBwH8=; b=pyQ/acaFg1vj/25frlNPsNNWxH MH7Gq1UHz16ehdwMtql7TzZ0BhwXVUdntVztYotbpqn9+tOhvBu9Xp+uZBaNUmIhnNuvsVbG594C9 MKBAtEvPiDPXlrQle/x30NCif0jor4iW2BrxBQInHmby8aNx/tXWShdJVeuKordTPfPcbLsEJuIVP dpBzTJr9TbKr+s+EAc2Dc/l9OqRvyIfrjQVaVuAqhOEEzsXl+a9t7TdhMErwVQp2RFxtpVgnEHQ4R AHqRu5oh5lBJBuJtOnU/EZwdxHeNCD2Uv/XwJFsqhCwH4pcUhKpRpWl5+yF1kDGfI2bulfjhb3Xap UqIIrm9A==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:56204) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1qgmjk-0004F7-2B; Thu, 14 Sep 2023 14:50:28 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1qgmjf-0004oZ-BT; Thu, 14 Sep 2023 14:50:23 +0100 Date: Thu, 14 Sep 2023 14:50:23 +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 v2 0/6] net: stmmac: add and use library for setting clock Message-ID: Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Sender: Russell King (Oracle) X-Patchwork-Delegate: kuba@kernel.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. v2: - move dwmac_set_tx_clk_gmii() to stmmac_platform, and rename to have stmmac_ prefix. - add comment body to conversion patches - use %u for printing speed .../ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 36 ++++--------- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 26 +++------- .../net/ethernet/stmicro/stmmac/dwmac-intel-plat.c | 34 +++--------- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 60 ++++++---------------- .../net/ethernet/stmicro/stmmac/dwmac-starfive.c | 28 +++------- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 25 +++++++++ .../net/ethernet/stmicro/stmmac/stmmac_platform.h | 1 + 7 files changed, 74 insertions(+), 136 deletions(-)