From patchwork Sat Nov 18 13:13:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= X-Patchwork-Id: 13460039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17DDCC5AD4C for ; Sat, 18 Nov 2023 13:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8HCL7cl4AZrUYN0hQTDNRIMaThMUNYtNxUuM5fMIcUo=; b=rTJbuTMo3G8F06 XmKlVupex4MKlLkUt4Obwze9aRSoMoyeo8yYSdhvlrxgA8DSQ0IIYZf1zQW8tQxfFe7xG/hbPbACn A+nLwYwiaFhCuA5dAjBhFyHgdGAgW9VKoNJU7CGASj9kMX79E1W95FnjhraaC5enyDepyseghglyN F9Qb+flfydhmGyp19bgajVw4Gu+KM3fWSrZevJbKA3BVfbp9mPytln+mv99WgAR1oZXeLG5WTVU7N 8kkrRb8S0bEVfXoCMfk7kYrWa4/VZo3N/3kCnJgNMZSJBU0j35Npa3ivyT+0u9bVYG20rl9PP5MU2 pPtf5XsjCuT1rYxK8aww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r4L9i-008WlF-2y; Sat, 18 Nov 2023 13:14:38 +0000 Received: from relay7-d.mail.gandi.net ([2001:4b98:dc4:8::227]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r4L9g-008WkF-1J; Sat, 18 Nov 2023 13:14:38 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3ABCD20003; Sat, 18 Nov 2023 13:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arinc9.com; s=gm1; t=1700313268; 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=uXFYiw10a0pMRlEC7kyG2G0OwntK950CTsvbCBCBf30=; b=PWZl8nw7sn+4XH1/1AYHk3tWRGYSS8MU9Q/LVr3grMOWXGARHkH7VDsDb7/NYYewaBi6J5 cra7ROM6eNlyxIzZu5NSD00nRRDnpvTuRe8u2i6S0Xdd/OuUfvMT1GIrNsmcPo5C68F1xy /pN4u2MDFW48jiy6VYJMl/fHiZew8w0WWLoyTUy9wHLc4Vkejcw8tRNpbxaWqQ5WRq7PPc G4ESZvCcRE2biC2hHrxVa9RAXDEMqMWYbmwCO+ZGlkvIa4klNg5vZ5wJKMUcM/2h3FGhz3 zWfXxPCdlc2a5iwAgshoJBaBllTDXSdGIbn+jnzAC9ITgwjel57AZSv6IwmmPg== From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= To: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , 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 , Russell King Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Frank Wunderlich , Bartel Eerdekens , mithat.guner@xeront.com, erkin.bozoglu@xeront.com Subject: [PATCH net-next 11/15] net: dsa: mt7530: move XTAL check to mt7530_setup() Date: Sat, 18 Nov 2023 16:13:13 +0300 Message-Id: <20231118131317.295591-1-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231118123205.266819-1-arinc.unal@arinc9.com> References: <20231118123205.266819-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-GND-Sasl: arinc.unal@arinc9.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231118_051436_593738_191CECF4 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 efe5ffe3455d..167b340350b3 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 |