From patchwork Sun Mar 26 14:08:12 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: 13188085 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 A6935C74A5B for ; Sun, 26 Mar 2023 14:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hlqMgsbtMdGDwnYgR2vesfxbv2C04RSOqe9u/KU4Ors=; b=2DJwqpLWCSw2yI lzC7O/Z0PvwrzZ7BCjPK3D+K/4xn+qq5NiLaiRvtB5tMiHDGzl+mwZM2W76U2aLqIQtLAEOACwDmc eMMmrdfe4TLrPJ0P1JVcQdNLippc5m9F8LX4kWIROf1mQGohjZ/apruiBKgTejn4DerlVl2sCcR49 VoZ8qFABHyQgEviyCTpkAkhkCx4xDeah5cn5M1Y4iWigc0bky2DIQw1FvGi8PIPdDXn/C891I4rr7 wEBlMM/DtgGnOC2L5VTkS8RcEaKi9upbU14zBZ9ZxIQ0ezQn64dqgnXcmbbmHA7b5Zic6ngySG/pa 6Gd3scFw1NAibo9jvkww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgR33-008VVr-2h; Sun, 26 Mar 2023 14:08:41 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgR2u-008VTO-2E; Sun, 26 Mar 2023 14:08:34 +0000 Received: by mail-qv1-xf35.google.com with SMTP id q88so5013317qvq.13; Sun, 26 Mar 2023 07:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679839711; 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=hlqMgsbtMdGDwnYgR2vesfxbv2C04RSOqe9u/KU4Ors=; b=KHOvRSfqQyWTy9ScGQJ8IWC0p7ihFilYWFRWGp1cuRjLBuNtSqMAa18k5ewbyq7Per F9Zk2ka0l6LdpkLmJi/Jpob3ws2xH4WfNayNory3VwV5s01MDbRtJD+d/ca8hTYcOUbk rYzAWbueY94VBEaN34s2DeUNNiWKowsy1r7nY0nG2FdjSAFre1PQjh9aTMXfw8NMxG6Y WGm/cKKdHhn0iG8Nsy8zyybIr/PS6FCBCq+fHQv87wIZFGhkjaqAjqoyqUUJcfFystzZ ADKkLHoTDOIc3nWfngO1AOjGoSQtIM/JOyjzymCi0bR4wnPBYnx+Y03BkBl4M1Ky0IE5 epbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679839711; 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=hlqMgsbtMdGDwnYgR2vesfxbv2C04RSOqe9u/KU4Ors=; b=szqOVh6K9tAfUV1lbZOcLXQPDmeWvY9hgIFHSc02+OePeekkQvigOKQuoEixmthrj9 0AnO0H8sRUlf7xKusHzXqVLjMz94kenJ+q80v4ef3FRaya6bDeVw5nkgprjI6Egr/pWe TcSYVPob6GAj7lXjFHfeatTo0wPNvJr5oGgrkFWoUNGrxw2PzXQo4ZJCWkACQlkyCg1c v06VwOKET5w2RwdqwsM+ntSGqhYG3JxpvaDboDuePfflkkbCMd/tl/VA0BvlHMWU0v+r f/rEGvb0L/myKdl1jujrEDPd63qcOAHu91FqTLlpMqclhEvip9Y/aogMXziJ4jRrHT5V 0t/w== X-Gm-Message-State: AAQBX9eHIa3hsDsZI9By0uNPisMzDqZtDqASDlgnUnfpGJcnZz2JwKW5 xM3VI3VmTQpnfLzBJpOfBLk= X-Google-Smtp-Source: AKy350bQt+rT9tKjyp+jcmLOuyVtQ8y49KPu+aHAFnNI18NCKk4Cu4hKAl6gcnlq2J65UPddcNsBWw== X-Received: by 2002:a05:6214:258a:b0:56f:c138:2844 with SMTP id fq10-20020a056214258a00b0056fc1382844mr16074703qvb.37.1679839711363; Sun, 26 Mar 2023 07:08:31 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id j5-20020a0ce6a5000000b005dd8b93458esm2212220qvn.38.2023.03.26.07.08.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 07:08:31 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?q?Ren=C3=A9_van_Dorst?= Subject: [PATCH net 1/7] net: dsa: mt7530: fix comments regarding port 5 and 6 for both switches Date: Sun, 26 Mar 2023 17:08:12 +0300 Message-Id: <20230326140818.246575-2-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230326140818.246575-1-arinc.unal@arinc9.com> References: <20230326140818.246575-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_070832_731621_6ADF717F X-CRM114-Status: GOOD ( 12.72 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Landen Chao , Ilya Lipnitskiy , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , Russell King , linux-mediatek@lists.infradead.org, erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL There's no logic to numerically order the CPU ports. State the port number and its being a CPU port instead. Remove the irrelevant PHY muxing information from mt7530_mac_port_get_caps(). Explain the supported MII modes instead. Remove the out of place PHY muxing information from mt753x_phylink_mac_config(). The function is for both the MT7530 and MT7531 switches but there's no phy muxing on MT7531. Fixes: ca366d6c889b ("net: dsa: mt7530: Convert to PHYLINK API") Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") Fixes: 88bdef8be9f6 ("net: dsa: mt7530: Extend device data ready for adding a new hardware") Fixes: c288575f7810 ("net: dsa: mt7530: Add the support of MT7531 switch") Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 02410ac439b7..62a4b899a961 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2454,7 +2454,7 @@ static void mt7530_mac_port_get_caps(struct dsa_switch *ds, int port, config->supported_interfaces); break; - case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */ + case 5: /* Port 5, a CPU port, supports rgmii, mii, and gmii. */ phy_interface_set_rgmii(config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces); @@ -2462,7 +2462,7 @@ static void mt7530_mac_port_get_caps(struct dsa_switch *ds, int port, config->supported_interfaces); break; - case 6: /* 1st cpu port */ + case 6: /* Port 6, a CPU port, supports rgmii and trgmii. */ __set_bit(PHY_INTERFACE_MODE_RGMII, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_TRGMII, @@ -2487,14 +2487,14 @@ static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port, config->supported_interfaces); break; - case 5: /* 2nd cpu port supports either rgmii or sgmii/8023z */ + case 5: /* Port 5, a CPU port, supports rgmii and sgmii/802.3z. */ if (mt7531_is_rgmii_port(priv, port)) { phy_interface_set_rgmii(config->supported_interfaces); break; } fallthrough; - case 6: /* 1st cpu port supports sgmii/8023z only */ + case 6: /* Port 6, a CPU port, supports sgmii/802.3z only. */ __set_bit(PHY_INTERFACE_MODE_SGMII, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_1000BASEX, @@ -2772,7 +2772,7 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, if (state->interface != PHY_INTERFACE_MODE_GMII) goto unsupported; break; - case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */ + case 5: /* Port 5, a CPU port. */ if (priv->p5_interface == state->interface) break; @@ -2782,7 +2782,7 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, if (priv->p5_intf_sel != P5_DISABLED) priv->p5_interface = state->interface; break; - case 6: /* 1st cpu port */ + case 6: /* Port 6, a CPU port. */ if (priv->p6_interface == state->interface) break; From patchwork Sun Mar 26 14:08: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: 13188086 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 DA4F0C6FD1C for ; Sun, 26 Mar 2023 14:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9WREep/uFgN/eq+sZNlJgQLhID1K1IK3LPV9/PpCfqc=; b=diU/BJ0ZiolDYm hYCyBk9wlI/em0X33QiE47Pr4MFfjtamJE66bf/f9WTqT8eGN0aAE3/GbgLD+ZzNfBfZ3QlJkrS6G VEykmzHU/Ej/emeVe8+Suhw8olQ27Rx6KYfGHmTglw6IF03jo7zyAcv2dw4Jjb2uIrysquWtv1N2F BLbbIbmmYJ1xuv+hNKczvWb0qdbYXQVoYGbDHlZQDf+P68/TYuuYjY01T0pm9TtmcUYuiPj79CT1N ZOts441//jaTBRFJn946meAVUUm5hwZX9xG0og+UGL901uaD++ciLf+HoUSgbgbm+GY3OO+Zamu9q 9FGM2Ttrp1mmifwP+2Tw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3D-008VZe-33; Sun, 26 Mar 2023 14:08:51 +0000 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgR2z-008VUT-1o; Sun, 26 Mar 2023 14:08:38 +0000 Received: by mail-qv1-xf2a.google.com with SMTP id jl13so5053510qvb.10; Sun, 26 Mar 2023 07:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679839716; 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=9WREep/uFgN/eq+sZNlJgQLhID1K1IK3LPV9/PpCfqc=; b=Q2l7rBPanCOROqiRzww4lARkg9ZAg9Bapi3rbhQW/IkFYT837uziBPuG1BziEFS89f laRZiicNLo/9ulN9PV/DhIZY+mnS9gmbfDjvCF+Vz9eBnT5orhN/vfiMoh/VdZ34wQXh TDlbawItGu4+/5LhY8Rb6fv6TERsFcWxh8maWE35D4VJSIKePaqsgLnqwcHZOEWDKoCz OQAidwTXP7li7rERK7lO+UMePBSmIqrYbyJNG6D5ZVcaOgHBX7wNXQDWnAKsOJ6avYO0 Y9oZ8oelx4wtuKkl8XHqph74loxHZeh5RtA+C+hCP7/AffrP6PtW+3sbFvpfMSozLmg+ mEJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679839716; 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=9WREep/uFgN/eq+sZNlJgQLhID1K1IK3LPV9/PpCfqc=; b=dF4FUKy40KpN8Uldt78EFLoba2//uuyFF5DGogiyKmmJL+zJHec1AaymC8UIgPPtaq UTOx1m+FZw0eEdzwAH8k4GiT7DZFx2YvIGbeMvVVIm4FdhqUXQpDXD7V1VzbiVaoVOHN t/3wQ87WKTczjSoqy5VnDNwc4QIusN7oAEWZVvc5HtUA7sURmuSYc5uoM8dTsAVrSt1T RwVgIoP7l2IoGYQ0FP3g+2Z2zRnYaspWkrKp9gqRurCSfRRNR+HsJOUIZqN5teN1cM3Z CRg+Li5R5NGwemA4oGgpXFqlhHA24Kaykbz2p4zGa86iXf6Iq+fYIcdR73MBP75qwb6B J8PA== X-Gm-Message-State: AAQBX9fMimbg329zODGKC9PJB7XXdGT7FsY6A6M3lYikSQwpfnlTvXPA Dc/SKs/reK+oQraETfoj/pQ= X-Google-Smtp-Source: AKy350ZS8/EBgNW/qhv77gSkv3ALYbhI1UnitVz4DKT8orb8a12B2BcJsnGRHFuhE51Orjd/Hx6arg== X-Received: by 2002:a05:6214:c2c:b0:5aa:43c0:9cdd with SMTP id a12-20020a0562140c2c00b005aa43c09cddmr15287399qvd.45.1679839716258; Sun, 26 Mar 2023 07:08:36 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id j5-20020a0ce6a5000000b005dd8b93458esm2212220qvn.38.2023.03.26.07.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 07:08:35 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?q?Ren=C3=A9_van_Dorst?= Subject: [PATCH net 2/7] net: dsa: mt7530: fix phylink for port 5 and fix port 5 modes Date: Sun, 26 Mar 2023 17:08:13 +0300 Message-Id: <20230326140818.246575-3-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230326140818.246575-1-arinc.unal@arinc9.com> References: <20230326140818.246575-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_070837_604158_F3FF082B X-CRM114-Status: GOOD ( 20.03 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Landen Chao , Ilya Lipnitskiy , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , Russell King , linux-mediatek@lists.infradead.org, erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL There're two call paths for setting up port 5: mt7530_setup() -> mt7530_setup_port5() mt753x_phylink_mac_config() -> mt753x_mac_config() -> mt7530_mac_config() -> mt7530_setup_port5() The first call path is supposed to run when phy muxing is being used. In this case, port 5 is somewhat of a hidden port. It won't be defined on the devicetree so phylink can't be used to manage the port. The second call path used to call mt7530_setup_port5() directly under case 5 on mt7530_phylink_mac_config() before it was moved to mt7530_mac_config() with 88bdef8be9f6 ("net: dsa: mt7530: Extend device data ready for adding a new hardware"). mt7530_setup_port5() will never run through this call path because the current code on mt7530_setup() bypasses phylink for all cases of port 5. Leave it to phylink if port 5 is used as a CPU port or a user port. For the cases of phy muxing or the port being disabled, call mt7530_setup_port5() directly from mt7530_setup_port5() without involving phylink. Move setting the interface and P5_DISABLED mode to a more specific location. They're supposed to be overwritten if phy muxing is detected. Add comments which explain the process. Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 62a4b899a961..eba356249ada 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2247,16 +2247,18 @@ mt7530_setup(struct dsa_switch *ds) return ret; /* Setup port 5 */ - priv->p5_intf_sel = P5_DISABLED; - interface = PHY_INTERFACE_MODE_NA; - if (!dsa_is_unused_port(ds, 5)) { + /* Set the interface selection of port 5 to GMAC5 when it's used + * as a CPU port or a user port. Let phylink handle the rest. + */ priv->p5_intf_sel = P5_INTF_SEL_GMAC5; - ret = of_get_phy_mode(dsa_to_port(ds, 5)->dn, &interface); - if (ret && ret != -ENODEV) - return ret; } else { - /* Scan the ethernet nodes. look for GMAC1, lookup used phy */ + /* Scan the ethernet nodes. Look for GMAC1, lookup the used phy. + * Determine if phy muxing is defined and which phy to mux. + */ + priv->p5_intf_sel = P5_DISABLED; + interface = PHY_INTERFACE_MODE_NA; + for_each_child_of_node(dn, mac_np) { if (!of_device_is_compatible(mac_np, "mediatek,eth-mac")) @@ -2287,6 +2289,8 @@ mt7530_setup(struct dsa_switch *ds) of_node_put(phy_node); break; } + + mt7530_setup_port5(ds, interface); } #ifdef CONFIG_GPIOLIB @@ -2297,8 +2301,6 @@ mt7530_setup(struct dsa_switch *ds) } #endif /* CONFIG_GPIOLIB */ - mt7530_setup_port5(ds, interface); - /* Flush the FDB table */ ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); if (ret < 0) From patchwork Sun Mar 26 14:08:14 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: 13188087 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 C6BBAC74A5B for ; Sun, 26 Mar 2023 14:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OZg7tvfajeNq18GFXC3qap3a+zEsuUc1lJRtB/LOjbQ=; b=GOTBhRqD6iIrOX ZZxyQx+himTzzPKaDweT+dwEURYXH7R+cfx2m1zeuIVM4JLL8MWnumAO2KBN3GWzQzY3lRM2sG0f0 uht46RHWwpG48ZLsOqMCrI3EtMa56H2b5ubpRODWd6zNDYJSvia6u9Je8isZ8TTC14jVgfw6cuuSZ rZHkJ/67UsQ4EBDheUjkFDOB99lEzqmWx1/pxaKGpxp/oKbXJvHSKgdquBWwaFdYQU8IzyYqESMmw DBPv9u4DbbD3Dx467fTeLElRhBFxCZcVTxiO4OONK0xYZm6+HJuLsj/y/uZiIlNOGYtHT9R6Vvy/m 9jPuw5FffHhx1fxAFGqQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3N-008Vct-2O; Sun, 26 Mar 2023 14:09:01 +0000 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgR34-008VVj-0y; Sun, 26 Mar 2023 14:08:43 +0000 Received: by mail-qv1-xf34.google.com with SMTP id oe8so5101993qvb.6; Sun, 26 Mar 2023 07:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679839721; 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=OZg7tvfajeNq18GFXC3qap3a+zEsuUc1lJRtB/LOjbQ=; b=kue9NahdmEFNFyi9Z9Kz+d6ev+kVXTNIPGO4kEw4t5gZOePO6QCbTzsp4J2nifJLua IvVE35jxat4ieYUrXcrzHb4x5W8p21TysgFzvp0p3/vYkBbV5xwuumCEx5OpRm2qmQtR +3IWUiRLB2cZp6IJJU6nDHArLhTbp/oIdO32Y0dDpSr8oFTBKDLmLF3dKLFNAnblnK5E 4Wr86j1QaZ147zL0eak8zzxON0GVY/gePSBwTsdoQFwVkQfYDidKNTZOixQfy+FyO8aW AJ8VdyTPDzdGSbVFJZL7iWEcjrMXBhsbSF0B9Uw9ZkNCWVH6GG9dy31Dl3335S/Y7vM8 NuzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679839721; 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=OZg7tvfajeNq18GFXC3qap3a+zEsuUc1lJRtB/LOjbQ=; b=bRF8JLL2PwOYayEGHafxY+a087MjM0VDl3voP717LPEyHHTxPc3NZubgL9HsZwnFIh zKV5lkn0WrXGAjP7fyClWlyi3XWWWvdBb5eHDMjI1zdObyOkdKOulJfXPJ2l3jeL+TVA e8PPUQerHVYB8GQVbJfn1VFVgh7+AmR5XddiUNKZQPDuMWSiXZr/KklpArYRwQKS22e9 w+LLPtzut+7jtnEMaPaejxpy4u8St71VvOrp0CU95B2Y8CtgnXy/65NGtNn7/oPns80G c+oAVVJ1de3hbwdNFcr3ZIKpdUEo3BuA2bEVZ4f/xaRAtfm5EpeTaqH0NCT6Ew0bEN9I D79A== X-Gm-Message-State: AAQBX9fkffAoTBJfBDTo4T2KCgIYFvG+9Od/e4vXFA4gWtduLfyDTxA1 JdPyTEB7r77bsFJ2bjr0wuI= X-Google-Smtp-Source: AKy350bUQGpng0t7Er8DLfWm+MeX5EgNvC3Zf1IA9OKQCjTVHq37FERAld7067znB0Xsj5mlftsQqw== X-Received: by 2002:a05:6214:e66:b0:583:8e58:6c0f with SMTP id jz6-20020a0562140e6600b005838e586c0fmr13020778qvb.40.1679839721008; Sun, 26 Mar 2023 07:08:41 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id j5-20020a0ce6a5000000b005dd8b93458esm2212220qvn.38.2023.03.26.07.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 07:08:40 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?q?Ren=C3=A9_van_Dorst?= Subject: [PATCH net 3/7] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled Date: Sun, 26 Mar 2023 17:08:14 +0300 Message-Id: <20230326140818.246575-4-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230326140818.246575-1-arinc.unal@arinc9.com> References: <20230326140818.246575-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_070842_344251_C93C298B X-CRM114-Status: GOOD ( 11.98 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Landen Chao , Ilya Lipnitskiy , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , Russell King , linux-mediatek@lists.infradead.org, erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL There's no need to run all the code on mt7530_setup_port5() if port 5 is disabled. Run mt7530_setup_port5() if priv->p5_intf_sel is not P5_DISABLED and remove the P5_DISABLED case from mt7530_setup_port5(). Stop initialising the interface variable as the remaining cases will always call mt7530_setup_port5() with it initialised. Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index eba356249ada..6d33c1050458 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -949,9 +949,6 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) /* MT7530_P5_MODE_GMAC: P5 -> External phy or 2nd GMAC */ val &= ~MHWTRAP_P5_DIS; break; - case P5_DISABLED: - interface = PHY_INTERFACE_MODE_NA; - break; default: dev_err(ds->dev, "Unsupported p5_intf_sel %d\n", priv->p5_intf_sel); @@ -2257,7 +2254,6 @@ mt7530_setup(struct dsa_switch *ds) * Determine if phy muxing is defined and which phy to mux. */ priv->p5_intf_sel = P5_DISABLED; - interface = PHY_INTERFACE_MODE_NA; for_each_child_of_node(dn, mac_np) { if (!of_device_is_compatible(mac_np, @@ -2290,7 +2286,8 @@ mt7530_setup(struct dsa_switch *ds) break; } - mt7530_setup_port5(ds, interface); + if (priv->p5_intf_sel != P5_DISABLED) + mt7530_setup_port5(ds, interface); } #ifdef CONFIG_GPIOLIB From patchwork Sun Mar 26 14:08:15 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: 13188088 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 15FC8C6FD1C for ; Sun, 26 Mar 2023 14:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gZ3M3RaLFnNGnHTnAZjnH0dZMMcYJsuKybc/E0bZ/Sg=; b=umefeAsrrb64xD hblu40u5/24Llp+M10y8Do4a+c2IZec5Bf8UJmBMwbAymxYOyE71riokkJ0aU3tcrYz9L6R4SgxLJ D+254gNGk4mY+FWD2LSrAbblRBHcR0UAGZfs2xaPFekNO1mn/xDle3wTfSMeb6t3+wbEIMLtKtB+q /LO937/S6jmDCIkqgzlGjzDzFQKBqTBMprsBW7jegiuue1wUk3V/A4S3SYPH5uTmyfajdJ3YXcZwV Rey16J94tLug0wtBN8hp2pRhNMbFgUg/+hDNJCc2acjIpPQceA4Njs97JJZvybLi/ITWWY8vJLjab 5BUfsySwJXr/qPM3tpIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3W-008Vh3-34; Sun, 26 Mar 2023 14:09:10 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgR39-008VXG-0M; Sun, 26 Mar 2023 14:08:48 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id 31so5166223qvc.1; Sun, 26 Mar 2023 07:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679839726; 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=gZ3M3RaLFnNGnHTnAZjnH0dZMMcYJsuKybc/E0bZ/Sg=; b=PeCR9X86QsaVx20aY4cZ/N/U/BGXc9v0DseOfWum4DxYo6HDHO24fXFQLN385sn7Ak ZnG+jG5QCzkpJ5OEPA4GGNujEszVt6QCOLJqDleCWpkO2MvcSaSYN9J7THCkRyhj7dy9 P7Su8HM8g/fddSiIMePJNUY8gHW02b2wpKHcIcEb+FKDaXzhdb0AdbacaM/cIeruVxsm CZu38ZsgmVurt3yKyYDFLeRrUh8iHltb17BOTd27+2wzzJfAgtws7/vAybMOAgcnFh4Z bVXqgEIdaM2bEl5swVmeZPpepIvamUtvQXclBqIfn2V7fJmLVvHsibGC3GOAiXlzSqE0 aAeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679839726; 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=gZ3M3RaLFnNGnHTnAZjnH0dZMMcYJsuKybc/E0bZ/Sg=; b=ZT2rCwmYwcGvInKaZ8L/iouW6ETer5NvMSODSvzMrjty0ByOj7mQOkWmqKq5l8gMgb XxYyBq/G/1B3Fm5Rm1WPf5uGmNlkt9N/g2Et+NafXm+GogUBww7oJCQzH5c7kLKZM9Nb 7h0Dl971t99RpVtYbFnwTaKtoVAAW9LaksP8rgDIoBE4I8TRsXKhfQzoOkjTVz7yjGGz RSjLgW/Zo5aHLuquiK8cwvv/v7h3gYd91hycr1ekwHXwK5zyoOPQscY5kdw9OdxtXiik XhqHmXB4fXJL4zNPMi8eyBggelI8x3BADWz4urOLlLUH/aUiR6+Owe/Uwwz5KmlATp0A 5grA== X-Gm-Message-State: AAQBX9dy+/pwA7enW1Ze44Mji895QqUMTaDazBNsfU2L0muASyyLZoRK xPbqgscT9h92EPbqrbUVOSg= X-Google-Smtp-Source: AKy350bmLDXXIZMwWIHi9YWMFSuPyoUC5Stl7CpvUKVBBwX6hYz/oXixnBj/Ni0i+8VU4sVOQf3erQ== X-Received: by 2002:a05:6214:f67:b0:5aa:d98a:8ace with SMTP id iy7-20020a0562140f6700b005aad98a8acemr17506531qvb.19.1679839725854; Sun, 26 Mar 2023 07:08:45 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id j5-20020a0ce6a5000000b005dd8b93458esm2212220qvn.38.2023.03.26.07.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 07:08:45 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?q?Ren=C3=A9_van_Dorst?= Subject: [PATCH net 4/7] net: dsa: mt7530: set both CPU port interfaces to PHY_INTERFACE_MODE_NA Date: Sun, 26 Mar 2023 17:08:15 +0300 Message-Id: <20230326140818.246575-5-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230326140818.246575-1-arinc.unal@arinc9.com> References: <20230326140818.246575-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_070847_146916_3BDB84EC X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Landen Chao , Ilya Lipnitskiy , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , Russell King , linux-mediatek@lists.infradead.org, erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL Set interfaces of both CPU ports to PHY_INTERFACE_MODE_NA. Either phylink or mt7530_setup_port5() on mt7530_setup() will handle the rest. This is already being done for port 6, do it for port 5 as well. Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 6d33c1050458..3deebdcfeedf 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2203,14 +2203,18 @@ mt7530_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7530_TRGMII_RD(i), RD_TAP_MASK, RD_TAP(16)); + /* Let phylink decide the interface later. If port 5 is used for phy + * muxing, its interface will be handled without involving phylink. + */ + priv->p5_interface = PHY_INTERFACE_MODE_NA; + priv->p6_interface = PHY_INTERFACE_MODE_NA; + /* Enable port 6 */ val = mt7530_read(priv, MT7530_MHWTRAP); val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; val |= MHWTRAP_MANUAL; mt7530_write(priv, MT7530_MHWTRAP, val); - priv->p6_interface = PHY_INTERFACE_MODE_NA; - /* Enable and reset MIB counters */ mt7530_mib_reset(ds); From patchwork Sun Mar 26 14:08:16 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: 13188089 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 D3252C6FD1C for ; Sun, 26 Mar 2023 14:09:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FE6q6p+dFTrGAKyKj7RnvQhsdIZfEftFuQ5+sKNAZxc=; b=q+lXI3ZX1ugkiO KZztC0UBMT5jZJdRgEspjReld4d3YHy3Rnqf3bb/aAu3d8L3R5TiGhjOZ+P6KgzoKdl3RUENEQ9tG j3NxzUl+yRBaHTNWnDnJ3Ft8nEZlVN1SAzUDZZEywJBr/mKWvBbqHcmK/5+0jgKXHmqtjod4DpEr9 Ecu+THC80Y/KmHHOhOy71zLfRUuliT6SjP/5ZANgJdqON/ak1N/CThpbExtec1z5URGue5i5pjQNW wMMGk00lMtl4f0El+rDvc8j/mSXU7EnETr+dOGiffY3QyW+/z5B2SF1Fh+yMVkI4EP++9XxCfavU0 hR4omUU4z7RjKkcaBDEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3h-008Vll-0s; Sun, 26 Mar 2023 14:09:21 +0000 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3D-008VUT-0W; Sun, 26 Mar 2023 14:08:52 +0000 Received: by mail-qv1-xf2a.google.com with SMTP id jl13so5053893qvb.10; Sun, 26 Mar 2023 07:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679839730; 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=FE6q6p+dFTrGAKyKj7RnvQhsdIZfEftFuQ5+sKNAZxc=; b=D76MU+xeNJzZVMvqN9aEJ1ImGKcrDzJVZlZFme9Q3QdJoQ9B/u7bQc2xY9xU4pKoT1 tb7z1KGlHTGabEi5HyvKL8Br8kcZSf+lUmoyZg6wST2TKSwEC4kmk+/L5CtVekjC1imm IUtcob0hiVfbBhjPkFtS9NHg0mlLRyfeyJ6tWab6Qw9U0nDQZSsLQMtu3ABd3+Rc1iZ0 x0p9R9twv0stKHFHlOuGHkolzkdxQFW+G8azSKEMkD9srJqFvgj6Xzna9Z1zVzPNyoZX W5gb5hvef0MtcoE9/8m8O3/ZWF1CixamuO1WSS3fFlmnTzC9N9kzCatkBY66YwFUy+Hu O3Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679839730; 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=FE6q6p+dFTrGAKyKj7RnvQhsdIZfEftFuQ5+sKNAZxc=; b=Pr7khd1OEkXMdHTFQHvOhSMXpz44KFUTZneYFLjut8gayzA4iBbB0J0Sn9vQb7VPpT ZrVGd8SQFAm4J1fXAuI+JvK178HJLe0vWf450pI/z4DAksu4fRo2NtA5TBqkq/EBhmO3 NjTLI8FlYIvhUMn+CC/H9o2ja+YrLrpvqEY5tYccP07cSJ07P38mw+iKPlz9y2KwG38k Zbm2isIkOLwL5WLjnFsNlDfaqcVjaSomPOHeRRPo+b/vvI1Tf0mwqjKBHVVw2v0NNd3M +ZQDbGqD5p427vLEDF6nL/7iW5RV4ji4WjUHpioRzw/cNSxLnqCyHD0gB3U5EuujvnLu VGKA== X-Gm-Message-State: AAQBX9dy2fZQXB7txjebGaAGLycKTMACFlkWbYdwNVZqt5BLG6R8Syr9 MlZnbdxblGEbC+JwdpnsOSo= X-Google-Smtp-Source: AKy350ZXYJBESOoxkQUOuwbRFbnXJKrJen8y5qornJklJSyCE/pS7djMghLwkglOYXW7p2HrKG/5HQ== X-Received: by 2002:a05:6214:29e4:b0:5a9:ed32:1765 with SMTP id jv4-20020a05621429e400b005a9ed321765mr14734612qvb.23.1679839730704; Sun, 26 Mar 2023 07:08:50 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id j5-20020a0ce6a5000000b005dd8b93458esm2212220qvn.38.2023.03.26.07.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 07:08:50 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?q?Ren=C3=A9_van_Dorst?= Subject: [PATCH net 5/7] net: dsa: mt7530: set up port 5 before CPU ports are enabled Date: Sun, 26 Mar 2023 17:08:16 +0300 Message-Id: <20230326140818.246575-6-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230326140818.246575-1-arinc.unal@arinc9.com> References: <20230326140818.246575-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_070851_203132_179DE262 X-CRM114-Status: GOOD ( 15.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Landen Chao , Ilya Lipnitskiy , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , Russell King , linux-mediatek@lists.infradead.org, erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL Set priv->p5_intf_sel before the CPU ports are enabled. This makes sure the 'if (priv->p5_intf_sel != P5_DISABLED)' check on mt753x_phylink_mac_config() runs with priv->p5_intf_sel initialised. Set up port 5 for phy muxing right after priv->p5_interface is set to PHY_INTERFACE_MODE_NA. Fixes: 38f790a80560 ("net: dsa: mt7530: Add support for port 5") Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 76 ++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 3deebdcfeedf..2397d63cec29 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2209,44 +2209,6 @@ mt7530_setup(struct dsa_switch *ds) priv->p5_interface = PHY_INTERFACE_MODE_NA; priv->p6_interface = PHY_INTERFACE_MODE_NA; - /* Enable port 6 */ - val = mt7530_read(priv, MT7530_MHWTRAP); - val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; - val |= MHWTRAP_MANUAL; - mt7530_write(priv, MT7530_MHWTRAP, val); - - /* Enable and reset MIB counters */ - mt7530_mib_reset(ds); - - for (i = 0; i < MT7530_NUM_PORTS; i++) { - /* Disable forwarding by default on all ports */ - mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, - PCR_MATRIX_CLR); - - /* Disable learning by default on all ports */ - mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); - - if (dsa_is_cpu_port(ds, i)) { - ret = mt753x_cpu_port_enable(ds, i); - if (ret) - return ret; - } else { - mt7530_port_disable(ds, i); - - /* Set default PVID to 0 on all user ports */ - mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, - G0_PORT_VID_DEF); - } - /* Enable consistent egress tag */ - mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, - PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); - } - - /* Setup VLAN ID 0 for VLAN-unaware bridges */ - ret = mt7530_setup_vlan0(priv); - if (ret) - return ret; - /* Setup port 5 */ if (!dsa_is_unused_port(ds, 5)) { /* Set the interface selection of port 5 to GMAC5 when it's used @@ -2294,6 +2256,44 @@ mt7530_setup(struct dsa_switch *ds) mt7530_setup_port5(ds, interface); } + /* Enable port 6 */ + val = mt7530_read(priv, MT7530_MHWTRAP); + val &= ~MHWTRAP_P6_DIS & ~MHWTRAP_PHY_ACCESS; + val |= MHWTRAP_MANUAL; + mt7530_write(priv, MT7530_MHWTRAP, val); + + /* Enable and reset MIB counters */ + mt7530_mib_reset(ds); + + for (i = 0; i < MT7530_NUM_PORTS; i++) { + /* Disable forwarding by default on all ports */ + mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, + PCR_MATRIX_CLR); + + /* Disable learning by default on all ports */ + mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); + + if (dsa_is_cpu_port(ds, i)) { + ret = mt753x_cpu_port_enable(ds, i); + if (ret) + return ret; + } else { + mt7530_port_disable(ds, i); + + /* Set default PVID to 0 on all user ports */ + mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, + G0_PORT_VID_DEF); + } + /* Enable consistent egress tag */ + mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, + PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); + } + + /* Setup VLAN ID 0 for VLAN-unaware bridges */ + ret = mt7530_setup_vlan0(priv); + if (ret) + return ret; + #ifdef CONFIG_GPIOLIB if (of_property_read_bool(priv->dev->of_node, "gpio-controller")) { ret = mt7530_setup_gpio(priv); From patchwork Sun Mar 26 14:08:17 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: 13188090 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 BA1A7C6FD1C for ; Sun, 26 Mar 2023 14:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l2Yyxz9FOXIN+XxKXysP1ZnBuTmwMg6crObSsecZNr8=; b=pXEXFEJjBIsv1Z MLLCo+mP6+2sZjlNX+/18eULJhQlYRY4PnS8t6lmFtsG31swEuOY05WpmBs7Z3ulc4ldckfsuv0E6 12fYZqVrtGtxbv6tjBlRlgPJFxABf7jAgnBVno6LpXn8nyNrgG/agDKMPwoUOawN3iR6AbrPn2zS3 iQOmtBqC+etoqVJ2dFdL+5xbcEPp2jHHj7gq0HXUTkcIXGcwGKPla5HcPKuV+yrTedNWrOHaH7FoF xCMPV6BLejmjSf/Y0Np3+nka8xGRT0KalJIVN+YIFrOYqNsG8Re9XKhXZBzNrYArW55C3EmgJdJYa XIAByQY4tf9I3kzG2eqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3q-008VrI-1A; Sun, 26 Mar 2023 14:09:30 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3I-008VXG-0K; Sun, 26 Mar 2023 14:08:57 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id 31so5166430qvc.1; Sun, 26 Mar 2023 07:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679839735; 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=l2Yyxz9FOXIN+XxKXysP1ZnBuTmwMg6crObSsecZNr8=; b=NI8IIylXLN/RgzXXWYF7gu7Y136mGEoIWcy2BmwQXde1fXTgnW85aakyi2zYxJvTyb Vba+bXe6E09H/83NDOXX2JN/fSi0a2BP1xX5+FkEygF3z4Fmn891UFnE98kezsNnENwt KcNY+pC2skaiTOzjjzBbKhwTUao1aGM5MCC9DhfdCfMRSFfFmKE3/gRFnBAQy6V6Epuf /oRDgs9UNYCJVwcMWBpwlwCL1PJt0T15cgWtkN1eYaRXiIjIxrSeowGNfQzedRtMQHYQ OqS3fhzbhKPaUtQg6NtU19Sl77qMGDA3K+4bdcITqZ2IFMXEkgbQKXL68JeBCWtYKf81 oZUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679839735; 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=l2Yyxz9FOXIN+XxKXysP1ZnBuTmwMg6crObSsecZNr8=; b=ErLqCVkrT8h1yso8nyhqIDYRwu9KkOsxVX9v6muYQL/pTDG149FwqPCFsati+yUDgt cKCtHdsFCGbReT2t4YeceiWtn2ZShm/wtAFvi2FzonfIAmN8S9TydGwmN7XrIzxPn7jV Hb/MBf/YCuI1LRsMfHRiDWn0MspdieJb/yQz7cR8uN1GElcLC0Mo7DCPCUmoSjDFvRg7 eune/XkzwHZ8I5xfnk5jTt4Z+thMjJPhaq2alTPcou5IAOSZhoIcbQg0T5GHdPmvd3qx Wy7sJZm+HFcZ744Upd9QAS0fV/tNt1CkbMJkfcWaT9QQY2U8FF+p9yrLvilH/AMrm2/q UbFA== X-Gm-Message-State: AAQBX9c4z6fo7y7HzHUoriikf4BWly/OQ5mSVvzjbbxoupa6E4fHMuH5 EPGKi2iOxPu3BMqXnxHlHx0= X-Google-Smtp-Source: AKy350YkM0qBbgWrY++La63ZQ5ay+0ryc/egnIbwxo+Lx1fiSX0CpeFm7wpYaKIwrXkCFUdAnjYgxw== X-Received: by 2002:a05:6214:48e:b0:5c2:7d8d:ed0f with SMTP id pt14-20020a056214048e00b005c27d8ded0fmr16735897qvb.12.1679839735529; Sun, 26 Mar 2023 07:08:55 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id j5-20020a0ce6a5000000b005dd8b93458esm2212220qvn.38.2023.03.26.07.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 07:08:55 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?q?Ren=C3=A9_van_Dorst?= Subject: [PATCH net 6/7] net: dsa: mt7530: call port 6 setup from mt7530_mac_config() Date: Sun, 26 Mar 2023 17:08:17 +0300 Message-Id: <20230326140818.246575-7-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230326140818.246575-1-arinc.unal@arinc9.com> References: <20230326140818.246575-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_070856_139811_7C39CCA2 X-CRM114-Status: GOOD ( 15.81 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Landen Chao , Ilya Lipnitskiy , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , Russell King , linux-mediatek@lists.infradead.org, erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL mt7530_pad_clk_setup() is called if port 6 is enabled. It used to do more things than setting up port 6. That part was moved to more appropriate locations, mt7530_setup() and mt7530_pll_setup(). Now that all it does is set up port 6, rename it to mt7530_setup_port6(), and move it to a more appropriate location, under mt7530_mac_config(). Leave an empty mt7530_pad_clk_setup() to satisfy the pad_setup function pointer. This is the call path for setting up the ports before: mt753x_phylink_mac_config() -> mt753x_mac_config() -> mt7530_mac_config() -> mt7530_setup_port5() -> mt753x_pad_setup() -> mt7530_pad_clk_setup() This is after: mt753x_phylink_mac_config() -> mt753x_mac_config() -> mt7530_mac_config() -> mt7530_setup_port5() -> mt7530_setup_port6() Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch") Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 2397d63cec29..8d49803f7522 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -421,7 +421,7 @@ static void mt7530_pll_setup(struct mt7530_priv *priv) /* Setup port 6 interface mode and TRGMII TX circuit */ static int -mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) +mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) { struct mt7530_priv *priv = ds->priv; u32 ncpo1, ssc_delta, trgint, xtal; @@ -493,6 +493,12 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) return 0; } +static int +mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) +{ + return 0; +} + static bool mt7531_dual_sgmii_supported(struct mt7530_priv *priv) { u32 val; @@ -2523,12 +2529,15 @@ mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) { struct mt7530_priv *priv = ds->priv; + int ret; - /* Only need to setup port5. */ - if (port != 5) - return 0; - - mt7530_setup_port5(priv->ds, interface); + if (port == 5) { + mt7530_setup_port5(priv->ds, interface); + } else if (port == 6) { + ret = mt7530_setup_port6(priv->ds, interface); + if (ret) + return ret; + } return 0; } From patchwork Sun Mar 26 14:08:18 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: 13188091 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 B3AB9C6FD1C for ; Sun, 26 Mar 2023 14:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=++RQ2Lt1GvGc7/uLgZw+p9gJX3oBQ8p2zIe2CsZw+Bg=; b=ocEIPmRQXTajpk R1LuplU7ONH39ZKmpOqsrdUjTVjxtB2phFnHEKz5sJqebOz2gE5AsV78M7D/bGZNDXVMGaTMvkpUe Njs84GHs0XHaHUC4oT9gvbYLDyKW5HvplTs3Iudquw4DHRcbjLpbrUM45hmwyvPfvCmUBISvvRtBK XAlLpz0R4QWnc9xkpOet9URwW+e+mShbWzqTSqPJCnX9CAs40TTNpONWTvE2AHsUw2UeXzrdS9Uxl eS7EscqHCRBn4/3uJ4eIiEU285W/yxsjSrrcYpJCTfNHI9YVUtdSCvAuGNCvvM7LT1Gu5p1AG9DFJ AREbSAe9yz4IZQqp3MJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgR42-008VzO-0a; Sun, 26 Mar 2023 14:09:42 +0000 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pgR3M-008VUT-2m; Sun, 26 Mar 2023 14:09:02 +0000 Received: by mail-qv1-xf2a.google.com with SMTP id jl13so5054103qvb.10; Sun, 26 Mar 2023 07:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679839740; 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=++RQ2Lt1GvGc7/uLgZw+p9gJX3oBQ8p2zIe2CsZw+Bg=; b=crLklXdx+c3qzQl0/siZYZrbmd8rJGQwNYsgtDOrzz9wBJtgI3dbjLqUiqE4W1nsJa oUa3jd3I8wyMpYoj6CRKEx1dfujwDPqN2YO0uSmIoeINKG3UJvCJmE/5udph8vg+qT5i nIF9y7J11s1tEpIaRatXwZE5h7Zt52lxT5kZ3wG3w/rLCXcO/B6Lz7r9n4kpbub36dn7 BpFeyKwDFjpzzo73edazP3RzhTsB0N6l/LubJkyRoqsQtVZwAu8PN3UZ8GjeD57iaTDj oy4NbThDXJ/QHhoMTAamRa+VnNWIgpZjsSYK0H8X+wSP/jKZp+1LWcUviEz69KAfC8t9 Z3uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679839740; 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=++RQ2Lt1GvGc7/uLgZw+p9gJX3oBQ8p2zIe2CsZw+Bg=; b=ssYPNaIdAvycrEry/wOsz8Sb4ArC2QZlDtRXSQqXu7BLKuOn8+kpm2OHeFXOwOPERI HwIdBp7TSr8PUIN9TsshnSuEdDZhSdbHA6YFMWuhm8+CSG9x1eJL0XgecKbo1To3bTqQ 3wr+RJJRiiaNdUidh5S2n2j5bikMqukXLQ6sm0ow1WQ2FI7lgV2fCGoOWYbci53jn5kP 2suCiSO1D5M9Tx6A9pXehCOb2/HqBd7rSFqANtP3GDZoo5l/nYZ8w+jYWNSS3gNlz5/4 RG12tCwIc2/rOXFtI4uEfnFZ4yXwsRZPwEjIA8W73jChCKswkySdkUSGmyCiqo2ihJuE 5ECg== X-Gm-Message-State: AAQBX9eZFO3F2Ll7sBB0QtYYKOp7u0Rtv4AlzJ/402W2/CBOtxWDiipR FBrJWVtgK9Ch2QLMKLN9wps= X-Google-Smtp-Source: AKy350ak7OnYrWTDxsSk1iFva/JE1J53KGMNkWYWKwgU8QXYnDHNNbo6uwP+El/Ra8KxTVjTQHrT/A== X-Received: by 2002:ad4:5d66:0:b0:56e:9da4:82ff with SMTP id fn6-20020ad45d66000000b0056e9da482ffmr14059429qvb.50.1679839740380; Sun, 26 Mar 2023 07:09:00 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id j5-20020a0ce6a5000000b005dd8b93458esm2212220qvn.38.2023.03.26.07.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Mar 2023 07:09:00 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?utf-8?q?Ren=C3=A9_van_Dorst?= Subject: [PATCH net 7/7] net: dsa: mt7530: remove pad_setup function pointer Date: Sun, 26 Mar 2023 17:08:18 +0300 Message-Id: <20230326140818.246575-8-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230326140818.246575-1-arinc.unal@arinc9.com> References: <20230326140818.246575-1-arinc.unal@arinc9.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_070900_901006_A2B34090 X-CRM114-Status: GOOD ( 15.82 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Landen Chao , Ilya Lipnitskiy , =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= , netdev@vger.kernel.org, Richard van Schagen , linux-kernel@vger.kernel.org, Richard van Schagen , Russell King , linux-mediatek@lists.infradead.org, erkin.bozoglu@xeront.com, linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Arınç ÜNAL The pad_setup function pointer was introduced with 88bdef8be9f6 ("net: dsa: mt7530: Extend device data ready for adding a new hardware"). It was being used to set up the core clock and port 6 of the MT7530 switch, and pll of the MT7531 switch. All of these were moved to more appropriate locations so this function pointer hasn't got a use anymore. Remove it. Fixes: 88bdef8be9f6 ("net: dsa: mt7530: Extend device data ready for adding a new hardware") Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 30 ++---------------------------- drivers/net/dsa/mt7530.h | 3 --- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 8d49803f7522..83dcd888f82b 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -493,12 +493,6 @@ mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface) return 0; } -static int -mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) -{ - return 0; -} - static bool mt7531_dual_sgmii_supported(struct mt7530_priv *priv) { u32 val; @@ -508,12 +502,6 @@ static bool mt7531_dual_sgmii_supported(struct mt7530_priv *priv) return (val & PAD_DUAL_SGMII_EN) != 0; } -static int -mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface) -{ - return 0; -} - static void mt7531_pll_setup(struct mt7530_priv *priv) { @@ -2516,14 +2504,6 @@ static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port, } } -static int -mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) -{ - struct mt7530_priv *priv = ds->priv; - - return priv->info->pad_setup(ds, state->interface); -} - static int mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface) @@ -2798,8 +2778,6 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, if (priv->p6_interface == state->interface) break; - mt753x_pad_setup(ds, state); - if (mt753x_mac_config(ds, port, mode, state) < 0) goto unsupported; @@ -3215,7 +3193,6 @@ static const struct mt753x_info mt753x_table[] = { .phy_write_c22 = mt7530_phy_write_c22, .phy_read_c45 = mt7530_phy_read_c45, .phy_write_c45 = mt7530_phy_write_c45, - .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, .mac_port_config = mt7530_mac_config, }, @@ -3227,7 +3204,6 @@ static const struct mt753x_info mt753x_table[] = { .phy_write_c22 = mt7530_phy_write_c22, .phy_read_c45 = mt7530_phy_read_c45, .phy_write_c45 = mt7530_phy_write_c45, - .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, .mac_port_config = mt7530_mac_config, }, @@ -3239,7 +3215,6 @@ static const struct mt753x_info mt753x_table[] = { .phy_write_c22 = mt7531_ind_c22_phy_write, .phy_read_c45 = mt7531_ind_c45_phy_read, .phy_write_c45 = mt7531_ind_c45_phy_write, - .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, .mac_port_config = mt7531_mac_config, @@ -3297,9 +3272,8 @@ mt7530_probe(struct mdio_device *mdiodev) /* Sanity check if these required device operations are filled * properly. */ - if (!priv->info->sw_setup || !priv->info->pad_setup || - !priv->info->phy_read_c22 || !priv->info->phy_write_c22 || - !priv->info->mac_port_get_caps || + if (!priv->info->sw_setup || !priv->info->phy_read_c22 || + !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps || !priv->info->mac_port_config) return -EINVAL; diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index 6b2fc6290ea8..fd050d3110c6 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -754,8 +754,6 @@ struct mt753x_pcs { * @phy_write_c22: Holding the way writing PHY port using C22 * @phy_read_c45: Holding the way reading PHY port using C45 * @phy_write_c45: Holding the way writing PHY port using C45 - * @pad_setup: Holding the way setting up the bus pad for a certain - * MAC port * @phy_mode_supported: Check if the PHY type is being supported on a certain * port * @mac_port_validate: Holding the way to set addition validate type for a @@ -776,7 +774,6 @@ struct mt753x_info { int regnum); int (*phy_write_c45)(struct mt7530_priv *priv, int port, int devad, int regnum, u16 val); - int (*pad_setup)(struct dsa_switch *ds, phy_interface_t interface); int (*cpu_port_config)(struct dsa_switch *ds, int port); void (*mac_port_get_caps)(struct dsa_switch *ds, int port, struct phylink_config *config);