Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2680349rdb; Mon, 5 Feb 2024 14:19:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFxrQIP066woGn0hMV4kPUmw/KbR19pwAQAtjuaPtnEPruG4fgwny+LYCeArCGd6QsfNtY X-Received: by 2002:a05:6808:2395:b0:3bf:c9cc:13a0 with SMTP id bp21-20020a056808239500b003bfc9cc13a0mr472782oib.6.1707171542307; Mon, 05 Feb 2024 14:19:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707171542; cv=pass; d=google.com; s=arc-20160816; b=Wg+qe1H6Ew9qaYODLyINTBaoK5oBRIO1BOCdJjp3CyS3G9g4UV9j20dkg5lnZeXmzb Efqa9TqBvZzo8d6jIqdHm4NEaFJUW/8WkWiSDufHfwT5WNTaCcOqtR4dfs7ldRvpPClt +LrDwXr4i1YCdWMOItoLUc+MYil2g/WBKg1jAGGDZvm2Ip7zEPSw+UEpSblnYrKWuTH4 TZdBtqzJxu0tbsJ0mG200Kw/9aKiZtS094emQbUzA99A1ar+xKlJk04+BijVUx+dVq86 4SJXX8RaicDEaaU0JxOFC1BHJ3zc1nQbhSgO+1aB6zylx5a2GkEZSYZJEVXeya/kwXp8 1hpA== 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=QfaslHGNqvbJDCGDQhjQxlPRaepZFo9Chh3WH3wisGY=; fh=7oO88Jx2EhE8xUGFFeiODMg+uRRJm7OLNcSwgCf9go0=; b=ZRFhac7vwna2mnEIar6ak8JKUzVvmTrMV4t+B7Aw+jjchS/Yd3RIT9t6AtiBDNGPhK d36gTYKygRw87W+RSkuNy0pnFeCtkqmN7Q1hegL/7vrjLlhIhZbraseovH+gRadltZLo CsxcBhQ0ViOIUfgWTXgOKfIcJP31EUeej/PYoFBcCS8FjaPZsN6aWUJim1lwvyNszVFA 3N8Fw7Wd5Cbh1BacanTCMcn07PajFcTLyRb3I1zLM8CRP9MYQh9wsXwg4QxBnMF0a/DW g5RxOC/+JvEvJ6xxpky6LB08hWAq1DH0f4UcOyIa1fvDm3k71h1dTTsEDmDqiiIP6oWC dcCw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z3PzmIad; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54004-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54004-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; AJvYcCUQ9m1+MA9XYqZsVFOzAlxkRfKtx9X3kzxYvLAozyLYjMjc+PM007cKqWW2IXEGQa1ZnfdtSz+1QwO83Iy5ZuwprI7t9yNKEUmfgaGJYw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dt6-20020a05620a478600b007858b831cd1si532124qkb.176.2024.02.05.14.19.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 14:19:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54004-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=Z3PzmIad; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-54004-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54004-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 E37AF1C268AB for ; Mon, 5 Feb 2024 22:19:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BAFFB5025A; Mon, 5 Feb 2024 22:08:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z3PzmIad" 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 BEAAD4F612; Mon, 5 Feb 2024 22:08:14 +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=1707170894; cv=none; b=UYAio93/oBBJjbVqfdUtuVovKtanyPT+ht2x2ZauKMo8TvP4+CkNvorjHvpA+RCLjz0+6Vkv9bXKLWiGglQNc9xAzA3xbzBYrseANn+c08n/4OhVjvMmj2xSNPuBC/uRX8Zaxbegl/cUENyZiKH2uBHk+QaBcNrWg6Mpd81QpLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707170894; c=relaxed/simple; bh=jfOJQuDR5OnZ7kHdXBRWttLFE7HrqwrcF+PXQeKVXXc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IcNhzdt4/wb0O+BPRos1q19PnsmeuSypCSQa9aQHrwvUCgUMgir0TKSOXwfc5xJxexH4vR6r31ljxnDqJ6CJOBfES2jqGvaFrlFTAKQGYnYRLSykKJX4CFtddgGCw4ejEp661b3BxEr0rZTt9/9V4JEuIxRPUepDwMo+MesjUIA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z3PzmIad; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 599A8C43390; Mon, 5 Feb 2024 22:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707170894; bh=jfOJQuDR5OnZ7kHdXBRWttLFE7HrqwrcF+PXQeKVXXc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Z3PzmIadOWga4CWm2g1HhmtZTRLsTHjvyhKbz+F6f4wOF60Kp/tqVe5HiKigpnBjX eGeZiA15hcBdZ+HZ/UlJL8gANtdsglI58I3L4AnP4P6XpqOMD75VENlVGF/JodU53T 7sO34Kfw1cPjhj0vk3sD5k6usr922S1cG/PyldGykk9jS/5UjU3mQ2CIL81kEjeG5C M3E+sjcWHUNFC659+q3GlsWY+etJnotAmxftLvERSKmGq63jeDCcoGTyBP0K3eCZHw SYHJovUxIzDB8t2e83n7qW7sVEORIC2mFRKwoyhyELfDo7WV1Cbgrq1qvWYnLAjA9H AFdu68nLDcejA== 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 3AFA3C4829A; Mon, 5 Feb 2024 22:08:14 +0000 (UTC) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= via B4 Relay Date: Tue, 06 Feb 2024 01:08:03 +0300 Subject: [PATCH net-next v5 2/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: <20240206-for-netnext-mt7530-improvements-2-v5-2-d7d92a185cb1@arinc9.com> References: <20240206-for-netnext-mt7530-improvements-2-v5-0-d7d92a185cb1@arinc9.com> In-Reply-To: <20240206-for-netnext-mt7530-improvements-2-v5-0-d7d92a185cb1@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?= , "Russell King (Oracle)" X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1707170890; l=1567; i=arinc.unal@arinc9.com; s=arinc9-patatt; h=from:subject:message-id; bh=Li/zn0Sv6n/UTyGYqwZm1/fdMf5SJvivtXipqKuvmqw=; b=PqQAUUtRHGCt/lV01+GVWwSekPOmfNry2XRRS4QiXDOoR2bAruYfgFqkkJp3ICJiFkBv56kMf VSM+341MMybDSzYWTU3CPks4jN1c/RnnTYxIrOPTHSiJvFz4WCe56n4 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. Reviewed-by: Andrew Lunn Reviewed-by: Vladimir Oltean Reviewed-by: Russell King (Oracle) Signed-off-by: Arınç ÜNAL --- 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 330e22abc076..8b8469eba863 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -422,13 +422,6 @@ mt7530_pad_clk_setup(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; @@ -2259,6 +2252,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