Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6657316rwr; Tue, 25 Apr 2023 01:32:19 -0700 (PDT) X-Google-Smtp-Source: AKy350a0H+vdoYA5DPo7rQhaVKt7q/9lvZJRv4cCEem80qUBnh2oZdDLXusXT3Gu86+Wc+B6q4MI X-Received: by 2002:a17:902:e808:b0:1a1:bfe8:4fae with SMTP id u8-20020a170902e80800b001a1bfe84faemr21886700plg.43.1682411538909; Tue, 25 Apr 2023 01:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682411538; cv=none; d=google.com; s=arc-20160816; b=kQEYitYW5yVFTKKp6QVKoiYzokn0bOdSc0z679sjNM3N3dWiXjuWEJ7FriUkL8EWnd W8YsHH3pToXXRhC6FEPh86187FJCY8IBCxOvybSkDgMHFi9354956sbK/M6Tfd6z79Xd oJFrIjvX+mxFh9mKS4rQpdwTa5xzGwyoF7iwdyszYIinkUIAR2rqNADCWYKI1xN3aBKW NfElIcESQxVch88Eopv/+SJ1uVfYQ98Zl2pjSZdjvF2Bg/Cgv1bHjYWRUHr+y0z4g2De 26n9iif0aj86fpfhHX3IawnSbA1iGr281ZeBpbmqkyLHo2t6LWmDpGtbe3gP3SCtxJDG EIgQ== 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=ZV9/o17xPvhI7zBC/LGreGcB1RV1tqZFpx81rZya07Y=; b=ROZ4ejfV2kYnRS5B+BOC151nxDNelzJntIER1Yuuu1AgHOwZC8aVjBmjSEvVzWh1MN jb9qX8zwCV1YBEt6LVB8GZ0VaLuKFwzLhexpCV0OTYngbC9OTzkgreDHq1yrIwCgNbxu AzAyHy/itn7TvV4wiFAoUDRSG304R45F0CcYl9CiErGArS1IZgNV2dH+HoZDI37wBZTI nCsGtYWJqSfS4QAGL7DXywZhor6xpmC6wtBd4dfg3e7wW5hLywswLkoerCKN14JodoQj 7rVbTi6pCmvnq7TtEg/VAvt5NG5naH6I+lZc833NsXe0Gg6EB8bhLRFanXWiXAqP0UHB pkCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ofF8cvyb; 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 iz10-20020a170902ef8a00b001a05524eb88si12291114plb.427.2023.04.25.01.32.07; Tue, 25 Apr 2023 01:32:18 -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=ofF8cvyb; 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 S233723AbjDYIbV (ORCPT + 99 others); Tue, 25 Apr 2023 04:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233721AbjDYIax (ORCPT ); Tue, 25 Apr 2023 04:30:53 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC5B012C8C; Tue, 25 Apr 2023 01:30:12 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-504eb1155d3so40857222a12.1; Tue, 25 Apr 2023 01:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682411411; x=1685003411; 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=ZV9/o17xPvhI7zBC/LGreGcB1RV1tqZFpx81rZya07Y=; b=ofF8cvyb2QFgkMaFU0VQLXptVklQ8QYHBxZEsNaTCvxJxJ3ZrhXI/Kj50pdwhqZ4Nd m4n/+USQGMKuN19yf+k41GD10ZUE3PQ2WoFFOe0XRWKmbhI7c/8sGw1va7ICq9H+RGdD pK4ocmhO/8mJ52fZJKcc+y3JE1N97UrkRTg+W6J9siDVo1kusSSfs/7yIjZQ+zgq1rQr Aiz2rplD7AvhqFoGRHPS7nx74qZEE9VrsWqoNhTTDFsDeZkRZ2NJ7po/x3mkDfsXy4/U WqzsJvin3es+my7E9TziBOYDLUD/qvx8CAkofVU1wR7lCrw1TgL5gb+fckZmxLm3zXK9 d/Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682411411; x=1685003411; 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=ZV9/o17xPvhI7zBC/LGreGcB1RV1tqZFpx81rZya07Y=; b=SSgA/LFHewixfnmBJvlbTXxhMwL3yoq0eFnmLDQR0EnKF6JDYxHfvqkZ5EYVflNaZT BQKhb4HlnjAI6eJ5Bzfma4+hpaNTakr6+mosF8y+PHaEQHM8SiTBNExH+cu1XiodJvul UwYEg5FH9WGkvw4dgzd6+c9MLuk4T9vgJdWNvlc4OJijSzRrRRgEHJCUVeidS0XCirJ/ vAyiLUwE3wvoYuaK9pgM8fX6sAsDHsf7ae9ShXL07I+kIm1Ule6+FQcIezLAT3Tsip7q UOJNAOvD4pS7aH0FFqZTCY0i6j5ss4SPhrqDK+Xibfcb6towisQbsI1NzVqyOiYCCJ8K TSfw== X-Gm-Message-State: AAQBX9d4LUpX22EhppqPhubhDOpuCxvuWbXlWvbAyvnXmWfHR/iu+bgb HLsT03u+Rw5SCbiwj27Y4cg= X-Received: by 2002:a17:906:edc5:b0:953:7f08:a9ee with SMTP id sb5-20020a170906edc500b009537f08a9eemr12950081ejb.1.1682411411128; Tue, 25 Apr 2023 01:30:11 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id mc2-20020a170906eb4200b0094ca077c985sm6439028ejb.213.2023.04.25.01.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 01:30:10 -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, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 08/24] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled Date: Tue, 25 Apr 2023 11:29:17 +0300 Message-Id: <20230425082933.84654-9-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230425082933.84654-1-arinc.unal@arinc9.com> References: <20230425082933.84654-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 f3d238a46543..5ef348b6a4b2 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -932,9 +932,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); @@ -2282,8 +2279,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")) @@ -2315,7 +2310,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