Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2798618rdd; Sat, 13 Jan 2024 02:27:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUJmTJbiHWDTMA1eAHhMxcrnvL0c6BoBUk8JLYfN9nKXAWL4SmaUaO/mKAQeSV9u8j9c03 X-Received: by 2002:a05:6a20:c107:b0:199:ad49:ea79 with SMTP id bh7-20020a056a20c10700b00199ad49ea79mr2216191pzb.63.1705141638943; Sat, 13 Jan 2024 02:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705141638; cv=none; d=google.com; s=arc-20160816; b=mrsgn5U0w2A9ddnBTFPYed3Tr7dGW9060+KcWDIaFWzcsHA3+Gzadm1Rt3LeyowLjA 0wp3Vr2mJ2t4qlLDYKE09XlKqg810iQadtkjAO6ZsYQqCmyOT5IhqmSrdlwyMTHSZhb2 nBWnBfHL6JcBzpyPW4r6RGJJjD6xb1uqKKm+Y1MNIB4wrrCPCCiSrwyb3MoW10cacYoO MqYKrBE9qaf+8w9VDBaGnrDXnEU5PUW+Scen2wg3GQs3+9cYES60IR+0ngt3Nffnk1b4 wu/KD36LMPy9UhzvGWDJuJsd9Hdw18yKVhT45iGia24jiAEyy1znv2zfp9SqIRp7Q+Md 6ANA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qb/lI7hBqz+FVwkR+R0zS6IF7AIMf5rntcDsWJvVb3Q=; fh=oEE+jV5O4HAXE+nw8ulhLME5zcU0kdlsqoguEBeScfM=; b=aU9UbyXEhoH2pXoV7lyGjw+6Td7BWT0gLphq7V52qA/+aqM23IkuvDy5U7L6N7bO4u VX4Dg2oh2YhSNXdaRvySHwA2Rg5ExWVeyx3d/XIIkTpTfXlY4Pt48ECtCOM9e2Y+o1ZI LgboOWV6OI3TN4zULwBzBoc/tY6NJ247/CHe6uWbftW6ws1yZh2tGfsWurltl9Mnd2yk 3TrGNYiFBsE6L5vVRXV95GW+tjvEg3/o0y1xpC3kBcogrslQEMn2EfASfxEmkdv7jCiO AsiLq3C/AI6E6R2JonzJCUC95iKRGrXNgbuJkqBj2RX+FZpAARB3kHBc4lBjwOy+DhXp AcUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b=fswUsERh; spf=pass (google.com: domain of linux-kernel+bounces-25255-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arinc9.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e15-20020a63e00f000000b005c67bf38069si4823739pgh.320.2024.01.13.02.27.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jan 2024 02:27:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25255-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@arinc9.com header.s=gm1 header.b=fswUsERh; spf=pass (google.com: domain of linux-kernel+bounces-25255-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25255-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arinc9.com 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 881C728540A for ; Sat, 13 Jan 2024 10:27:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EBA617C60; Sat, 13 Jan 2024 10:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arinc9.com header.i=@arinc9.com header.b="fswUsERh" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 9C16E17BD6; Sat, 13 Jan 2024 10:26:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arinc9.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arinc9.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 2387D60009; Sat, 13 Jan 2024 10:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arinc9.com; s=gm1; t=1705141563; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qb/lI7hBqz+FVwkR+R0zS6IF7AIMf5rntcDsWJvVb3Q=; b=fswUsERhLcCzaPS6CiOPvNyYkOrnXVsAZS3BH1uQ6br/+SY3WwvAAtHsWiJt7PUXYOR5H+ 8WpdecIGPEpsfgQC38Fuwzib1JX0YPF0Pw1K+NS3YDLKSvhQYozRQX4aXEpCz0WfoHNtTE hXRMOF4439LVryAoFHc0lzvByiAHV/DmefCTbYcAxF2gZEAvuFfVHw595+oB1nqhynQByC cLppgGNrXaszjfhrtP6aInl3KZxp9mws2L6N7Vn1yBxZ5eyqTxxVW2Ny1ONGlLsjKu5Nod BVuJNQOrbXcwY1jkJyvLJXeYbpWWJ7yFEh1F7m8GwX6OTZXkSv1P8VLEVbOEpg== From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= To: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: mithat.guner@xeront.com, erkin.bozoglu@xeront.com, Luiz Angelo Daros de Luca , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [RFC PATCH net-next 4/8] net: dsa: mt7530: move XTAL check to mt7530_setup() Date: Sat, 13 Jan 2024 13:25:25 +0300 Message-Id: <20240113102529.80371-5-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240113102529.80371-1-arinc.unal@arinc9.com> References: <20240113102529.80371-1-arinc.unal@arinc9.com> 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 X-GND-Sasl: arinc.unal@arinc9.com 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 --- 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 823dc3ab15c8..d3e1e31ac8d0 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; @@ -2235,6 +2228,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