Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6658065rwr; Tue, 25 Apr 2023 01:33:10 -0700 (PDT) X-Google-Smtp-Source: AKy350akv7ptOF7uFpL/docbr1WHaD96WY6aDIZUcBb37NLtK74UreV2fxLvT9JP9++J6r9ibKq5 X-Received: by 2002:a17:903:2781:b0:1a2:8924:2230 with SMTP id jw1-20020a170903278100b001a289242230mr21086724plb.27.1682411590386; Tue, 25 Apr 2023 01:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682411590; cv=none; d=google.com; s=arc-20160816; b=UwY307JDAggSbECF/LBbXgbp+sK/Jt0jX6s+h2bSnU0P9HMO6IEOyJXtpDi4egBKdM 96LgN9RJaGdjVQvdf6nFtJvqkMDr2M21NL1AYgR9uZltcomQxpUGog1jeudEvXZ83K/m e4lsKNeg/IvTUxD22UBXAhRWH/jVmnGB0UDJqVbTumbSnyH1uhn0OEoyToG7Lw6CT4I+ yU3xnkm+xPfmMuR0tdrvgqqNVvl34wmp8/gG4hPFXMY6eXbGDLq1paxr4FVmU3xF3klT w47tI1MjwAzfHpcJs0wo4VfgumSpiVFnfuGL8wzs4eHW7Eq/Q1POOKfp7mIqk8EM9FAv nqEQ== 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=7kwxv5YjSB3QzEOGZ2oRt9roe6rXfZ17PcarFfIQGeU=; b=f3Lid0SX/eN0SDPzkb6fkItgm0MY4x4zprGI5nfbEFCkXS+fGDMdlw+VmjyjOxmEUH sOkI/hcA+loek2Wp/NWwOCHumwN/+fM6CTQhsEuSstlDzXXFy7RVEoHEelzmhrRD8HiL E+esm2Vdz2JxNNEUB83rZZYEkXqlZXl3GZHhHLdRnEYhoGHy/qPH20Y83re9kU4Nhc27 FhZDolF914dmud+1yKOm0Bnq3xpN3CGCS4HvSbHAVHm2e7sedClcxqIbUhjQ2XDlnlOK KdLdl7WGesex+38lY+JOfsw0EIGtgaa6UiJ0s9KSDrLP813CJ9QY3vPVbijafQYL0oDT x5Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=JJcsEUpw; 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 t6-20020a170902e84600b001a66c501a46si14457453plg.136.2023.04.25.01.32.58; Tue, 25 Apr 2023 01:33:10 -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=JJcsEUpw; 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 S233799AbjDYIca (ORCPT + 99 others); Tue, 25 Apr 2023 04:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233300AbjDYIbU (ORCPT ); Tue, 25 Apr 2023 04:31:20 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D2EA13C1B; Tue, 25 Apr 2023 01:30:37 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-953343581a4so804615566b.3; Tue, 25 Apr 2023 01:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682411423; x=1685003423; 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=7kwxv5YjSB3QzEOGZ2oRt9roe6rXfZ17PcarFfIQGeU=; b=JJcsEUpwNrmrwPV1ogH+dwji5UMjyghuQyIBJSBSKEqpqR4i7KqFBnSFFdzTW4eZ8c 2fDyt73ztwhma4blJQ9jnGdUFSxbsiHlgwYh4yOaJ3UqKqISxanFpgs4kv3J71eyedRk R3yOnsnU/xgFAswncrZI4IIWICrXoYhrJEqJ9wmmwmexzzPebdfdmDz4ZMqALrL4GnlC 5DFHcrt5ZCMJZsrFfEJXpHhomuOdKW/4TWKjo+Vk49HKNjn7BVecvr62wBxMzKbQLvS1 RUYPtMsepfQXjvqZhOssU2piw8AO51XNd3ESlMfdDAG8VOlTnIEpfryA+LXjZrj8UeNp fFBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682411423; x=1685003423; 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=7kwxv5YjSB3QzEOGZ2oRt9roe6rXfZ17PcarFfIQGeU=; b=QYJDHJIxjRsg4K2Mg6GASTE2iVpVqUQY7YZ6uboMW8z23wqMM9o4qUlkgS14RuRKPx 0z4fPdEGutOya3eCYwpoxl089aYMhlDxVb5AiFAEGi9GUgMhuHywe7vfWneALor1tO4l XBO1D1gmN1WVOTCAmb6C/p8Ixfpx2y+X1hoYlg/c4SgUUJ4k0EF8rV1+6EOIEV6odLEo rQL8IE2a9iD+jeoWUCpQ8Ujcf42beaAdoEguG7kC13B4zytQpF0OqY5epCUC2XGO0DWc nFsUEhKVOe7SPXYFPWdpR08YfwfyrQJLk7PaEtzMuoXgomslMAfcBiWjCa3VfU2rV5EF TuEA== X-Gm-Message-State: AAQBX9ehbDKdlkSL4Pg5Aq2jgvdm9ersYXhLoS0tCJnZLERDWBrB3z6c 619S614/UkRMvu3F78dfZls= X-Received: by 2002:a17:906:b088:b0:94e:98da:ef97 with SMTP id x8-20020a170906b08800b0094e98daef97mr11814688ejy.27.1682411423414; Tue, 25 Apr 2023 01:30:23 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id mc2-20020a170906eb4200b0094ca077c985sm6439028ejb.213.2023.04.25.01.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 01:30:22 -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, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 13/24] net: dsa: mt7530: move XTAL check to mt7530_setup() Date: Tue, 25 Apr 2023 11:29:22 +0300 Message-Id: <20230425082933.84654-14-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230425082933.84654-1-arinc.unal@arinc9.com> References: <20230425082933.84654-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 2addd5e7fbe6..04a48829465c 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; @@ -2136,7 +2129,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 @@ -2206,6 +2199,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.37.2