netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state
@ 2020-06-30 10:24 Russell King - ARM Linux admin
  2020-06-30 10:25 ` [PATCH net-next 1/2] net: dsa/b53: change b53_force_port_config() pause argument Russell King
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Russell King - ARM Linux admin @ 2020-06-30 10:24 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit
  Cc: David S. Miller, Jakub Kicinski, netdev, Vivien Didelot

These two patches update the Broadcom B53 DSA support to use the newly
provided resolved link state via mac_link_up() rather than using the
state in mac_config().

 drivers/net/dsa/b53/b53_common.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] net: dsa/b53: change b53_force_port_config() pause argument
  2020-06-30 10:24 [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state Russell King - ARM Linux admin
@ 2020-06-30 10:25 ` Russell King
  2020-06-30 10:25 ` [PATCH net-next 2/2] net: dsa/b53: use resolved link config in mac_link_up() Russell King
  2020-06-30 20:05 ` [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Russell King @ 2020-06-30 10:25 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit
  Cc: David S. Miller, netdev, Vivien Didelot, Jakub Kicinski

Replace the b53_force_port_config() pause argument, which is based on
phylink's MLO_PAUSE_* definitions, to use a pair of booleans.  This
will allow us to move b53_force_port_config() from
b53_phylink_mac_config() to b53_phylink_mac_link_up().

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/b53/b53_common.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 1df05841ab6b..8a7fa6092b01 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1037,7 +1037,8 @@ static void b53_force_link(struct b53_device *dev, int port, int link)
 }
 
 static void b53_force_port_config(struct b53_device *dev, int port,
-				  int speed, int duplex, int pause)
+				  int speed, int duplex,
+				  bool tx_pause, bool rx_pause)
 {
 	u8 reg, val, off;
 
@@ -1075,9 +1076,9 @@ static void b53_force_port_config(struct b53_device *dev, int port,
 		return;
 	}
 
-	if (pause & MLO_PAUSE_RX)
+	if (rx_pause)
 		reg |= PORT_OVERRIDE_RX_FLOW;
-	if (pause & MLO_PAUSE_TX)
+	if (tx_pause)
 		reg |= PORT_OVERRIDE_TX_FLOW;
 
 	b53_write8(dev, B53_CTRL_PAGE, off, reg);
@@ -1089,22 +1090,24 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
 	struct b53_device *dev = ds->priv;
 	struct ethtool_eee *p = &dev->ports[port].eee;
 	u8 rgmii_ctrl = 0, reg = 0, off;
-	int pause = 0;
+	bool tx_pause = false;
+	bool rx_pause = false;
 
 	if (!phy_is_pseudo_fixed_link(phydev))
 		return;
 
 	/* Enable flow control on BCM5301x's CPU port */
 	if (is5301x(dev) && port == dev->cpu_port)
-		pause = MLO_PAUSE_TXRX_MASK;
+		tx_pause = rx_pause = true;
 
 	if (phydev->pause) {
 		if (phydev->asym_pause)
-			pause |= MLO_PAUSE_TX;
-		pause |= MLO_PAUSE_RX;
+			tx_pause = true;
+		rx_pause = true;
 	}
 
-	b53_force_port_config(dev, port, phydev->speed, phydev->duplex, pause);
+	b53_force_port_config(dev, port, phydev->speed, phydev->duplex,
+			      tx_pause, rx_pause);
 	b53_force_link(dev, port, phydev->link);
 
 	if (is531x5(dev) && phy_interface_is_rgmii(phydev)) {
@@ -1166,7 +1169,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
 	} else if (is5301x(dev)) {
 		if (port != dev->cpu_port) {
 			b53_force_port_config(dev, dev->cpu_port, 2000,
-					      DUPLEX_FULL, MLO_PAUSE_TXRX_MASK);
+					      DUPLEX_FULL, true, true);
 			b53_force_link(dev, dev->cpu_port, 1);
 		}
 	}
@@ -1256,7 +1259,9 @@ void b53_phylink_mac_config(struct dsa_switch *ds, int port,
 
 	if (mode == MLO_AN_FIXED) {
 		b53_force_port_config(dev, port, state->speed,
-				      state->duplex, state->pause);
+				      state->duplex,
+				      !!(state->pause & MLO_PAUSE_TX),
+				      !!(state->pause & MLO_PAUSE_RX));
 		return;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] net: dsa/b53: use resolved link config in mac_link_up()
  2020-06-30 10:24 [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state Russell King - ARM Linux admin
  2020-06-30 10:25 ` [PATCH net-next 1/2] net: dsa/b53: change b53_force_port_config() pause argument Russell King
@ 2020-06-30 10:25 ` Russell King
  2020-06-30 20:05 ` [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Russell King @ 2020-06-30 10:25 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit
  Cc: David S. Miller, netdev, Vivien Didelot, Jakub Kicinski

Convert the B53 driver to use the finalised link parameters in
mac_link_up() rather than the parameters in mac_config(). This is
just a matter of moving the call to b53_force_port_config().

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/dsa/b53/b53_common.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 8a7fa6092b01..6500179c2ca2 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1254,17 +1254,9 @@ void b53_phylink_mac_config(struct dsa_switch *ds, int port,
 {
 	struct b53_device *dev = ds->priv;
 
-	if (mode == MLO_AN_PHY)
+	if (mode == MLO_AN_PHY || mode == MLO_AN_FIXED)
 		return;
 
-	if (mode == MLO_AN_FIXED) {
-		b53_force_port_config(dev, port, state->speed,
-				      state->duplex,
-				      !!(state->pause & MLO_PAUSE_TX),
-				      !!(state->pause & MLO_PAUSE_RX));
-		return;
-	}
-
 	if ((phy_interface_mode_is_8023z(state->interface) ||
 	     state->interface == PHY_INTERFACE_MODE_SGMII) &&
 	     dev->ops->serdes_config)
@@ -1314,6 +1306,8 @@ void b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
 		return;
 
 	if (mode == MLO_AN_FIXED) {
+		b53_force_port_config(dev, port, speed, duplex,
+				      tx_pause, rx_pause);
 		b53_force_link(dev, port, true);
 		return;
 	}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state
  2020-06-30 10:24 [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state Russell King - ARM Linux admin
  2020-06-30 10:25 ` [PATCH net-next 1/2] net: dsa/b53: change b53_force_port_config() pause argument Russell King
  2020-06-30 10:25 ` [PATCH net-next 2/2] net: dsa/b53: use resolved link config in mac_link_up() Russell King
@ 2020-06-30 20:05 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-06-30 20:05 UTC (permalink / raw)
  To: linux; +Cc: andrew, f.fainelli, hkallweit1, kuba, netdev, vivien.didelot

From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Date: Tue, 30 Jun 2020 11:24:30 +0100

> These two patches update the Broadcom B53 DSA support to use the newly
> provided resolved link state via mac_link_up() rather than using the
> state in mac_config().

Series applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-30 20:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 10:24 [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state Russell King - ARM Linux admin
2020-06-30 10:25 ` [PATCH net-next 1/2] net: dsa/b53: change b53_force_port_config() pause argument Russell King
2020-06-30 10:25 ` [PATCH net-next 2/2] net: dsa/b53: use resolved link config in mac_link_up() Russell King
2020-06-30 20:05 ` [PATCH net-next 0/2] Convert Broadcom B53 to mac_link_up() resolved state David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).