Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp712638rdb; Fri, 2 Feb 2024 01:21:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlzW5d/Hsr91rq9S1a3RIij5wOkzhMRKdkcrPNxZvJ5GQPUMK1+BRLW19pi0m3mc052s6Z X-Received: by 2002:ac8:4e92:0:b0:42b:f8ab:7974 with SMTP id 18-20020ac84e92000000b0042bf8ab7974mr4588105qtp.8.1706865662903; Fri, 02 Feb 2024 01:21:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706865662; cv=pass; d=google.com; s=arc-20160816; b=rTHLso/u4Odghfgi1NhfIkZyyoCkaO+87FOfoRGFgR6/fPjervETK50M3mulZhWz3g SKzcm2Yc4USNzq7ZrPUzUXZd2vPPCvHsm1dqOd/ldLojmyHs1ZuycIZVSrv8UBMyxi4V WkmYyOJ2woML6e1KJgbt00Yts/NuME+Sd6W1E8WyYlx5Ml2/dpw1xKrMEnU+JyioVORo 1o+kmF6mGP6+c1a5Fcknz4QUi0VUulut/k8CA1fU8LL7i7XBeIEOukYv6pFlgvZ37n23 E2rG/mMtMhSrMdeHoeCfCgFkN6T5RvVJWwNlsZxTKV67rcRISX6AXONOTnXGZide+jkk qrzw== 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=rxPO1urfQ1lTy8wlMyF4OZGNqrAy8jtSReGUipES3gM=; fh=nOG7CxKSQ/w+sPQpsfEdYR3KRZjYsDMx4CEiPiOBbZk=; b=anlk7UZSQDRWrzwO34YZCUc0LlVSPIN106YkxJSo/59kUzLx0HWyW0ApR39yyuSBc2 44LtIEXzGWxFIDabD5axeUxJV2U0ZESf86Kj5LsczxcG6KVqJXv02jvghD3nZxIhwZi+ jJnGNTU+sSpxlqcMw+Hgr/bnL5t7Vq5u3ejgWoXQwsGgC4efPlv4fNtRJQu+WvYKhTFW TFfbGtkGf75LNHvwSsfvAvi9XwRs9Tg9TCYonuKn8No8hOZlb0CpA7czdP+FwEZ9rvDP etfac06LUWImGcEckzmqizdZ/8z5/wTgyyGeGqe92H5LNjgwgO9KpLHjirmjh7e3tnof oi/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qH6LbbQ1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49548-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; AJvYcCUWs+M+tRKnaY6xRrllXY+m3Yywt+qtsJ4ycVzCoCGSfhnosyzF5oWQKc5h2h1vzZLIhnRuKtyXfeniOsgDioN0lgtllcuIowoWGA4/qw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id s17-20020ac85cd1000000b0042a704ff63bsi1534586qta.483.2024.02.02.01.21.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 01:21:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qH6LbbQ1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49548-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49548-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 38CCC1C255CD for ; Fri, 2 Feb 2024 09:20:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3756777F3D; Fri, 2 Feb 2024 09:19:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qH6LbbQ1" 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 3A49D69D03; Fri, 2 Feb 2024 09:19:33 +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=1706865573; cv=none; b=EQRrbGlTzqVkAXb26XtMKkRrB7ULKnLfMwMnD5o62RhwJEMhvtfrMNGmUuPrPkmERhvUYxbtGieqiJGL3aeiMVLcsRskYEZSAoRbDR0Gq7Hi7Bx3a9B75eqxVhpijqVHfLhRZg+u3W0MhfyftIZusqQ4GFuKM/z5++/K01pUuWA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706865573; c=relaxed/simple; bh=Mbj/3lKU288Yv0v6r0IvbWbLwZTL+8ODP93iUqv62yk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ezCojt+zY+v7Fr1FeiKmXs2r/mtKu3S0Qfs/QmFTtZFHJsR/a1ZRvwvA8s+Jbl5Orv8xO2QYftctUiFAsrTPP2jPReIgs+ZXqK7NGnoM8ozbwy8SuxBtQ+ZgTs5T3Kz00pR/J8M4/tx8NUikdtDqmRvKqhRiEDbRpSWc4sbc+Aw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qH6LbbQ1; arc=none smtp.client-ip=10.30.226.201 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() 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: <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?q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= 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==?= 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 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 | -- 2.40.1