summaryrefslogtreecommitdiff
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2021-11-27 16:05:36 +0000
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-05-09 18:17:31 +0100
commit8b4e465f0d10115f74c05cdb746a8cde407186ef (patch)
tree5c1def2cb98b8972014fff8ff6a320f9e261f8d7 /drivers/net/dsa
parent86f12e762f917927d8fd024b72e0061732676491 (diff)
net: use phylink_mode_*() helpers
Use the phylink_mode_*() helpers in all drivers so we can change the definition of the "mode" argument. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/b53/b53_common.c7
-rw-r--r--drivers/net/dsa/bcm_sf2.c2
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c13
-rw-r--r--drivers/net/dsa/mv88e6xxx/port.c2
4 files changed, 13 insertions, 11 deletions
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 3bd665fbbd8d..c7bdf24c50b7 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1426,10 +1426,10 @@ static void b53_phylink_mac_link_down(struct phylink_config *config,
struct b53_device *dev = dp->ds->priv;
int port = dp->index;
- if (mode == MLO_AN_PHY)
+ if (phylink_mode_phy(mode))
return;
- if (mode == MLO_AN_FIXED) {
+ if (phylink_mode_fixed(mode)) {
b53_force_link(dev, port, false);
return;
}
@@ -1452,12 +1452,13 @@ static void b53_phylink_mac_link_up(struct phylink_config *config,
struct ethtool_eee *p = &dev->ports[dp->index].eee;
int port = dp->index;
- if (mode == MLO_AN_PHY) {
+ if (phylink_mode_phy(mode)) {
/* Re-negotiate EEE if it was enabled already */
p->eee_enabled = b53_eee_init(ds, port, phydev);
return;
}
+ if (phylink_mode_fixed(mode)) {
if (mode == MLO_AN_FIXED) {
/* Force flow control on BCM5301x's CPU port */
if (is5301x(dev) && dsa_is_cpu_port(ds, port))
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 379456a294d7..0736b894c926 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -895,7 +895,7 @@ static void bcm_sf2_sw_mac_link_up(struct phylink_config *config,
core_writel(priv, reg, offset);
- if (mode == MLO_AN_PHY && phydev) {
+ if (phylink_mode_phy(mode) && phydev) {
p = &priv->dev->ports[port].eee;
p->eee_enabled = b53_eee_init(dp->ds, port, phydev);
}
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 82cf99680cfe..41837d66b804 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -817,7 +817,7 @@ static int mv88e6xxx_mac_prepare(struct phylink_config *config,
* is not forced down. Force the link down while we reconfigure the
* interface mode.
*/
- if (mode == MLO_AN_INBAND &&
+ if (phylink_mode_inband(mode) &&
chip->ports[port].interface != interface &&
chip->info->ops->port_set_link) {
mv88e6xxx_reg_lock(chip);
@@ -840,7 +840,7 @@ static void mv88e6xxx_mac_config(struct phylink_config *config,
mv88e6xxx_reg_lock(chip);
- if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(chip, port)) {
+ if (!phylink_mode_phy(mode) || !mv88e6xxx_phy_is_internal(chip, port)) {
err = mv88e6xxx_port_config_interface(chip, port,
state->interface);
if (err && err != -EOPNOTSUPP)
@@ -871,9 +871,10 @@ static int mv88e6xxx_mac_finish(struct phylink_config *config,
mv88e6xxx_reg_lock(chip);
if (chip->info->ops->port_set_link &&
- ((mode == MLO_AN_INBAND &&
+ ((phylink_mode_inband(mode) &&
chip->ports[port].interface != interface) ||
- (mode == MLO_AN_PHY && mv88e6xxx_port_ppu_updates(chip, port))))
+ (phylink_mode_phy(mode) &&
+ mv88e6xxx_port_ppu_updates(chip, port))))
err = chip->info->ops->port_set_link(chip, port, LINK_UNFORCED);
mv88e6xxx_reg_unlock(chip);
@@ -900,7 +901,7 @@ static void mv88e6xxx_mac_link_down(struct phylink_config *config,
* updated by the switch or if we are using fixed-link mode.
*/
if ((!mv88e6xxx_port_ppu_updates(chip, port) ||
- mode == MLO_AN_FIXED) && ops->port_sync_link)
+ phylink_mode_fixed(mode)) && ops->port_sync_link)
err = ops->port_sync_link(chip, port, mode, false);
if (!err && ops->port_set_speed_duplex)
@@ -933,7 +934,7 @@ static void mv88e6xxx_mac_link_up(struct phylink_config *config,
* mode.
*/
if (!mv88e6xxx_port_ppu_updates(chip, port) ||
- mode == MLO_AN_FIXED) {
+ phylink_mode_fixed(mode)) {
if (ops->port_set_speed_duplex) {
err = ops->port_set_speed_duplex(chip, port,
speed, duplex);
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c
index 02870f001f5f..ef9bb3974f33 100644
--- a/drivers/net/dsa/mv88e6xxx/port.c
+++ b/drivers/net/dsa/mv88e6xxx/port.c
@@ -203,7 +203,7 @@ int mv88e6185_port_sync_link(struct mv88e6xxx_chip *chip, int port, unsigned int
int err = 0;
int link;
- if (mode == MLO_AN_INBAND)
+ if (phylink_mode_inband(mode))
link = LINK_UNFORCED;
else if (isup)
link = LINK_FORCED_UP;