Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp525989qtg; Wed, 5 Apr 2023 13:41:53 -0700 (PDT) X-Google-Smtp-Source: AKy350bvy+7SojiBzDtUL48j8RCgvxalRuIyuIMkj8UGOfr2FRmx9KfPiqzoycRo55PZmqkn9wlq X-Received: by 2002:a17:906:d96c:b0:92f:d1ec:a7d7 with SMTP id rp12-20020a170906d96c00b0092fd1eca7d7mr3597025ejb.15.1680727312841; Wed, 05 Apr 2023 13:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680727312; cv=none; d=google.com; s=arc-20160816; b=Zn89USOOLQMxXDXBLh1V/YGhd4FpnOsH5mGLmOXlAnxrM9s/Z+3xX9DzEMlQZgLlre yME1R1WSA329sITw+tQeD6mRVhXfF+hHIRDiI3msdmfPfr+WosYelRRfRXzTKtwICh+N fb3j1n/u31UWElmSDZH7ggWI7N6qVjCJkz6/h893+CypvZzpIRCkBgdU3dWhOsT4nlrr VjXAIM7xVu0BvwCQCyrGeUHlBl0AHGx3c86/+9y7aHxWFo7A0XmgJYRaoFAUCqPFr8JZ 5uOd88JzdZaQiqGQ/x4fjAuH+E/RPU8WKcpqs+10FDqh6E4rUUWLQmngn2tfUpqEd7vR lPZA== 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=TL1ifXOj3OEH5mV418CX1uP5QyBqfV3oBYYgm4r26w8=; b=WBqMRD3bajbdUmSpxUqJgbdCOeldq5sZykBtICeHpjNx04dd2/2MK7qEp/aaKuxioO K+rSxlR8FlkuZ9FM6NuGeLdJei0iU22WzO32FHDcfOMCKsKTkDp7ex/DgaV/6StVrX7M CCm1hpwOEuupoohcACGJ6x1t7nxfEm6nHA9HaheljxjSH4xWdGn2n/u+Pa63e1mcgJlC 6v7DZZKAG+8EHJOmRAIMQ1l9NY7oD5dFxTE5vQjI57fiDapeWWRTmScA/doFNNkbbA9V HOj1frdgxZ2xOCQ7KWzP3/n/Ctux7PHqv+EmYcBTQA6GV/Zg3EjLv2ssKKXfB5zLb5Qp wdcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=otBFkFBI; 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 y17-20020a170906525100b0092f1d91787esi227773ejm.299.2023.04.05.13.41.26; Wed, 05 Apr 2023 13:41:52 -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=20210112 header.b=otBFkFBI; 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 S233953AbjDEUjX (ORCPT + 99 others); Wed, 5 Apr 2023 16:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232640AbjDEUjP (ORCPT ); Wed, 5 Apr 2023 16:39:15 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAF37768E; Wed, 5 Apr 2023 13:39:12 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id n9-20020a05600c4f8900b003f05f617f3cso3566206wmq.2; Wed, 05 Apr 2023 13:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680727151; 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=TL1ifXOj3OEH5mV418CX1uP5QyBqfV3oBYYgm4r26w8=; b=otBFkFBIeXE2wHUW2NbAADjRIHF+Q3/1CyWyDB0KCBi/bP20rCssC6krJAdujcBH0p vOr+fv+PvHyG2Lh3nHOO205ZyWI4KHjzqT7qsF3NzKvNhRR/N13+PZi6I92fRLV+HIkk NOQtYCDb/jQLRvUEn0+kwXuvwtc5KrH8csK6rRMtSiLHNVb4oFDd/W4dfwZz6ySfih6L 69xhweJmDTMYUUbhYyNiVONmz1b65R5rqaglAir2dBEdPXGc8HaACVDW8lbeidNEyFVt wpNX6ng2AIENabtgAzErMui85//Jr2AgfW1+iBZKRLjyqrByjXAijgkmXD+v1/qnf3z0 V/ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680727151; 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=TL1ifXOj3OEH5mV418CX1uP5QyBqfV3oBYYgm4r26w8=; b=qZwif7RQl8EeXpasrThLq/2Ky5pVf5v9u8gxKNPMQH7JXfkt950Wr1QxbSqQRKh7e7 LDkT6I/TtiPg2DenP0XwITS5JZBIad6S1podt8namHajoeFL1JpMU7/Y8Wsbax7qXVDL hr5ZLaGV0osf+dveOnok9l4Rrb/2dZlrRdWdr9K7WMu8rXnK3rV1vUmhTJXiobqzDW3d 52s8/tyXwwMYkVuyU58gluODIynBcCPInICnnFel1G9POzn++xsePa37ateOLUQ7ffVa fx90zjsk4oRyMpv56SgTN/XYCSrt/7SnvIXhp1qX/i5FLbfVSYBc+aCj1oiQY8i13Jat QUIw== X-Gm-Message-State: AAQBX9eh0NVJzhme7TuAJXWmCo5zNkjLiQMMJukGJjJBcqp5tZZjV1gV 8OdVXK3Gvv2g9FHK7GzglQI= X-Received: by 2002:a05:600c:198e:b0:3ed:ad05:5841 with SMTP id t14-20020a05600c198e00b003edad055841mr2488273wmq.17.1680727150993; Wed, 05 Apr 2023 13:39:10 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id p19-20020a05600c469300b003eda46d6792sm3259867wmo.32.2023.04.05.13.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 13:39:10 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= , 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?= , Ilya Lipnitskiy , Richard van Schagen , Richard van Schagen , Frank Wunderlich , 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: [RFC PATCH net-next 03/12] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled Date: Wed, 5 Apr 2023 23:38:50 +0300 Message-Id: <20230405203859.391267-4-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230405203859.391267-1-arinc.unal@arinc9.com> References: <20230405203859.391267-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=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a00aabe4987e..9ab2e128b564 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -943,9 +943,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); @@ -2299,7 +2296,6 @@ mt7530_setup(struct dsa_switch *ds) * if PHY muxing is detected. */ 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, @@ -2332,7 +2328,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.37.2