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: 195734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp307619dyc; Fri, 2 Feb 2024 01:26:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbu6CujwVnRsCWeAyZ8u0TW9hz1rH+0cWHJvtUHAjHiEnG26MoD6IAYQMpl7ZUNS8nrU4T X-Received: by 2002:a05:6a20:9f4e:b0:19b:673d:824d with SMTP id ml14-20020a056a209f4e00b0019b673d824dmr5182576pzb.46.1706865969513; Fri, 02 Feb 2024 01:26:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706865969; cv=pass; d=google.com; s=arc-20160816; b=MTClA/i4++hgoSGb30dL/+LA6W8QY+klFG8Yb+f9bs9F48oFyCoP2NczlG1mzxVKnq /vC8HYrIeODj8WnD0dza4/L3aZtFRGx21EX1BIjFrlyLdSsJM8qKH42EuKlVgT9YwhxN vomZglEZvI5/MP/JWI91P4RjBwuNfvxEVGxfKkY90pLQ+aZnYMfCpW1rFisKFllSPofX qTfQS3rG2mSl4ZNB5P1o9L8RLXdXRHwcXKqSq8csw/EEsjU88QMA9VeXencWAD790j7F Ap5xdYzSdIgpJ/Al0A9YKLayVZo5IX2+JZUhCYIxoMwJBGFy7wGk5DGNl1uVZQ41vUoN nkdQ== 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=C/J7U1GgPHRsV+VMIHEDPbNLC9EiUSTE18PHwFj2lqU=; b=njxRLaPEsA4/prYXKwtCUBO1jeJtANlpMO3rFE3RBhQeLA88k2kx1npyAS5PHY21MK Ckw7xaq5Bl9aC6KQqHR/di7RvoI47HfcgqhbbHXfNEgS9Ov5pvbbIbTKs6KsGsnJsYPX fx/dpfpfjXsuXF4bduT6yes2grWOqWVLVTXXu/8mXcBO6thnCSVxJRzA937Z/3fj+Cwk xh9RqoBwmNSLZ12wHkJKprnA8yf8J6emjQaxwc9JwQYWi+uUCBJP7iP38rVYMCjzuCqF W76EjBn2fzSBJoCbal+3nNvfG60bHnHi9LbEvvgHtJt7qySFGLzbkkvXg9bGMP4OvBH2 7w3w==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49548-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXuo7cFkmxELmRF4FvWfAK0RUH6EqP5eTBy4bhK7PIKXBXwOQofhVXZmk9GGspCtLfAv0zmBeJuIbJbFIJIwdtNm65S4w== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q7-20020a170902dac700b001d5efc7b903si1458117plx.304.2024.02.02.01.26.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 01:26:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49548-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49548-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 94F91294505 for ; Fri, 2 Feb 2024 09:21:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41DAF7C0A4; Fri, 2 Feb 2024 09:19:36 +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 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==?= Reply-To: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789778690975191041 X-GMAIL-MSGID: 1789778690975191041 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 |