Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp877266rwl; Fri, 7 Apr 2023 06:52:22 -0700 (PDT) X-Google-Smtp-Source: AKy350a4JT7hOyAS94dcPIryeGCLZskJ6s+L/27TzLBkS1ps8hZnislbNaTQO/CEudcnSF2GmH1R X-Received: by 2002:a62:38c5:0:b0:627:f0e5:6ea5 with SMTP id f188-20020a6238c5000000b00627f0e56ea5mr2680678pfa.7.1680875541934; Fri, 07 Apr 2023 06:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680875541; cv=none; d=google.com; s=arc-20160816; b=XwfEvsC94aC1g/pDGmg22cm7UnTQUZ1IXYzedewPqq3BjH+M3ds7wlhGp4A6Qhx6Le ZqbpBtrh1pLXZiyu4r+RfoI53YZEDX8SsxIVPWHvzuI+mvaPkg2jCoenBsB69CnIJItl 9BskUa45acv63bWg02UToCFzX6UG/h0rZr7rUFf+IHw4kk3YpjAVzwxpVOsNanAu0+k7 SHp3LQJ/OtQauw4xpqwD10tsNFBojGJHCCVlR+ETRe7+6MiBgyJ8r0qpfIYtWi68RArA 3InJSRpWurwfadU6PM5m3+z3UbbWX4rRTF7X4BlDXbR71QZOzHwSpPxEfw5IaIw8lfpi Wcjw== 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=crYfk2VDIQF894aVQJBbVhrnboljTGA23/Z6qxtRjD0=; b=UVSyKxWyPhth+v7w8/Yh/3li4iILCfC5CSia7opoVKN6CSPEe2WitFIlriq6BBG9Ci //Y7JGZiTbFQTM98OHDjNoHt18kyCT9nXeWEOQbr7BsvU4lGoi2Kvoy+Ts+LgF7pxaQr Q2ZuljduSzoclHMrArUoeozuRd5Bs4sm4KDKsNKetR4Erie+dj0dqAkCFnQjZXpV+ZTV 9CW/QQmkbI1SrXeIn8wUQa33CWzWzoBOxhUzioWB12a/DC+Xxun6evOqbU3+c3jX2Xam 1i5C+1jne/BqpULqs2C6Nn0Hh7uNED+AR0NVLLbzCAqr8pakTbIv9JgRP3foNhan+rE7 xQjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QY+JalpF; 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 q4-20020aa78424000000b0062d6f6569e1si3706057pfn.135.2023.04.07.06.52.02; Fri, 07 Apr 2023 06:52:21 -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=QY+JalpF; 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 S232209AbjDGNtN (ORCPT + 99 others); Fri, 7 Apr 2023 09:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232102AbjDGNs1 (ORCPT ); Fri, 7 Apr 2023 09:48:27 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68697BDE7; Fri, 7 Apr 2023 06:46:57 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-5491fa028adso300426067b3.10; Fri, 07 Apr 2023 06:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680875213; 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=crYfk2VDIQF894aVQJBbVhrnboljTGA23/Z6qxtRjD0=; b=QY+JalpFS6CArA2lrrReVeAa2wVaum9DzGiL//HC2IZCot6mehT7TTubrAM34WoH4v bjD2iOhSj6XgUDYZtrCf1tRoZM2T5r+kHBIHctNa5KRCGRDnRH+CPvPVh2MbdmPfXerV 4ZPSjhu65Avak1reJ5XEpF5TIzdgUo9hVnD9YA1KOXSm/QCqAROiGt5j2pC8T3GI0Gi8 DO8I2stIfAKP2mUw6+UvQgSv94v41jSH10z9+Yk7DhdKEIp+edhIe9KgyXwG1jU29x25 5YCmpxjjsQFDn7tONHozn++go+gA9HsSZ5z1fIeHgTLmCjlRUBWekd8K4kFjCeqt9biA HOTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680875213; 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=crYfk2VDIQF894aVQJBbVhrnboljTGA23/Z6qxtRjD0=; b=PNABwoaXBsHj/h8JRm+jyEzxZ1Ns6uRU/KIwiD4nDpR7hu47Oi5L69zeTG4o1o/S9J VFyQ5tIdZsSteCaeHXLZ366o1fPSmUab3i1hnJmzHMdBwAqCkfypR8/U3WRKagCvgflu Whw30xS/MCIyI2rNEn5mYwFawohlkv70qEstfzD9UE6ArDuLR60+ZrOCWqZivTsDYkxJ kYq8tzFdE4NMR7x+cmlJGICsQDcN0tLBecu/DP5eIpY0WeX/pPLjpiRaRUM5LYPzdP4d ZxcMg3ppsIVHwb8dSsoFdY7bT6oqzuDm3cmvZgG4DVzBd7zgxVVHm8zOpSr0s+pusSfi zmiA== X-Gm-Message-State: AAQBX9cf8kyLOUrMbB42o0x9LgfG6/3bnHaGIR1gV01dh8saCr5AqeTO xoCVrFEKrHlJ3D9XH9IEd5k= X-Received: by 2002:a81:63d5:0:b0:545:e54f:b1ff with SMTP id x204-20020a8163d5000000b00545e54fb1ffmr1848742ywb.4.1680875213597; Fri, 07 Apr 2023 06:46:53 -0700 (PDT) Received: from arinc9-PC.lan ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id 139-20020a810e91000000b00545a0818473sm1034317ywo.3.2023.04.07.06.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 06:46:53 -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 , 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 v2 net-next 04/14] net: dsa: mt7530: set priv->p5_interface in correct conditions Date: Fri, 7 Apr 2023 16:46:16 +0300 Message-Id: <20230407134626.47928-5-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230407134626.47928-1-arinc.unal@arinc9.com> References: <20230407134626.47928-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 Currently, priv->p5_interface is set on mt7530_setup_port5() even though it's being set on mt753x_phylink_mac_config() after mt7530_setup_port5() is run. The only case for setting priv->p5_interface on mt7530_setup_port5() 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. To address this, set priv->p5_interface only if PHY muxing is enabled. On mt753x_phylink_mac_config, != P5_DISABLED is enough but to be explicit, look for p5_intf_sel being P5_INTF_SEL_GMAC5 or P5_INTF_SEL_GMAC5_SGMII. Tested-by: Arınç ÜNAL Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 9ab2e128b564..fccd59564532 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -976,7 +976,9 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) dev_dbg(ds->dev, "Setup P5, HWTRAP=0x%x, intf_sel=%s, phy-mode=%s\n", val, p5_intf_modes(priv->p5_intf_sel), phy_modes(interface)); - priv->p5_interface = interface; + if (priv->p5_intf_sel == P5_INTF_SEL_PHY_P0 || + priv->p5_intf_sel == P5_INTF_SEL_PHY_P4) + priv->p5_interface = interface; unlock_exit: mutex_unlock(&priv->reg_mutex); @@ -2746,7 +2748,8 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, if (mt753x_mac_config(ds, port, mode, state) < 0) goto unsupported; - if (priv->p5_intf_sel != P5_DISABLED) + if (priv->p5_intf_sel == P5_INTF_SEL_GMAC5 || + priv->p5_intf_sel == P5_INTF_SEL_GMAC5_SGMII) priv->p5_interface = state->interface; break; case 6: /* Port 6, a CPU port. */ -- 2.37.2