From patchwork Mon Oct 28 20:24:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Petrous via B4 Relay X-Patchwork-Id: 13854064 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C1A8D1E1337; Mon, 28 Oct 2024 20:25:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730147128; cv=none; b=HpiaPgJKsTty6zXl0JUDpBB9f5d+7vzK+kCDOtcdVJImCMvwYqHE34AZinfi4TX+HagYY4EARV7bHuiNyYtiVd4U4kd0tSycoLb0zmzd6jd/DOTaI5brO/Jz1v+J1OHu7+HYdjZ4vBg86oRS3gsC4CZpUpWKUtVOuzkiv7frWL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730147128; c=relaxed/simple; bh=7vtG9pA+K21LkqN2C0YcqauzDbOJlo+/wO1OQf2lUPc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N/6eTefVp1urxXHQEvIvBL9LflO7+BVo02DPrB8bnNA0KQT9qIGsY9Z0GOJ48iI02Ih+gYxE/AbZR0e5DTlpopDjg1Z7eXxEO48CUHIGcep+wdw2En16B2npOr4SZk+0keBqK60sBqk2eyWxsgMW0cIZtn4A2gga+YFeUJDfBwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VAShQeK6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VAShQeK6" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3E3DAC4CEC3; Mon, 28 Oct 2024 20:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730147128; bh=7vtG9pA+K21LkqN2C0YcqauzDbOJlo+/wO1OQf2lUPc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=VAShQeK6wELG+LJTexWCcsL1TQneZROGgzrIfSr6UuCISpLN1Eb8yxuGUFRN/JYtq kZheZ3xfL+7Xwt7nVqewMy++GvEQjYwDDarkx1W82vDnNyWj7tWh0P2wTBPGaO3iOL FIbu/Raoeou0teu2UfGfu+YqlkFFfVw/33MFSAv6Gm1L+YRQ+0gqJqKzDrVPNXmIME zQm3S07HZs2A9jYiGuKeqdC+lvMsgiIQv7Z/dc5OODvdJefzvgVXCk04KZmJbkxVw+ 2jhQSZnSlNobEpasVNYEEBmWv4VOLSoAx/Q3L2Uen20MHwvtNKho1+k9o5CBscgJoX t68KVVLzLFMnA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31F18D5B149; Mon, 28 Oct 2024 20:25:28 +0000 (UTC) From: Jan Petrous via B4 Relay Date: Mon, 28 Oct 2024 21:24:52 +0100 Subject: [PATCH v4 10/16] net: macb: Use helper rgmii_clock Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241028-upstream_s32cc_gmac-v4-10-03618f10e3e2@oss.nxp.com> References: <20241028-upstream_s32cc_gmac-v4-0-03618f10e3e2@oss.nxp.com> In-Reply-To: <20241028-upstream_s32cc_gmac-v4-0-03618f10e3e2@oss.nxp.com> To: Maxime Coquelin , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Vinod Koul , Richard Cochran , Andrew Lunn , Heiner Kallweit , Russell King , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Emil Renner Berthing , Minda Chen , Nicolas Ferre , Claudiu Beznea , Iyappan Subramanian , Keyur Chudgar , Quan Nguyen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro Cc: linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, NXP S32 Linux Team , "Jan Petrous (OSS)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730147124; l=953; i=jan.petrous@oss.nxp.com; s=20240922; h=from:subject:message-id; bh=cfFMV/oCv4h7wawq2S7/Nrlkv2gYpjiAbwErMMsRoC4=; b=QptE/ox0BP0PKywOxOQUJNHbaFkGlOwtL4gzNasllt2FkNCPLgOJtcm5hBk4sA9qKjsbrB7vG bmOOEU267emC22EuhsV56s5yzJKkM5Wj1cWcYefAtGxrAPjEGgUEKeV X-Developer-Key: i=jan.petrous@oss.nxp.com; a=ed25519; pk=Ke3wwK7rb2Me9UQRf6vR8AsfJZfhTyoDaxkUCqmSWYY= X-Endpoint-Received: by B4 Relay for jan.petrous@oss.nxp.com/20240922 with auth_id=217 X-Original-From: "Jan Petrous (OSS)" Reply-To: jan.petrous@oss.nxp.com From: "Jan Petrous (OSS)" Utilize a new helper function rgmii_clock(). Signed-off-by: Jan Petrous (OSS) Reviewed-by: Andrew Lunn --- drivers/net/ethernet/cadence/macb_main.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index f06babec04a0..f1e481264511 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -530,19 +530,9 @@ static void macb_set_tx_clk(struct macb *bp, int speed) if (bp->phy_interface == PHY_INTERFACE_MODE_MII) return; - switch (speed) { - case SPEED_10: - rate = 2500000; - break; - case SPEED_100: - rate = 25000000; - break; - case SPEED_1000: - rate = 125000000; - break; - default: + rate = rgmii_clock(speed); + if (rate < 0) return; - } rate_rounded = clk_round_rate(bp->tx_clk, rate); if (rate_rounded < 0)