From patchwork Fri Feb 2 09:19:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTCB2aWEgQjQgUmVsYXk=?= X-Patchwork-Id: 13542468 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 8BA34C48292 for ; Fri, 2 Feb 2024 09:20: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:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To: References:Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version: Subject:Date:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rxPO1urfQ1lTy8wlMyF4OZGNqrAy8jtSReGUipES3gM=; b=47Ei2aIctRYvyvQUkWL5yeyCNx xT9WWGJA401yJhk+DgE2ECG5gMBvF2A9BXvzqdCCnRDVNHcW7ZutWYT4PUprjv8nUEa3q+6Z+Hh/N yhliCwkVoJx163TgRhrS3xBwzzyTUvEVIyHQQiw4fIVBi2qTj/YakGgprHzpmu6UpCPs2h8gWaHR4 cndwfmMxAW+8jqq0uwl/eQTbRifl5yPEQ+WIpWAK/rVtP+/11WRR2ICRwHKq/6ah/4oFB77v9BlYQ CLbryXh03Gpx12hgJ/d1f+nF87vBMMLyFG40C6+rbhyRzWqhllMKTUiT5k57oZd9MPH6OnC6qA7gV HmLDzjVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVpiL-0000000Auqo-3XN9; Fri, 02 Feb 2024 09:20:01 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVphv-0000000AuWc-3ssr; Fri, 02 Feb 2024 09:19:39 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E064ACE2A8D; Fri, 2 Feb 2024 09:19:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id E0CA2C433B2; Fri, 2 Feb 2024 09:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706865572; bh=Mbj/3lKU288Yv0v6r0IvbWbLwZTL+8ODP93iUqv62yk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qH6LbbQ1hx6SwdrsqjDFXPolLI9239TgPcuXgHodD0a7S4adaDRCBod+EZqjkCWss YOK59HOkvBJkKX2xmSGquNDi/lurWIv61IR8uUF6MH2Ar4oWKUrMiV+o5iG2CIBMtu dlq25ms16I8ygZHNcekxe9V9D/EhOyeNDXIZwzklanV5cm3syCGSIkTQTU7/r4KjT7 xfa8N8wI2+5r1SiPQsgkjshTYndkMvv8XzWECEN/koC8OCbJ15JZOsmwduGcSbK7IG 2Pd8rJr5U8N8Vu23E5ufKPcKzpZxrg+hDDrlDMUtTjgSsfvDB+AYsE507z94swCG7n xlVexIw4HbowA== 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 C5B7EC48292; Fri, 2 Feb 2024 09:19:32 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Fri, 02 Feb 2024 12:19:10 +0300 Subject: [PATCH net-next v3 4/7] net: dsa: mt7530: move XTAL check to mt7530_setup() MIME-Version: 1.0 Message-Id: <20240202-for-netnext-mt7530-improvements-2-v3-4-63d5adae99ca@arinc9.com> References: <20240202-for-netnext-mt7530-improvements-2-v3-0-63d5adae99ca@arinc9.com> In-Reply-To: <20240202-for-netnext-mt7530-improvements-2-v3-0-63d5adae99ca@arinc9.com> To: Daniel Golle , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Cc: mithat.guner@xeront.com, erkin.bozoglu@xeront.com, Bartel Eerdekens , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706865569; l=1500; i=arinc.unal@arinc9.com; s=arinc9-patatt; h=from:subject:message-id; bh=tzbZi99DdeWCfP5IhTMb0r535zllNsHp9+oBk2Ev3sU=; b=brIWlBShcSKoFoPX9dBBoYEN0jSVs7sXUjO+lJf5MtIOqozJn6V4XrOrZADDkN4YWOXkBPo4b N+oy7MharIHC3aVF2ir7ueafoDRXalrOj05Qh8hUNVl2NOV0LoOHHNP X-Developer-Key: i=arinc.unal@arinc9.com; a=ed25519; pk=VmvgMWwm73yVIrlyJYvGtnXkQJy9CvbaeEqPQO9Z4kA= X-Endpoint-Received: by B4 Relay for arinc.unal@arinc9.com/arinc9-patatt with auth_id=115 X-Original-From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_011936_456509_244A6247 X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arinc.unal@arinc9.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL The crystal frequency concerns the switch core. The frequency should be checked when the switch is being set up so the driver can reject the unsupported hardware earlier and without requiring port 6 to be used. Move it to mt7530_setup(). Drop the unnecessary function printing. Signed-off-by: Arınç ÜNAL Reviewed-by: Andrew Lunn Reviewed-by: Vladimir Oltean --- drivers/net/dsa/mt7530.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index fdaf65b58b72..c4d492e29fdf 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -422,13 +422,6 @@ mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) xtal = mt7530_read(priv, MT7530_MHWTRAP) & HWTRAP_XTAL_MASK; - if (xtal == HWTRAP_XTAL_20MHZ) { - dev_err(priv->dev, - "%s: MT7530 with a 20MHz XTAL is not supported!\n", - __func__); - return -EINVAL; - } - switch (interface) { case PHY_INTERFACE_MODE_RGMII: trgint = 0; @@ -2253,6 +2246,12 @@ mt7530_setup(struct dsa_switch *ds) return -ENODEV; } + if ((val & HWTRAP_XTAL_MASK) == HWTRAP_XTAL_20MHZ) { + dev_err(priv->dev, + "MT7530 with a 20MHz XTAL is not supported!\n"); + return -EINVAL; + } + /* Reset the switch through internal reset */ mt7530_write(priv, MT7530_SYS_CTRL, SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST |