From patchwork Sun Feb 4 16:34:20 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: 13544727 X-Patchwork-Delegate: kuba@kernel.org 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O4XWEv9r" 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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?b?QXLEsW7DpyDDnE5BTA==?= 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: X-Patchwork-Delegate: kuba@kernel.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 Reviewed-by: Russell King (Oracle) --- 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 |