Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2852890rwd; Mon, 22 May 2023 05:27:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LPn4pBkN+10eih/u5tWw/gwbxIfid469i6qNfYxXK/zc5V4vAZJ+A9Z58OK0x6GrCzTTi X-Received: by 2002:a05:6a20:7f8a:b0:f4:d4a8:9c82 with SMTP id d10-20020a056a207f8a00b000f4d4a89c82mr10764644pzj.47.1684758421964; Mon, 22 May 2023 05:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684758421; cv=none; d=google.com; s=arc-20160816; b=HTnKPq/XN0sexZ4sTRrYWP5BIY48eHgVMyBcI817Qvcy6dDCdNaQS3+KzkAz/t3AFk kx3JL0unfa9jHECFeAZK1dB9YVqGESuE7zHNJxLYWOYvROrnLzxrV7+0+YSPXgiJIq25 +uj8qkEGEsRU3F7+sqH0Us2dEd/KDU/eTjIHQuN0Phsopvx8vmKBNnEP/HQSCKtHDrb8 U2IG9pPXX19oEK8YvSGrwGeZq0+f0JgO+I8yc17aCANSKbzNFBSmvpMDoBONIG0nE9VX VCDd3e6mN7fr/8cark8vNlTw+QINmzLea/7orQQSAaNnSZ90/1xYXjW6yvtvJmuz+c/C FJ3g== 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=wn2mhEGH9uSsWYt0IDE04ECLf6CmZ7rlTUGMQ0klVZI=; b=qLnMwabvzNqzKueFjnBo/NFb7IakMWdkdArVMSQgU6Stgj8OREQU7Hm3L/12UwAnew hleOIwmKtwz4i9rVsUZfVlu/BVNEWdSaElh480PMqB+WJsZxy5ilDQQ0/gfG6BjTK0Fj 5mlLbcjESMk1uBRai3WwG63w5Tk+IG3aFqoLQw71zVkA7pI7+QM2vPWQF3nZSQXNtBxc LMnbfoF8nfEuRNlryLxijTpKn8cT89k1hH5TT/1GHtgB8S9vnGRE7Ckf3W+F6jPoIZxP p9P1wFEuR1uhFrKLe5UHVmdXuVPk748luNYHvoORiWTGpTGeD5WhJ5ekBFiVmAZdF8nj DoLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=grVTVpbb; 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 f5-20020a637545000000b005340955881asi4784022pgn.700.2023.05.22.05.26.48; Mon, 22 May 2023 05:27:01 -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=grVTVpbb; 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 S233894AbjEVMST (ORCPT + 99 others); Mon, 22 May 2023 08:18:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233758AbjEVMRj (ORCPT ); Mon, 22 May 2023 08:17:39 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9BBFE7B; Mon, 22 May 2023 05:16:29 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-969f90d71d4so899898366b.3; Mon, 22 May 2023 05:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684757767; x=1687349767; 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=wn2mhEGH9uSsWYt0IDE04ECLf6CmZ7rlTUGMQ0klVZI=; b=grVTVpbbAcn9i9tzer/Hhyb4oNJujAtO5z3JCzf25YBi1o17XTLsveA2xSkhm86GmL PfzVa/wiVvVYo70qik+FWTWUp58R1ANSICt/zHTdBA5bRiTZxk6/tn27aWfM/BJ+PKRF cfsdfLmuhcwxr+CaZgUju7xlg1HavSi9agaUVatCzMBMqyXXpbIuWCXLZjLh1/zs5xCy 9bqTLmKEjXE2bB18DrdvYsCAB4VVkU8KlCFbzXOqXDQKt7Sbf6xfDmOuLNDLvfbJHco/ FYhCluYVWAbRdHMXjetgEY5dqqaeQfxR6yjJG6UMMraor/qiFWozHyr8YU/lJZ2x4G3F 5loA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684757767; x=1687349767; 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=wn2mhEGH9uSsWYt0IDE04ECLf6CmZ7rlTUGMQ0klVZI=; b=aMbc1uLpMq38dZoY6ZlfafjbGbmciraetGX28LNtqnNODXYfnN1AISAEWJ2pZqyQLG b42eUoDZYb9izKEgx7LQC1ptJAKa4nC+CkwTHi9bw4RrnXyFYZ4zNkZ3TS//R4pOVSod DnZ83q486J++zMmcR40ZnCCU93f+4RtRNT6z1e22Pfmh4X6rUFQXUYWsgsyuFSpCvPeJ bV4/YQwcGu+6nrFDHzBmng4J342ecYk+j7viRoaHu2ry/fBqIwE2QT9bOvQ829hiQEy7 2Aoi/jrUFURdeqypE9to9ZxXRYM6k6DkNsiJgHgJgmr/E8ys7bVBtznBAlYYLybSgzr+ nRoQ== X-Gm-Message-State: AC+VfDxTkGCnm9q3r8FBOWaGHHvKJirNWCb0Xa8mvtOLL3zy6OOQVqOJ KUT80ie7H0yyrjeWCfMdd+k= X-Received: by 2002:a17:906:6a0d:b0:96a:9c44:86d9 with SMTP id qw13-20020a1709066a0d00b0096a9c4486d9mr10488875ejc.12.1684757766853; Mon, 22 May 2023 05:16:06 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 05:16:06 -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 07/30] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled Date: Mon, 22 May 2023 15:15:09 +0300 Message-Id: <20230522121532.86610-8-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 There's no need to run all the code on mt7530_setup_port5() if port 5 is disabled. The only case for calling mt7530_setup_port5() from mt7530_setup() is when PHY muxing is enabled. That is because port 5 is not defined as a port on the devicetree, therefore, it cannot be controlled by phylink. Because of this, run mt7530_setup_port5() if priv->p5_intf_sel is P5_INTF_SEL_PHY_P0 or P5_INTF_SEL_PHY_P4. 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. Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index b8f159afcd45..710c6622d648 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -929,9 +929,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); @@ -2279,8 +2276,6 @@ mt7530_setup(struct dsa_switch *ds) * Set priv->p5_intf_sel to the appropriate value if PHY muxing * is detected. */ - interface = PHY_INTERFACE_MODE_NA; - for_each_child_of_node(dn, mac_np) { if (!of_device_is_compatible(mac_np, "mediatek,eth-mac")) @@ -2312,7 +2307,9 @@ mt7530_setup(struct dsa_switch *ds) break; } - mt7530_setup_port5(ds, interface); + if (priv->p5_intf_sel == P5_INTF_SEL_PHY_P0 || + priv->p5_intf_sel == P5_INTF_SEL_PHY_P4) + mt7530_setup_port5(ds, interface); } #ifdef CONFIG_GPIOLIB -- 2.39.2