This is a cosmetic patch that replaces the link speed numbers used in
the driver with the corresponding ethtool macros.
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-/* Convert back and forth MAC speed from Mbps to SJA1105 encoding */
+/* Convert link speed from SJA1105 to ethtool encoding */
static int sja1105_speed[] = {
static int sja1105_speed[] = {
- [SJA1105_SPEED_AUTO] = 0,
- [SJA1105_SPEED_10MBPS] = 10,
- [SJA1105_SPEED_100MBPS] = 100,
- [SJA1105_SPEED_1000MBPS] = 1000,
+ [SJA1105_SPEED_AUTO] = SPEED_UNKNOWN,
+ [SJA1105_SPEED_10MBPS] = SPEED_10,
+ [SJA1105_SPEED_100MBPS] = SPEED_100,
+ [SJA1105_SPEED_1000MBPS] = SPEED_1000,
};
/* Set link speed and enable/disable traffic I/O in the MAC configuration
};
/* Set link speed and enable/disable traffic I/O in the MAC configuration
mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
switch (speed_mbps) {
mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
switch (speed_mbps) {
/* No speed update requested */
speed = SJA1105_SPEED_AUTO;
break;
/* No speed update requested */
speed = SJA1105_SPEED_AUTO;
break;
speed = SJA1105_SPEED_10MBPS;
break;
speed = SJA1105_SPEED_10MBPS;
break;
speed = SJA1105_SPEED_100MBPS;
break;
speed = SJA1105_SPEED_100MBPS;
break;
speed = SJA1105_SPEED_1000MBPS;
break;
default:
speed = SJA1105_SPEED_1000MBPS;
break;
default:
struct sja1105_private *priv = ds->priv;
if (!state->link)
struct sja1105_private *priv = ds->priv;
if (!state->link)
- sja1105_adjust_port_config(priv, port, 0, false);
+ sja1105_adjust_port_config(priv, port, SPEED_UNKNOWN, false);
else
sja1105_adjust_port_config(priv, port, state->speed, true);
}
else
sja1105_adjust_port_config(priv, port, state->speed, true);
}
goto out;
for (i = 0; i < SJA1105_NUM_PORTS; i++) {
goto out;
for (i = 0; i < SJA1105_NUM_PORTS; i++) {
- bool enabled = (speed_mbps[i] != 0);
+ bool enabled = (speed_mbps[i] != SPEED_UNKNOWN);
if (i != dsa_upstream_port(priv->ds, i))
sja1105_bridge_stp_state_set(priv->ds, i, stp_state[i]);
if (i != dsa_upstream_port(priv->ds, i))
sja1105_bridge_stp_state_set(priv->ds, i, stp_state[i]);