Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2854349rwd; Mon, 22 May 2023 05:28:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5VjILGBG9Qs4pxDpsX7gjesnD2vAln8kZs9vzcdzrQ4e4NAF7VlhGgAWUo1aYiqWyyG3Wj X-Received: by 2002:a05:6a20:6a1c:b0:100:1ba4:d67c with SMTP id p28-20020a056a206a1c00b001001ba4d67cmr11972210pzk.62.1684758508418; Mon, 22 May 2023 05:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684758508; cv=none; d=google.com; s=arc-20160816; b=NrGKts52Rn78f92eKzEfngAQ6m+8NIT/njfLjFdfaTrAczUOduBdUNawGoCT1c/n5+ k/86y6OPPMBAUBAaYgGzsa19l9vaf82D17dEe4fCwnY5COXmEe0v9XlxgNTeY/wLA8pO 1ljpWrI6oQUu0FB+KMmP1r91qIvoBYZ3T8BsDCePU5URZvJ9gAFbn51mURH5sncFraA7 mEa5EM6TljFGdzbqSnPowr/GshwWz5qoDWM41jGTwrHDzQZSVKwYHbWBQBZBw6sehSLL o/Rjt41hwvTw2EFi82RfRpFTnqz4sD5RynFpR8jnQH9wApt0TgLT1N2wa6TqzoU3SSpp 5kXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2+eXnKIFQ1zN+DpEz9mLEIzxzccBJHHMIoobq7TiAKA=; b=stm15EAVZ22I7r3vajPkoOyFvO2ScDvnhO6R+NYL7t4xRMePmg5Jbika3DwOAQLKso EQ7m+F8gVD7zfxomK/ywlGcY6vlkfEBdqK1EeEe431dDyyGmKGo0quJ01YI26Qup15Lh 79I3D+JFOUcjHKHdcX7AlG4A2QFsU+X0wxWu9e9zQMSBYUQhxU9ApwgVYCpzX7LPHsoj QN69T5iY4rbLGfZCT5idgpV/+W0KRpmUbzfzwQ/vhf7+GLIFAyfIXpSR+suTClK7hkJc SXmz2M2yKXhZuZLIi02Za59Uo37lAe2Yd6P2ghevgnkG0s4wpWvoEzR2PXnq80eSHKbh pz7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g2M5feJC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t185-20020a6381c2000000b0053b29394937si405330pgd.816.2023.05.22.05.28.13; Mon, 22 May 2023 05:28:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g2M5feJC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233823AbjEVMSt (ORCPT + 99 others); Mon, 22 May 2023 08:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233861AbjEVMRr (ORCPT ); Mon, 22 May 2023 08:17:47 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7C7A10D4; Mon, 22 May 2023 05:16:36 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-96fbe7fbdd4so306467766b.3; Mon, 22 May 2023 05:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684757782; x=1687349782; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2+eXnKIFQ1zN+DpEz9mLEIzxzccBJHHMIoobq7TiAKA=; b=g2M5feJC+CnCKKXq4Wl51RLxMIWgD5pRAs1W7Qw84KVrsW06zGRUVeS2WCbvjgTdTg AXzNuqGyx6Kju4i8Ht8F5QEdVYqoq+rZXA2TMGOXLqgGTs1uaumXbsnQIi/IFzIdFwSr vNps/54AD4zty56kHO/bw3tYjUwVB7gA0r9XikpsPjHUEVyzgpkhyWcLt0Ju5qaCobru UWpQlEoQm5AWhkxcAUu+cyWqBNBxDy8AbrEoPix7tEpd4EEYSre7Slq2yzB5jFNcqQCq y4DQqvhU0NW565fHJ7ihCo+qapFbgU8Cto2w/dd/d66kD8yylqHSF0EPz+5wrlWdBnd5 KqNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684757782; x=1687349782; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2+eXnKIFQ1zN+DpEz9mLEIzxzccBJHHMIoobq7TiAKA=; b=E/0mVSMUeMNVVvsH/MsrTE39NpcaE/T2871dXR/doXb4SfsdXSuuTGLCeEQQcJGDYd 7OIaGpRlnaPNcJwdui2g/7b3iRUQVPFsP7hYp6f2e+zJy7W6Wfcfy7zxN2hjJwYjcOyI gyi1RI4dtK8q10rauf3CoB2P25fmdys4dlj8RoEeIhO3fIQlzgOnci75I4VTLTbSH1cV zAtG3PxYln8E1DT0wAM+4incL8RkHRh9BiJ63O0iC2InmC9BifWVKtWVuAtQovL6pKO9 cVIdc6HF5dYj/MPeYGnpg5RivZj3Ie4rG0861CHRy7rq3zGPAu97+U8VBOwwXLrgo6AG c9mA== X-Gm-Message-State: AC+VfDyhIkJIX3VdvBtduNv/+jISL/fO6g+c75BLDaqamfhxzcBSwU5z pXn+/dGP284pYF1t/QxKD5o= X-Received: by 2002:a17:907:a07:b0:966:3c82:4a95 with SMTP id bb7-20020a1709070a0700b009663c824a95mr10266587ejc.19.1684757781976; Mon, 22 May 2023 05:16:21 -0700 (PDT) Received: from arinc9-PC.. ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id y26-20020a17090614da00b009659fed3612sm2999950ejc.24.2023.05.22.05.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 05:16:21 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Daniel Golle , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Cc: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Richard van Schagen , Richard van Schagen , Frank Wunderlich , Bartel Eerdekens , erkin.bozoglu@xeront.com, mithat.guner@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 12/30] net: dsa: mt7530: move XTAL check to mt7530_setup() Date: Mon, 22 May 2023 15:15:14 +0300 Message-Id: <20230522121532.86610-13-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230522121532.86610-1-arinc.unal@arinc9.com> References: <20230522121532.86610-1-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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(). Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 049f7be0d790..fa48273269c4 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -408,13 +408,6 @@ mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) xtal = mt7530_read(priv, MT7530_HWTRAP) & 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; @@ -2133,7 +2126,7 @@ mt7530_setup(struct dsa_switch *ds) struct mt7530_dummy_poll p; phy_interface_t interface; struct dsa_port *cpu_dp; - u32 id, val; + u32 id, val, xtal; int ret, i; /* The parent node of master netdev which holds the common system @@ -2203,6 +2196,15 @@ mt7530_setup(struct dsa_switch *ds) return -ENODEV; } + xtal = mt7530_read(priv, MT7530_HWTRAP) & 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; + } + /* Reset the switch through internal reset */ mt7530_write(priv, MT7530_SYS_CTRL, SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | -- 2.39.2