Commit bcd763b7 authored by David S. Miller's avatar David S. Miller

Merge branch 'Convert-Broadcom-B53-to-mac_link_up-resolved-state'

Russell King says:

====================
Convert Broadcom B53 to mac_link_up() resolved state

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().
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d9b8b984 ab017b79
...@@ -1037,7 +1037,8 @@ static void b53_force_link(struct b53_device *dev, int port, int link) ...@@ -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, 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; u8 reg, val, off;
...@@ -1075,9 +1076,9 @@ static void b53_force_port_config(struct b53_device *dev, int port, ...@@ -1075,9 +1076,9 @@ static void b53_force_port_config(struct b53_device *dev, int port,
return; return;
} }
if (pause & MLO_PAUSE_RX) if (rx_pause)
reg |= PORT_OVERRIDE_RX_FLOW; reg |= PORT_OVERRIDE_RX_FLOW;
if (pause & MLO_PAUSE_TX) if (tx_pause)
reg |= PORT_OVERRIDE_TX_FLOW; reg |= PORT_OVERRIDE_TX_FLOW;
b53_write8(dev, B53_CTRL_PAGE, off, reg); b53_write8(dev, B53_CTRL_PAGE, off, reg);
...@@ -1089,22 +1090,24 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, ...@@ -1089,22 +1090,24 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
struct b53_device *dev = ds->priv; struct b53_device *dev = ds->priv;
struct ethtool_eee *p = &dev->ports[port].eee; struct ethtool_eee *p = &dev->ports[port].eee;
u8 rgmii_ctrl = 0, reg = 0, off; 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)) if (!phy_is_pseudo_fixed_link(phydev))
return; return;
/* Enable flow control on BCM5301x's CPU port */ /* Enable flow control on BCM5301x's CPU port */
if (is5301x(dev) && port == dev->cpu_port) if (is5301x(dev) && port == dev->cpu_port)
pause = MLO_PAUSE_TXRX_MASK; tx_pause = rx_pause = true;
if (phydev->pause) { if (phydev->pause) {
if (phydev->asym_pause) if (phydev->asym_pause)
pause |= MLO_PAUSE_TX; tx_pause = true;
pause |= MLO_PAUSE_RX; 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); b53_force_link(dev, port, phydev->link);
if (is531x5(dev) && phy_interface_is_rgmii(phydev)) { if (is531x5(dev) && phy_interface_is_rgmii(phydev)) {
...@@ -1166,7 +1169,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port, ...@@ -1166,7 +1169,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
} else if (is5301x(dev)) { } else if (is5301x(dev)) {
if (port != dev->cpu_port) { if (port != dev->cpu_port) {
b53_force_port_config(dev, dev->cpu_port, 2000, 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); b53_force_link(dev, dev->cpu_port, 1);
} }
} }
...@@ -1251,15 +1254,9 @@ void b53_phylink_mac_config(struct dsa_switch *ds, int port, ...@@ -1251,15 +1254,9 @@ void b53_phylink_mac_config(struct dsa_switch *ds, int port,
{ {
struct b53_device *dev = ds->priv; struct b53_device *dev = ds->priv;
if (mode == MLO_AN_PHY) if (mode == MLO_AN_PHY || mode == MLO_AN_FIXED)
return; return;
if (mode == MLO_AN_FIXED) {
b53_force_port_config(dev, port, state->speed,
state->duplex, state->pause);
return;
}
if ((phy_interface_mode_is_8023z(state->interface) || if ((phy_interface_mode_is_8023z(state->interface) ||
state->interface == PHY_INTERFACE_MODE_SGMII) && state->interface == PHY_INTERFACE_MODE_SGMII) &&
dev->ops->serdes_config) dev->ops->serdes_config)
...@@ -1309,6 +1306,8 @@ void b53_phylink_mac_link_up(struct dsa_switch *ds, int port, ...@@ -1309,6 +1306,8 @@ void b53_phylink_mac_link_up(struct dsa_switch *ds, int port,
return; return;
if (mode == MLO_AN_FIXED) { if (mode == MLO_AN_FIXED) {
b53_force_port_config(dev, port, speed, duplex,
tx_pause, rx_pause);
b53_force_link(dev, port, true); b53_force_link(dev, port, true);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment