mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-03 22:44:27 -05:00 
			
		
		
		
	Removed upstreamed: generic/pending-5.15/722-net-mt7531-only-do-PLL-once-after-the-reset.patch[1] bcm53xx/patches-5.15/082-v6.0-clk-iproc-Do-not-rely-on-node-name-for-correct-PLL-s.patch[2] All other patches automatically rebased Build system: x86_64 Build-tested: bcm2711/RPi4B, mt7622/RT3200, mvebu/cortexa72 Run-tested: bcm2711/RPi4B, mt7622/RT3200, mvebu/cortexa72 (RB5009UG+S+IN) 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.72&id=5de02ab84aeca765da0e4d8e999af35325ac67c2 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.72&id=ab5c5787ab5ecdc4a7ea20b4ef542579e1beb49d Signed-off-by: John Audia <therealgraysky@proton.me>
		
			
				
	
	
		
			173 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			173 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From e3f6719e2269868ca129b05da50cd55786848954 Mon Sep 17 00:00:00 2001
 | 
						|
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
 | 
						|
Date: Mon, 11 Apr 2022 10:46:06 +0100
 | 
						|
Subject: [PATCH 03/13] net: dsa: mt7530: remove interface checks
 | 
						|
MIME-Version: 1.0
 | 
						|
Content-Type: text/plain; charset=UTF-8
 | 
						|
Content-Transfer-Encoding: 8bit
 | 
						|
 | 
						|
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.
 | 
						|
 | 
						|
Tested-by: Marek Behún <kabel@kernel.org>
 | 
						|
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
 | 
						|
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
 | 
						|
---
 | 
						|
 drivers/net/dsa/mt7530.c | 82 ----------------------------------------
 | 
						|
 drivers/net/dsa/mt7530.h |  2 -
 | 
						|
 2 files changed, 84 deletions(-)
 | 
						|
 | 
						|
--- a/drivers/net/dsa/mt7530.c
 | 
						|
+++ b/drivers/net/dsa/mt7530.c
 | 
						|
@@ -2416,37 +2416,6 @@ static void mt7530_mac_port_get_caps(str
 | 
						|
 	}
 | 
						|
 }
 | 
						|
 
 | 
						|
-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);
 | 
						|
@@ -2483,44 +2452,6 @@ static void mt7531_mac_port_get_caps(str
 | 
						|
 	}
 | 
						|
 }
 | 
						|
 
 | 
						|
-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)
 | 
						|
 {
 | 
						|
@@ -2775,9 +2706,6 @@ mt753x_phylink_mac_config(struct dsa_swi
 | 
						|
 	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)
 | 
						|
@@ -2993,12 +2921,6 @@ mt753x_phylink_validate(struct dsa_switc
 | 
						|
 	__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 &&
 | 
						|
@@ -3225,7 +3147,6 @@ static const struct mt753x_info mt753x_t
 | 
						|
 		.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,
 | 
						|
@@ -3237,7 +3158,6 @@ static const struct mt753x_info mt753x_t
 | 
						|
 		.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,
 | 
						|
@@ -3250,7 +3170,6 @@ static const struct mt753x_info mt753x_t
 | 
						|
 		.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,
 | 
						|
@@ -3313,7 +3232,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;
 | 
						|
--- 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,
 |