Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1961945rdb; Sun, 4 Feb 2024 08:35:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9xIVz0Y0Ei/jyDY3to4wcaO8xQnGkxg7yglE7K43iRay0YxJmmnqHYkWP2Y5LpwdMOl0B X-Received: by 2002:a05:6a20:da88:b0:19c:912f:1cfb with SMTP id iy8-20020a056a20da8800b0019c912f1cfbmr14637603pzb.12.1707064535814; Sun, 04 Feb 2024 08:35:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707064535; cv=pass; d=google.com; s=arc-20160816; b=pJMak3xcRwT2OuDjOf/26YCIY0J85GEg9ccX9Xe72AOCPg84VezJ9HR8uDLIJDVjMj aQ//WRMjc4SiLFq6/zHXXj9qq1vfOGZegAerGJdHlQ505z3lbP+4IIz7+mDysXRtq9KO RLwfavP7vDV/W+B41YRqcCJpkmaDJZR/9CawSTFyrjtA1ITGDvP+AEXPIyp+BSuf/T6T RTULS3T5qnaDB2DnK4L0d3gtNJ7lcwdEulO3N+LXhX1yjh1GonPB/eJaZjJivzLUPrm5 pO0qrDR1H8RXLR/Y2cTLbgqYY1ytgu+k4XNuA83cf0ZFPvyduuvQb2B2vD1MCPAv3aPO XjCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=ewafhVW7kgZUp3bUFzJFovUz6TuuGMRmgTyXt8Lw8XU=; fh=VHnCxRKxbzxiNlbnJyr3AylSYOPNxksfNZ8npWCZ5bY=; b=XtKTzEN6Gpsf4Odz71Spk17owVBk7M1P8wJ2ewvZYcX6IfaQ1tN6alqv6hnVewPiPd zi+QWePLfTqf+FHP3DePj9ocX5raNIkfygTO4ynODW4J61/uc7J6oYwl02ZfLNzc9ira fpnnw3BUJmPUxh2M4g5eIUu3gN/lNQ7ncZr3sqZRcoco3W+ibWCRVYKejwKzFhXP3ubU BxtcJ25Iddpv+vym8xXmWIdtmclLCRpHFNzjjGYxLxYLo2WTVIe7kTGPQVkRdCAbOkZs Z1HKUzyPFo88ZdYph5R9PdSbalr/PA8L2PlUBlzIc7umfML1QBxaobx/uVLwwCM8i5Ve HhCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O4XWEv9r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51789-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51789-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUSMKF2hVKqOSXlLnVceYn4q0hIFwb4muS47Drb6IbmjwNBxHadoU3TzF1cPCYzhASAl4v8u8+88eDm5sNonQ1iSJV7cds0KAOoQOJhRA== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p43-20020a056a0026eb00b006e03ba6accfsi1164458pfw.270.2024.02.04.08.35.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 08:35:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51789-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O4XWEv9r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51789-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51789-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9AB8EB21F6D for ; Sun, 4 Feb 2024 16:35:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2489924B26; Sun, 4 Feb 2024 16:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O4XWEv9r" 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 3061822EED; Sun, 4 Feb 2024 16:34:52 +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=1707064492; cv=none; b=DAWBJ26sPPWAycc2pSTtbwXfh1r7cw4sk4C/39EX6O+0LgvFxe2a/JVp/tWYVJHat/f6F8LMoql5MJUhnfXBYVU6who/UwPVWh7h2gANHjqm/qQjCsBNCsrWu1fqTlN4FLbjiaDZiqsdqvtZn+A8eLe7IFdd54WzsoVY7cPVagw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707064492; c=relaxed/simple; bh=gCTjOmGx5pGl0G5a7sL2z7Qg9JsndGNEKXKQGIQ0/sY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qGWq725AH8+roe1jAK7pGjIF5iMZgsbu3JsLQG5xvhwA6DGP4EBJIZZuaj4QvcjWIUSL8eGBfLPmr4wIdOSbaLsfThOShHnQB5U3gQJbfcHAFenaGb+qI+uhkWUDK6CJcUAUho/eEFQ1709lK21RzdT2Hifdu8orWka91Smjo28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O4XWEv9r; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id D18CCC43399; Sun, 4 Feb 2024 16:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707064491; bh=gCTjOmGx5pGl0G5a7sL2z7Qg9JsndGNEKXKQGIQ0/sY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=O4XWEv9rPgKRAKWn9akrJ6719oXcv0NOsFk6VI3Llcjb0Dm6lexRvBnkR23jsbh0W ZwVbE75RnobUNW/B6fN5beQCcQTLqpoOSich3BsbxyFCvljLFjMeAruJUaSmXkBwsz 2sHsipcsvIVOWibY1u+mXTEQoyHWxGv8j/IcK/JPzX0aexUjbYQiX242GNS70gFBNq 8lvx7Ne84GyEAYo0OgOKTlpYABcbcuVZtYuejRQsbU0C2Q6Nc5rTx1KJSYZK33VIJ3 tKCAlO1gtkEBA0xpn5cES1wkJaFwa40n3sLdAJTO4TM4qAOCO7yvtzhvCL7wcR6R2w Zq9RACEs+xb4g== 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 B2E82C48286; Sun, 4 Feb 2024 16:34:51 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Sun, 04 Feb 2024 19:34:20 +0300 Subject: [PATCH net-next v4 2/7] net: dsa: mt7530: move XTAL check to mt7530_setup() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240204-for-netnext-mt7530-improvements-2-v4-2-02bf0abaadb8@arinc9.com> References: <20240204-for-netnext-mt7530-improvements-2-v4-0-02bf0abaadb8@arinc9.com> In-Reply-To: <20240204-for-netnext-mt7530-improvements-2-v4-0-02bf0abaadb8@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?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707064489; l=1502; i=arinc.unal@arinc9.com; s=arinc9-patatt; h=from:subject:message-id; bh=ePoF9S9AkB1Nueho21W+SYCjoATeOUbmBAR9kyDI6f0=; b=QR1Av9Y32TpeWpNcfORn1FkMb6gOD5gFwLEb1uT1Dq1CnJD3HCun+9vWQy/co/f+GS3Hu3eFv pGExVz+F+xjAp2Zh700g9wh/iPcq3E3xob3++3usWknQ1iSbWf7EI46 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==?= Reply-To: 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 330e22abc076..8b8469eba863 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -422,13 +422,6 @@ mt7530_pad_clk_setup(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; @@ -2259,6 +2252,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 | -- 2.40.1