From patchwork Wed Apr 6 10:48:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 12803163 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 A993DC433F5 for ; Wed, 6 Apr 2022 10:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lfc+OtkrH65cc7z204DXXjshHH5xfDu5y+pHWulfY6Q=; b=rrk8QFi18YkTxP 2jhWbMwI+3bJ12zHDeUbGaAVC7t3kSldgWpKA/CUnZX6oetzRVP/k+X1rSnjpQPuA8Vg+BHqIHlQ5 24xabUPvEwkENRF3OhQ9yYbn+F8MnZBRPd5vLm24qnc7B/Uei8SnZgfU5MY8n6IH9tzlfQsVkM63W YfT90wK1cAhRob2oiNtAJT2VOfoTmUUNOVR2MtCBNamA7fqTRJXTsj0eYzd+Chg5XHlD4bsmxx3tL 1kaCVgq8rQnIA7Da0hNJYkkievWrFwbFrSy9kb37E8F1uvymvz88a/lMhFEuUz62o5gO3qpWx63kA ZH3YnafOqbO3LN2lGfTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nc3Ee-005XBU-Ev; Wed, 06 Apr 2022 10:50:01 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nc3Di-005WcQ-Tr; Wed, 06 Apr 2022 10:49:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=imBSAQxrNQItjbJtDaj4oYwl4KWvsK6yabA2JkmfzUk=; b=yMdnutRaR9QWV2382TrXE49Zy3 ZT67pzNqy/zGkB/Rr/MpPX9G/cjfkPMEjfeMCTu48ld5bAPTnJEAbkPIX0fHSzmK9BjkZBT+T7fL6 tbyn5ohc/daXO4rSNIiLHujdGxqJGdRGUiSAwgIYqOd0B4pfuBjMTmOZaV/tO/NDOufdg43wZV4Rg gFLsTmOmKPkzFYVAuLsqj+LJlBqIqs6XPLjFRj7erxeZfkm0pVZTfJe16OTQXtjL/af/6vGgcSem5 t4qn+Aay7lz+vuwOllZ5HjvlJFGYgFJNBgNn2vPwr6xfV3V9948LRPyEw8XxOmq7FKE/6/AzQe4ew mvqrxLXQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:59988 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nc3De-0002Zw-Ac; Wed, 06 Apr 2022 11:48:58 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nc3Dd-004hq7-Co; Wed, 06 Apr 2022 11:48:57 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Landen Chao , DENG Qingfang , Sean Wang Cc: Marek Beh__n , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next 5/9] net: dsa: mt7530: only indicate linkmodes that can be supported MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Wed, 06 Apr 2022 11:48:57 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220406_034903_037571_08748C7E X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that mt7530 is not using the basex helper, it becomes unnecessary to indicate support for both 1000baseX and 2500baseX when one of the 803.3z PHY interface modes is being selected. Ensure that the driver indicates only those linkmodes that can actually be supported by the PHY interface mode. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 14 +++++++++----- drivers/net/dsa/mt7530.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 868d1af646f7..0c30d8586062 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2522,13 +2522,14 @@ static int mt7531_rgmii_setup(struct mt7530_priv *priv, u32 port, } static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port, + phy_interface_t interface, unsigned long *supported) { /* Port5 supports ethier RGMII or SGMII. * Port6 supports SGMII only. */ - if (port == 6 || - (port == 5 && !mt7531_is_rgmii_port(priv, port))) { + if ((port == 5 || port == 6) && + interface == PHY_INTERFACE_MODE_2500BASEX) { phylink_set(supported, 2500baseX_Full); phylink_set(supported, 2500baseT_Full); } @@ -2903,16 +2904,18 @@ static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, + phy_interface_t interface, unsigned long *supported) { } static void mt7531_mac_port_validate(struct dsa_switch *ds, int port, + phy_interface_t interface, unsigned long *supported) { struct mt7530_priv *priv = ds->priv; - mt7531_sgmii_validate(priv, port, supported); + mt7531_sgmii_validate(priv, port, interface, supported); } static void @@ -2935,12 +2938,13 @@ mt753x_phylink_validate(struct dsa_switch *ds, int port, } /* This switch only supports 1G full-duplex. */ - if (state->interface != PHY_INTERFACE_MODE_MII) { + if (state->interface != PHY_INTERFACE_MODE_MII && + state->interface != PHY_INTERFACE_MODE_2500BASEX) phylink_set(mask, 1000baseT_Full); phylink_set(mask, 1000baseX_Full); } - priv->info->mac_port_validate(ds, port, mask); + priv->info->mac_port_validate(ds, port, state->interface, mask); phylink_set(mask, Pause); phylink_set(mask, Asym_Pause); diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index cbebbcc76509..73cfd29fbb17 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -772,6 +772,7 @@ struct mt753x_info { void (*mac_port_get_caps)(struct dsa_switch *ds, int port, struct phylink_config *config); void (*mac_port_validate)(struct dsa_switch *ds, int port, + phy_interface_t interface, unsigned long *supported); int (*mac_port_get_state)(struct dsa_switch *ds, int port, struct phylink_link_state *state);