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: 13385469 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 11C45EEAA40 for ; Thu, 14 Sep 2023 13:51:19 +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=w/3dirLepp2NnchIeUiwRVCg7MYhwlBRz/YpRyp4Ubw=; b=gJKToXPx4Howfp vviN08aX8sLNFx4staBdMWcLDQCk99pi4hhIuPQ4GAo9FJT5QQEgjilzkKu+GjijrHRQNGpLPchJS i+pBnF7wHoxt/rxsOcJMKniG1MvOuz3KsBF7Z8191/YbejnknWvvp2Q1zuWJG+X3RvsHNGQ04Y5FY BtLyLsVQtr4yadqAhBxIYDcJHzw7PAHkYC+LEwtVFMA8F7cRlrSwX9RDaiTQcGS5riMhvjzn0cT5I Yh+bsx7uLKe4bBoIOTQz0aK0b18+tiWXqu0f3NCDq+xm34VFAtxeL0g7N4SeqkZSljvOsI6tScyFh wHnZXXRxsH3dYbz9dslw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgmk7-008Y5q-19; Thu, 14 Sep 2023 13:50:51 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgmk4-008Y4a-2K for linux-arm-kernel@lists.infradead.org; Thu, 14 Sep 2023 13:50:50 +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=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: MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230914_065048_758234_3AE1427A X-CRM114-Status: UNSURE ( 9.49 ) 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. 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(-)