From patchwork Thu Feb 3 17:31:18 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: 12734456 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 BE6A8C433EF for ; Thu, 3 Feb 2022 17:34:30 +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=oeF5NHnx8hWFDZ5P4nO/bpUx0IFvXoHagHpmrQc6eys=; b=JNcCoDr4AKegsn C/EuEXzdJdvlgbO2mM4u4XhjfYkmZQVjeNPHIhOQaOkR/sYprQkKJ+H59ybw8ToLfizBAL9jdIhf2 BVXqZ6SvTJqAQSavINkiO05wNVYrGlh4CDyKDtl2Lxp/MQkml+Elz4DwuVFCmrBRiKkVOxTHjFjtY hEe1ggLPJXNReD8m01q9s22l5J5zqY/BFkaQ0p08flFL6EB3vTOOND72DKurVzFxIHjZjGS8QUCR4 nerJ7Qb9GlHA4GB8ialgHoY8cvZYM+NAPCYWRrM3H5fICdny1o9O0/WLsADpfcFO2bvsHBK8j+2pn uCfqYzUBLfQb5mySkryg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFfzz-002F8F-8M; Thu, 03 Feb 2022 17:34:23 +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 1nFfx7-002DtH-3q; Thu, 03 Feb 2022 17:31:27 +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=PAIBtkJWxx41Bed28ZKjzGiXv8E/+MRt7rygE5BGnds=; b=ceiZE/0dBQ3RXKjfq7JsAlVYfz GstggX5AHZtw3z9WONYQZMhHq28Q6aP91X7BurfurFm3EaPcJ9dN8hv+AKrGNDur/+5961MZ2CrNz hfshbBmJJiuldfSTNDPT7fEqGFL524niOWWXs0cdCGbwXX7Hl8lofMrc/DgJ1d1HToGqhAPynBcWt qiVV8vp4uA7AtPkonjrucT2FAeBpDUmLo/6x6Q4jvSxCwbwo2F7Xnuk7hJsAk6xPKqJC52ipsxY5n GFPV525aVrBaReogFaAPZmRb5XIgYuHVr/zrw1flCR6XSJ2YRF9cHROgdz162w9dMLbt4i80yHJRo Bc06LLkQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54878 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 1nFfx0-0002zA-JM; Thu, 03 Feb 2022 17:31:18 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfx0-006X6e-0I; Thu, 03 Feb 2022 17:31:18 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: DENG Qingfang , Landen Chao , Sean Wang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 1/7] net: dsa: mt7530: populate supported_interfaces MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 03 Feb 2022 17:31:18 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_093125_359096_1E575E91 X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Populate the supported interfaces for mt7530, mt7531 and mt7621 DSA switches. Filling this in will enable phylink to pre-check the PHY interface mode against the the supported interfaces bitmap prior to calling the validate function. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 68 ++++++++++++++++++++++++++++++++++++++++ drivers/net/dsa/mt7530.h | 2 ++ 2 files changed, 70 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index bc77a26c825a..1d01738cacea 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2384,6 +2384,32 @@ mt7531_setup(struct dsa_switch *ds) return 0; } +static void mt7530_mac_port_get_caps(struct dsa_switch *ds, int port, + struct phylink_config *config) +{ + switch (port) { + case 0 ... 4: /* Internal phy */ + __set_bit(PHY_INTERFACE_MODE_GMII, + config->supported_interfaces); + break; + + case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */ + phy_interface_set_rgmii(config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_MII, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_GMII, + config->supported_interfaces); + break; + + case 6: /* 1st cpu port */ + __set_bit(PHY_INTERFACE_MODE_RGMII, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_TRGMII, + config->supported_interfaces); + break; + } +} + static bool mt7530_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) @@ -2420,6 +2446,35 @@ static bool mt7531_is_rgmii_port(struct mt7530_priv *priv, u32 port) return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII); } +static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port, + struct phylink_config *config) +{ + struct mt7530_priv *priv = ds->priv; + + switch (port) { + case 0 ... 4: /* Internal phy */ + __set_bit(PHY_INTERFACE_MODE_GMII, + config->supported_interfaces); + break; + + case 5: /* 2nd cpu port supports either rgmii or sgmii/8023z */ + if (mt7531_is_rgmii_port(priv, port)) { + phy_interface_set_rgmii(config->supported_interfaces); + break; + } + fallthrough; + + case 6: /* 1st cpu port supports sgmii/8023z only */ + __set_bit(PHY_INTERFACE_MODE_SGMII, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_1000BASEX, + config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_2500BASEX, + config->supported_interfaces); + break; + } +} + static bool mt7531_phy_mode_supported(struct dsa_switch *ds, int port, const struct phylink_link_state *state) @@ -2904,6 +2959,14 @@ mt7531_cpu_port_config(struct dsa_switch *ds, int port) return 0; } +static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, + struct phylink_config *config) +{ + struct mt7530_priv *priv = ds->priv; + + priv->info->mac_port_get_caps(ds, port, config); +} + static void mt7530_mac_port_validate(struct dsa_switch *ds, int port, unsigned long *supported) @@ -3139,6 +3202,7 @@ static const struct dsa_switch_ops mt7530_switch_ops = { .port_vlan_del = mt7530_port_vlan_del, .port_mirror_add = mt753x_port_mirror_add, .port_mirror_del = mt753x_port_mirror_del, + .phylink_get_caps = mt753x_phylink_get_caps, .phylink_validate = mt753x_phylink_validate, .phylink_mac_link_state = mt753x_phylink_mac_link_state, .phylink_mac_config = mt753x_phylink_mac_config, @@ -3156,6 +3220,7 @@ static const struct mt753x_info mt753x_table[] = { .phy_read = mt7530_phy_read, .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, + .mac_port_get_caps = mt7530_mac_port_get_caps, .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, @@ -3167,6 +3232,7 @@ static const struct mt753x_info mt753x_table[] = { .phy_read = mt7530_phy_read, .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, + .mac_port_get_caps = mt7530_mac_port_get_caps, .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, @@ -3179,6 +3245,7 @@ static const struct mt753x_info mt753x_table[] = { .phy_write = mt7531_ind_phy_write, .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, + .mac_port_get_caps = mt7531_mac_port_get_caps, .phy_mode_supported = mt7531_phy_mode_supported, .mac_port_validate = mt7531_mac_port_validate, .mac_port_get_state = mt7531_phylink_mac_link_state, @@ -3241,6 +3308,7 @@ mt7530_probe(struct mdio_device *mdiodev) */ if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || + !priv->info->mac_port_get_caps || !priv->info->phy_mode_supported || !priv->info->mac_port_validate || !priv->info->mac_port_get_state || !priv->info->mac_port_config) diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index 91508e2feef9..e285b68ba354 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -769,6 +769,8 @@ struct mt753x_info { int (*phy_write)(struct mt7530_priv *priv, int port, int regnum, u16 val); int (*pad_setup)(struct dsa_switch *ds, phy_interface_t interface); int (*cpu_port_config)(struct dsa_switch *ds, int port); + void (*mac_port_get_caps)(struct dsa_switch *ds, int port, + struct phylink_config *config); bool (*phy_mode_supported)(struct dsa_switch *ds, int port, const struct phylink_link_state *state); void (*mac_port_validate)(struct dsa_switch *ds, int port, From patchwork Thu Feb 3 17:31:23 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: 12734455 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 C3CC0C433EF for ; Thu, 3 Feb 2022 17:34:25 +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=m9Zq3/sSudJBwdT2j3Qe0C4KPTgs+2qgqkhpJ/ULcts=; b=vgyLDbz/Y+ZxTP 0qupqzzPfNF9KNTIv80zzF7+zvSTE5JaD5IWk6APP50EirxK8d4b567rV3fOFQK+quYRbJWLpmy/R +VHajBdPzLb+R/W+eWJ6J/67SPVS739KNyCibrR9YL9nAPhvWYipkSYiZGQ8HQtSEKk78EpUYINEZ BSDFF2EHklA5e1H56cnoa5oflSDEl7geSjnn4Xs+MuGVj9vMFYOQ7NwTASNI0kKakicyeLKH1K4ag 5WGk4qfZpmQoApWSYjeZ9umy8wQIWoq0qCA7KEt6cKFNjt1ubhgdZH2HlXZGW3PAtQqTRbR3kepCi Okvz/y++eXXv7NBl+BCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFfzs-002F64-GB; Thu, 03 Feb 2022 17:34:16 +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 1nFfxA-002Dv3-2Y; Thu, 03 Feb 2022 17:31:30 +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=C+8A6ZpJPI8MbtjHDSCKNKBSDC6C5XIriSAssOx9qfg=; b=Ix+vQdA5G7/5V/PQlNw1uK87+6 REGC9ihwv6p1YF4Z0pk0MJSnouC0ksLBMUG9nkf66uBGmSSPhLbwPz57o3tA68XjR8F599pb/Of6s Gnp9rfhkSED87+J4AHnhAavXQOiGvrPzXfIOdwpr+0MCUmTWAdJ6c8eexKJ3qiOeGv+xnpeSH6+q9 Kw9UBGngcyso80324h6S1COrHVVIqs1WGhZCSly5arUn5Ng6hpN3sBzTHBD0aeec/HsUSQaQ6GAso zaxr5EcOEnwl2IGjOaVijVCJpcqAfZgWbXYdb1NxK2pbg3uB+h3nYmxxlrUWKqzLlaxtNLS2+KITw hs2wwC/A==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54880 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 1nFfx5-0002zO-NF; Thu, 03 Feb 2022 17:31:23 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfx5-006X6k-3w; Thu, 03 Feb 2022 17:31:23 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: DENG Qingfang , Landen Chao , Sean Wang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 2/7] net: dsa: mt7530: remove interface checks MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 03 Feb 2022 17:31:23 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_093128_384399_376C8E64 X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org As phylink checks the interface mode against the supported_interfaces bitmap, we no longer need to validate the interface mode, nor handle PHY_INTERFACE_MODE_NA in the validation function. Remove these to simplify the implementation. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 82 ---------------------------------------- drivers/net/dsa/mt7530.h | 2 - 2 files changed, 84 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 1d01738cacea..ae54c6a49676 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2410,37 +2410,6 @@ static void mt7530_mac_port_get_caps(struct dsa_switch *ds, int port, } } -static bool -mt7530_phy_mode_supported(struct dsa_switch *ds, int port, - const struct phylink_link_state *state) -{ - struct mt7530_priv *priv = ds->priv; - - switch (port) { - case 0 ... 4: /* Internal phy */ - if (state->interface != PHY_INTERFACE_MODE_GMII) - return false; - break; - case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */ - if (!phy_interface_mode_is_rgmii(state->interface) && - state->interface != PHY_INTERFACE_MODE_MII && - state->interface != PHY_INTERFACE_MODE_GMII) - return false; - break; - case 6: /* 1st cpu port */ - if (state->interface != PHY_INTERFACE_MODE_RGMII && - state->interface != PHY_INTERFACE_MODE_TRGMII) - return false; - break; - default: - dev_err(priv->dev, "%s: unsupported port: %i\n", __func__, - port); - return false; - } - - return true; -} - static bool mt7531_is_rgmii_port(struct mt7530_priv *priv, u32 port) { return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII); @@ -2475,44 +2444,6 @@ static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port, } } -static bool -mt7531_phy_mode_supported(struct dsa_switch *ds, int port, - const struct phylink_link_state *state) -{ - struct mt7530_priv *priv = ds->priv; - - switch (port) { - case 0 ... 4: /* Internal phy */ - if (state->interface != PHY_INTERFACE_MODE_GMII) - return false; - break; - case 5: /* 2nd cpu port supports either rgmii or sgmii/8023z */ - if (mt7531_is_rgmii_port(priv, port)) - return phy_interface_mode_is_rgmii(state->interface); - fallthrough; - case 6: /* 1st cpu port supports sgmii/8023z only */ - if (state->interface != PHY_INTERFACE_MODE_SGMII && - !phy_interface_mode_is_8023z(state->interface)) - return false; - break; - default: - dev_err(priv->dev, "%s: unsupported port: %i\n", __func__, - port); - return false; - } - - return true; -} - -static bool -mt753x_phy_mode_supported(struct dsa_switch *ds, int port, - const struct phylink_link_state *state) -{ - struct mt7530_priv *priv = ds->priv; - - return priv->info->phy_mode_supported(ds, port, state); -} - static int mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state) { @@ -2773,9 +2704,6 @@ mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode, struct mt7530_priv *priv = ds->priv; u32 mcr_cur, mcr_new; - if (!mt753x_phy_mode_supported(ds, port, state)) - goto unsupported; - switch (port) { case 0 ... 4: /* Internal phy */ if (state->interface != PHY_INTERFACE_MODE_GMII) @@ -2991,12 +2919,6 @@ mt753x_phylink_validate(struct dsa_switch *ds, int port, __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; struct mt7530_priv *priv = ds->priv; - if (state->interface != PHY_INTERFACE_MODE_NA && - !mt753x_phy_mode_supported(ds, port, state)) { - linkmode_zero(supported); - return; - } - phylink_set_port_modes(mask); if (state->interface != PHY_INTERFACE_MODE_TRGMII || @@ -3221,7 +3143,6 @@ static const struct mt753x_info mt753x_table[] = { .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, - .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, @@ -3233,7 +3154,6 @@ static const struct mt753x_info mt753x_table[] = { .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, - .phy_mode_supported = mt7530_phy_mode_supported, .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, @@ -3246,7 +3166,6 @@ static const struct mt753x_info mt753x_table[] = { .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, - .phy_mode_supported = mt7531_phy_mode_supported, .mac_port_validate = mt7531_mac_port_validate, .mac_port_get_state = mt7531_phylink_mac_link_state, .mac_port_config = mt7531_mac_config, @@ -3309,7 +3228,6 @@ mt7530_probe(struct mdio_device *mdiodev) if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || - !priv->info->phy_mode_supported || !priv->info->mac_port_validate || !priv->info->mac_port_get_state || !priv->info->mac_port_config) return -EINVAL; diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index e285b68ba354..cbebbcc76509 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -771,8 +771,6 @@ struct mt753x_info { int (*cpu_port_config)(struct dsa_switch *ds, int port); void (*mac_port_get_caps)(struct dsa_switch *ds, int port, struct phylink_config *config); - bool (*phy_mode_supported)(struct dsa_switch *ds, int port, - const struct phylink_link_state *state); void (*mac_port_validate)(struct dsa_switch *ds, int port, unsigned long *supported); int (*mac_port_get_state)(struct dsa_switch *ds, int port, From patchwork Thu Feb 3 17:31:28 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: 12734457 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 B7BA7C433EF for ; Thu, 3 Feb 2022 17:35:30 +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=9R07KJ00h8wvMxhJag2bXkgGFZm4sci5GVsAMherIDE=; b=DHgtKryfFIb3l2 pTazrLsmdacWCrI4OebATVFvGq26+NNwDcpGiBgMI70XvC9MMmwUpQrVyU0KZWTAlqxCXw7XKNNZl +t0Xix1eIK5OZz2m4E2tq/WmC4hKL302RKLkn/fECnj/sJGB5pMiMZzUYC+wdQU95oVJigDlQMUDR /jn9q8ElQMqBVlhI+SlH24jdgbsj9yUMAxftTTkvzon+tBae+/3+R+LAsKETRE1a4wl39DGgmpEDy s391UJoUhQh76JsQJ16Y7gxxmCc85HKDyH/3ZAHjtO275JGDYsqMTFG6TIC5pc97UwnITwlaeY5JT 9WHVpda6SjnaxEjegwDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFg0x-002FYe-BX; Thu, 03 Feb 2022 17:35:23 +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 1nFfxF-002Dxs-1T; Thu, 03 Feb 2022 17:31:34 +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=lyJN/d+uarsVkEwUKDFJstg7Dp6HsqeVOd486R7ZmrY=; b=aB532k0PGKTXksUQ4VWHB340g+ pE0CpJjpWIZLojcTTG/CR7nZEJCfOVPfQ2DiAA43DoWB0E13/oyXX7jABSyXo4+7GcxDC9ZmAYXRm gApCBXb57t8CfpBz6pEuBOs38X5s9sC7eo80ugGMGrUoXVRcCV9EvldRIt41WbhqDgHzFGxs7eEIc +Yu5UsG5VpNpyCB6FPsIIG9w3oaoYtjPZzpQuziwG+MtRN1hjCZTGgkuY5NKG87w94zcOTfEOI/cH qyNME/TMkOSs4/4ynubl5MP78s/H1eAyZSvpdGJ1OdYFS5J8rVEoVCEPzSoOsrboUw5ED074qMTdS jp3ZPkCQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54884 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 1nFfxA-0002zb-R2; Thu, 03 Feb 2022 17:31:28 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfxA-006X6q-7d; Thu, 03 Feb 2022 17:31:28 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: DENG Qingfang , Landen Chao , Sean Wang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 3/7] net: dsa: mt7530: drop use of phylink_helper_basex_speed() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 03 Feb 2022 17:31:28 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_093133_130148_44E9F002 X-CRM114-Status: UNSURE ( 8.81 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Now that we have a better method to select SFP interface modes, we no longer need to use phylink_helper_basex_speed() in a driver's validation function. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index ae54c6a49676..edfc2c6bae37 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2941,11 +2941,6 @@ mt753x_phylink_validate(struct dsa_switch *ds, int port, linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); - - /* We can only operate at 2500BaseX or 1000BaseX. If requested - * to advertise both, only report advertising at 2500BaseX. - */ - phylink_helper_basex_speed(state); } static int From patchwork Thu Feb 3 17:31:33 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: 12734458 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 75002C433EF for ; Thu, 3 Feb 2022 17:36:28 +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=2zAWC8ZFv677b5UrV9AWdudmnsJ9EqenyXE642yZxWI=; b=dOq2lCJz8rGPCV ZvmBzuL7f3MWRzP6n3bKemi0zSE1iYQenyD+caRcgaoUS0mYeFGmcbslGd2rIXjCmz+USU6bt87mU BpzpFxVjDr6KbQfKs8roIjlzLo19RFfNrljs8cShFV3ZoAeOtSqXYsy/mtmD82k/r7tqPdOqcrPbM CUFtSuGNFgxUDxz6EvVAgjIzzpXOsGU/SjpXLi5+hVMoSbbfg1l4z/cG00356ty+vI1fvHlXZyXrL VvgHmlsSHl6V2URecqW23Fz93dgFeRP9OnUD7z7QOBSebEx7ekQe/DOH5kabivRqJ+mv4M7qP7G5v IxcRntnufwpFbPJ28GLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFg1t-002FyK-0B; Thu, 03 Feb 2022 17:36:21 +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 1nFfxK-002E0K-K1; Thu, 03 Feb 2022 17:31:40 +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=76SoDOg03I7BgZU6AriDqDSFS+C3AmwY34uv3P4T1Zk=; b=De/RaULJ6uf7xlxFKcjWLtSBWw 6LbwMnzYNxDyt+HuWVH+py7B80fm0Hq65dCpXvOHGCDxA9nUp7ZJdA36Q+FKfgcmp9etrQexFzzSH SbOb1BgcGj0fJ9I+u20k9QZarpNRD9g60f70XyYS60XgG+GA5ispCSN2mE8k+9HPSmWHtH7zkAGEg ihlG4FwpDiUG5N9Jw5+g9PXIKsMmdTrkCGbxYNYCnb/LcOtFNr+DhzL8Vqba+0L5RNLmimiVjaYz7 LZZx+kFY4nU/aEvSwX/Qlb2ciwimDvvBFNUCLvl7AhK/Jj9JBnjQ0AJL2LUu9cU1Lg53te4CNHzBv z7UMKxzQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54886 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 1nFfxF-0002zo-UH; Thu, 03 Feb 2022 17:31:33 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfxF-006X6w-BE; Thu, 03 Feb 2022 17:31:33 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: DENG Qingfang , Landen Chao , Sean Wang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 4/7] net: dsa: mt7530: only indicate linkmodes that can be supported MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 03 Feb 2022 17:31:33 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_093138_706204_F1DCCCEC X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=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 | 19 +++++++++++++------ drivers/net/dsa/mt7530.h | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index edfc2c6bae37..cbdf4a58e507 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2515,6 +2515,7 @@ 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. @@ -2526,9 +2527,12 @@ static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port, break; fallthrough; case 6: - phylink_set(supported, 1000baseX_Full); - phylink_set(supported, 2500baseX_Full); - phylink_set(supported, 2500baseT_Full); + if (interface == PHY_INTERFACE_MODE_2500BASEX) { + phylink_set(supported, 2500baseX_Full); + phylink_set(supported, 2500baseT_Full); + } else { + phylink_set(supported, 1000baseX_Full); + } } } @@ -2897,6 +2901,7 @@ 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) { if (port == 5) @@ -2904,11 +2909,12 @@ mt7530_mac_port_validate(struct dsa_switch *ds, int port, } 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 @@ -2931,10 +2937,11 @@ 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); - 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); From patchwork Thu Feb 3 17:31:38 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: 12734459 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 6486CC433EF for ; Thu, 3 Feb 2022 17:37:28 +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=jyc++yyjak529Pp+ZjaoG3AbOBmz+gVaRruEIpwuG5g=; b=RLBRdTVElE/Oqb Bv7d0iDJxTp4kndjE/Wrhm4Aqjz3fiI+SNT6awFyPgnX+hYdppENDMRGAYG79oF1hyYwMhIco79z0 WuGk5P224ZBUk0vOtFyA1WD0XoRVY7+2yyTAfMgqHQRvHqxtX2lTJ62PkfS2o/L2bcwDMJhMVFlpk rKOTPA6A2YpSYuk7u2fHiOTXn9Nli7Susi5nJ1ekDlVVYFW0tecFAxrCH2tzxIya58b0Mxt+4CD+W U4SdSHn8fwe2TtMmhjHJ0yFpFV+m4ukEYB4D/9WDb1rt/z31aTw6dVrg4DzRTkBqMHCSjcwJuWJac A91xWGyzlGjy/eDvAoyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFg2r-002GN5-S7; Thu, 03 Feb 2022 17:37:21 +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 1nFfxO-002E2c-NM; Thu, 03 Feb 2022 17:31:44 +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=LT0yR0PeUj3iS0pQ3EBNu1UcT2mKQB/wbY+eKASwNJk=; b=A0yJIJIhVxdH0g3AoJ54Z5XZFx iUWMv6wVmNVAaFWkmEZXNI/fa2EQCclfVlMierJD3r92+7ke63gFql2msvqAa38R4GBDRMLBiUANh h7dkEcfCvsuu7405HhmL6F6EdTXLM5J4PZlA1ssV36XG61sHo7KQyOEuxLdA3oAWgxG6Fxez3DTr5 gHUnSnvmFYKk53UeOT20zX4oZiygc3ANZBh+PF2wL9w+yr0dhM8XQ25/+pA0mAxRczwBFHfKcY6KD VO9kWLMdsQMGo+HlhYGW3RcwA1soVi0SZtoiwVNvXkTu0cflXMzvwayTVFFuei5g7lr4TPbdGnpua 3ayyz5BQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54888 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 1nFfxL-000303-1v; Thu, 03 Feb 2022 17:31:39 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfxK-006X72-Es; Thu, 03 Feb 2022 17:31:38 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: DENG Qingfang , Landen Chao , Sean Wang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 5/7] net: dsa: mt7530: RGMII can support 1000base-X MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 03 Feb 2022 17:31:38 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_093142_805906_4933150B X-CRM114-Status: UNSURE ( 9.22 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org When using an external PHY connected using RGMII to mt7531 port 5, the PHY can be used to used support 1000baseX connections. Therefore, it makes no sense to exclude this from the linkmodes permitted for mt7531 port 5, so allow 1000baseX. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index cbdf4a58e507..a2fa629cccc0 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2523,9 +2523,6 @@ static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port, */ switch (port) { case 5: - if (mt7531_is_rgmii_port(priv, port)) - break; - fallthrough; case 6: if (interface == PHY_INTERFACE_MODE_2500BASEX) { phylink_set(supported, 2500baseX_Full); From patchwork Thu Feb 3 17:31:43 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: 12734460 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 1481EC433EF for ; Thu, 3 Feb 2022 17:38:42 +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=ghJf1HCxFDo5Jerf672s2P4qdVLsHlYKnPBeFOtdOMM=; b=hqQZtkM/rkd8Bv ljlfpydXd8JieZHDq8GvVegI6go5+pVJABiCW6FQA4URSXDV66vD3twOKHlipYT+KSBrjhMMJZSnB 2zrvlvbmC3pVLiQ2WLBo2t+jtkh//Axv6iKBx4EKnWb3KD91n8FYw9ChQvV499nVZ835h9WdeWl36 gVi3GtPuRXHwSu/7o0rSS3MdYOZ2X3oUW2rbxFKTtHP7PsAzQn0bVwuxq8pZcDoBWSqeBkgpSY5sP qheSM8FKu/yyW2HjjPHGTgdyRayx719oYsETkrAH1x870G6eNCR5MaeCE3h5/czgoB2V7cdMmod53 RJ+8YuQMkfYZCZ81of8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFg41-002Gr0-JY; Thu, 03 Feb 2022 17:38:33 +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 1nFfxU-002E4t-BL; Thu, 03 Feb 2022 17:31:50 +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=E1q/4OKJozgjmQaoXCc9XkL532v9LVTwewol1SjjUjA=; b=zs3O9EXo5ER3eGh/lJzZADjBSB u055Ee3ofRWVypCmK7svTRIFd2940g2RMGdsIu7JG3mfWNDvhIZOzNbebVtSVHGHRVPx6xQQ06Nor UIr0sB/LZ/ATuxKQ1ioh7HWvLz/xhmiCG0R42zqO/XChQGH0r5W8abX02xHO0spENXEIKLlK0iko1 eHbKIcvDFHSu6O92MnoAN0XCSlBGy4D7qhLesz4hbyI6ST6O5CV0B08zKyGrbKMvwEJ3lMbMww/M2 Kc/f8RLnHdFbte4QJdpWanevYAwic/+aFwmVQMIWGswnHYu8OZKyJy+xSseIb6zJbq9AHh8aZZBE1 Rip+nmJA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54890 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 1nFfxQ-00030H-5U; Thu, 03 Feb 2022 17:31:44 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfxP-006X78-IZ; Thu, 03 Feb 2022 17:31:43 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: DENG Qingfang , Landen Chao , Sean Wang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 6/7] net: dsa: mt7530: switch to use phylink_get_linkmodes() MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 03 Feb 2022 17:31:43 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_093148_502420_22A21E6C X-CRM114-Status: GOOD ( 14.40 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Switch mt7530 to use phylink_get_linkmodes() to generate the ethtool linkmodes that can be supported. We are unable to use the generic helper for this as pause modes are dependent on the interface as the Autoneg bit depends on the interface mode. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 69 +++++++--------------------------------- 1 file changed, 11 insertions(+), 58 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index a2fa629cccc0..2a829fc86c01 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2440,6 +2440,8 @@ static void mt7531_mac_port_get_caps(struct dsa_switch *ds, int port, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_2500BASEX, config->supported_interfaces); + + config->mac_capabilities |= MAC_2500FD; break; } } @@ -2514,25 +2516,6 @@ static int mt7531_rgmii_setup(struct mt7530_priv *priv, u32 port, return 0; } -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. - */ - switch (port) { - case 5: - case 6: - if (interface == PHY_INTERFACE_MODE_2500BASEX) { - phylink_set(supported, 2500baseX_Full); - phylink_set(supported, 2500baseT_Full); - } else { - phylink_set(supported, 1000baseX_Full); - } - } -} - static void mt7531_sgmii_link_up_force(struct dsa_switch *ds, int port, unsigned int mode, phy_interface_t interface, @@ -2893,25 +2876,11 @@ static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, { struct mt7530_priv *priv = ds->priv; - priv->info->mac_port_get_caps(ds, port, config); -} - -static void -mt7530_mac_port_validate(struct dsa_switch *ds, int port, - phy_interface_t interface, - unsigned long *supported) -{ - if (port == 5) - phylink_set(supported, 1000baseX_Full); -} - -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; + /* This switch only supports 1G full-duplex. */ + config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | + MAC_10 | MAC_100 | MAC_1000FD; - mt7531_sgmii_validate(priv, port, interface, supported); + priv->info->mac_port_get_caps(ds, port, config); } static void @@ -2920,28 +2889,16 @@ mt753x_phylink_validate(struct dsa_switch *ds, int port, struct phylink_link_state *state) { __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; - struct mt7530_priv *priv = ds->priv; + u32 caps; + + caps = dsa_to_port(ds, port)->pl_config.mac_capabilities; phylink_set_port_modes(mask); + phylink_get_linkmodes(mask, state->interface, caps); if (state->interface != PHY_INTERFACE_MODE_TRGMII || - !phy_interface_mode_is_8023z(state->interface)) { - phylink_set(mask, 10baseT_Half); - phylink_set(mask, 10baseT_Full); - phylink_set(mask, 100baseT_Half); - phylink_set(mask, 100baseT_Full); + !phy_interface_mode_is_8023z(state->interface)) phylink_set(mask, Autoneg); - } - - /* This switch only supports 1G full-duplex. */ - if (state->interface != PHY_INTERFACE_MODE_MII && - state->interface != PHY_INTERFACE_MODE_2500BASEX) - phylink_set(mask, 1000baseT_Full); - - priv->info->mac_port_validate(ds, port, state->interface, mask); - - phylink_set(mask, Pause); - phylink_set(mask, Asym_Pause); linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); @@ -3142,7 +3099,6 @@ static const struct mt753x_info mt753x_table[] = { .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, - .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, @@ -3153,7 +3109,6 @@ static const struct mt753x_info mt753x_table[] = { .phy_write = mt7530_phy_write, .pad_setup = mt7530_pad_clk_setup, .mac_port_get_caps = mt7530_mac_port_get_caps, - .mac_port_validate = mt7530_mac_port_validate, .mac_port_get_state = mt7530_phylink_mac_link_state, .mac_port_config = mt7530_mac_config, }, @@ -3165,7 +3120,6 @@ static const struct mt753x_info mt753x_table[] = { .pad_setup = mt7531_pad_setup, .cpu_port_config = mt7531_cpu_port_config, .mac_port_get_caps = mt7531_mac_port_get_caps, - .mac_port_validate = mt7531_mac_port_validate, .mac_port_get_state = mt7531_phylink_mac_link_state, .mac_port_config = mt7531_mac_config, .mac_pcs_an_restart = mt7531_sgmii_restart_an, @@ -3227,7 +3181,6 @@ mt7530_probe(struct mdio_device *mdiodev) if (!priv->info->sw_setup || !priv->info->pad_setup || !priv->info->phy_read || !priv->info->phy_write || !priv->info->mac_port_get_caps || - !priv->info->mac_port_validate || !priv->info->mac_port_get_state || !priv->info->mac_port_config) return -EINVAL; From patchwork Thu Feb 3 17:31:48 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: 12734474 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 3E591C433EF for ; Thu, 3 Feb 2022 17:39:43 +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=sVcdXC8S5qCbxtys53i/c+C376gWlJWqbD4xzZjZ3+k=; b=4+iDMEiJm8O+P7 3gkASyxU4akxPISSRI16/3RHz7Av1HUBxgDBNf7XTM3rXXmdu/N6Z94xeNnQAm8urgwUy2CCNuLAi HFO/7wuIVpax+JIO2ThD8Q6LOVQJFLbKJYNsQw31YA13oat/E1XMJNwotvwy0jPLvDfhk5OGpq5Dl kR0GaM16j3AnqLwY65o73NyPoOHTBmKkWCaQEjZbEId+hl4LNeFxIg+k0HgHThXaVpRHDU2w32N39 piLg0hkvJACMHnGRXQfFxR4LmTneAtm5eyFuVoPwXmRXKffNKd0NtIRcK38sJuDTwdIH5rZPMa8MD Pzlziis2CjFX6FnQ35GQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFg51-002HEg-Tj; Thu, 03 Feb 2022 17:39:36 +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 1nFfxZ-002E7n-RF; Thu, 03 Feb 2022 17:31:55 +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=kFTUSTZyensRdyUABUAAtx+KvO3TFbIu47LyS59N79A=; b=pSwMJmhtFSnO0pK6bzmea24agf uBQqZfBlkCVhUPOHCakhyyNfjVaxqpXxgaG6DfIhf9VoWiK+pkaWPIw66lfq7WkXTlHgKdnKRT8Pm gX+6+nWIP9b/jA2AJJhXaRQPP0aoQOVFE0HmL5IAYhcc3qDC0MZMPJSEpoM9RGmjMqM+tx0qNB9iF Qnl+F/VrRG+sxWixrz5F7fHCyi81egeJl05H0PaGWXasMOstlg1d4PuSDhBg8PChalc8fZH9vYqs/ rN5KdyZ9hzfHQi3VWhZNyQl2ZLORP93WSjgFJNKbjwoojsflyhKnjkzemv87glFAr+ibCo8bn4Uk0 94+bDZzg==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:54892 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 1nFfxV-00030U-8t; Thu, 03 Feb 2022 17:31:49 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfxU-006X7E-MD; Thu, 03 Feb 2022 17:31:48 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: DENG Qingfang , Landen Chao , Sean Wang Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC net-next 7/7] net: dsa: mt7530: mark as non-legacy MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Thu, 03 Feb 2022 17:31:48 +0000 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220203_093153_964594_D3D7389A X-CRM114-Status: GOOD ( 10.46 ) X-BeenThere: linux-mediatek@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-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The mt7530 driver does not make use of the speed, duplex, pause or advertisement in its phylink_mac_config() implementation, so it can be marked as a non-legacy driver. Signed-off-by: Russell King (Oracle) --- drivers/net/dsa/mt7530.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 2a829fc86c01..ad5355e94a4f 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2880,6 +2880,12 @@ static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port, config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE | MAC_10 | MAC_100 | MAC_1000FD; + /* This driver does not make use of the speed, duplex, pause or the + * advertisement in its mac_config, so it is safe to mark this driver + * as non-legacy. + */ + config->legacy_pre_march2020 = false; + priv->info->mac_port_get_caps(ds, port, config); }