Commit 74c3e2a5 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

dsa: Rename phys_port_mask to enabled_port_mask

The phys in phys_port_mask suggests this mask is about PHYs. In fact,
it means physical ports. Rename to enabled_port_mask, indicating
external enabled ports of the switch, which is hopefully less
confusing.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Tested-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e49bad31
...@@ -160,7 +160,7 @@ static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) ...@@ -160,7 +160,7 @@ static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
* the same VLAN. * the same VLAN.
*/ */
for (i = 0; i < priv->hw_params.num_ports; i++) { for (i = 0; i < priv->hw_params.num_ports; i++) {
if (!((1 << i) & ds->phys_port_mask)) if (!((1 << i) & ds->enabled_port_mask))
continue; continue;
reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i)); reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i));
...@@ -1009,7 +1009,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) ...@@ -1009,7 +1009,7 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
/* Enable all valid ports and disable those unused */ /* Enable all valid ports and disable those unused */
for (port = 0; port < priv->hw_params.num_ports; port++) { for (port = 0; port < priv->hw_params.num_ports; port++) {
/* IMP port receives special treatment */ /* IMP port receives special treatment */
if ((1 << port) & ds->phys_port_mask) if ((1 << port) & ds->enabled_port_mask)
bcm_sf2_port_setup(ds, port, NULL); bcm_sf2_port_setup(ds, port, NULL);
else if (dsa_is_cpu_port(ds, port)) else if (dsa_is_cpu_port(ds, port))
bcm_sf2_imp_setup(ds, port); bcm_sf2_imp_setup(ds, port);
...@@ -1022,11 +1022,12 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds) ...@@ -1022,11 +1022,12 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
* 7445D0, since 7445E0 disconnects the internal switch pseudo-PHY such * 7445D0, since 7445E0 disconnects the internal switch pseudo-PHY such
* that we can use the regular SWITCH_MDIO master controller instead. * that we can use the regular SWITCH_MDIO master controller instead.
* *
* By default, DSA initializes ds->phys_mii_mask to ds->phys_port_mask * By default, DSA initializes ds->phys_mii_mask to
* to have a 1:1 mapping between Port address and PHY address in order * ds->enabled_port_mask to have a 1:1 mapping between Port address
* to utilize the slave_mii_bus instance to read from Port PHYs. This is * and PHY address in order to utilize the slave_mii_bus instance to
* not what we want here, so we initialize phys_mii_mask 0 to always * read from Port PHYs. This is not what we want here, so we
* utilize the "master" MDIO bus backed by the "mdio-unimac" driver. * initialize phys_mii_mask 0 to always utilize the "master" MDIO
* bus backed by the "mdio-unimac" driver.
*/ */
if (of_machine_is_compatible("brcm,bcm7445d0")) if (of_machine_is_compatible("brcm,bcm7445d0"))
ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0)); ds->phys_mii_mask |= ((1 << BRCM_PSEUDO_PHY_ADDR) | (1 << 0));
...@@ -1284,7 +1285,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds) ...@@ -1284,7 +1285,7 @@ static int bcm_sf2_sw_suspend(struct dsa_switch *ds)
* bcm_sf2_sw_setup * bcm_sf2_sw_setup
*/ */
for (port = 0; port < DSA_MAX_PORTS; port++) { for (port = 0; port < DSA_MAX_PORTS; port++) {
if ((1 << port) & ds->phys_port_mask || if ((1 << port) & ds->enabled_port_mask ||
dsa_is_cpu_port(ds, port)) dsa_is_cpu_port(ds, port))
bcm_sf2_port_disable(ds, port, NULL); bcm_sf2_port_disable(ds, port, NULL);
} }
...@@ -1308,7 +1309,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds) ...@@ -1308,7 +1309,7 @@ static int bcm_sf2_sw_resume(struct dsa_switch *ds)
bcm_sf2_gphy_enable_set(ds, true); bcm_sf2_gphy_enable_set(ds, true);
for (port = 0; port < DSA_MAX_PORTS; port++) { for (port = 0; port < DSA_MAX_PORTS; port++) {
if ((1 << port) & ds->phys_port_mask) if ((1 << port) & ds->enabled_port_mask)
bcm_sf2_port_setup(ds, port, NULL); bcm_sf2_port_setup(ds, port, NULL);
else if (dsa_is_cpu_port(ds, port)) else if (dsa_is_cpu_port(ds, port))
bcm_sf2_imp_setup(ds, port); bcm_sf2_imp_setup(ds, port);
......
...@@ -170,7 +170,7 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p) ...@@ -170,7 +170,7 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
REG_WRITE(addr, PORT_VLAN_MAP, REG_WRITE(addr, PORT_VLAN_MAP,
((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) | ((p & 0xf) << PORT_VLAN_MAP_DBNUM_SHIFT) |
(dsa_is_cpu_port(ds, p) ? (dsa_is_cpu_port(ds, p) ?
ds->phys_port_mask : ds->enabled_port_mask :
BIT(ds->dst->cpu_port))); BIT(ds->dst->cpu_port)));
/* Port Association Vector: when learning source addresses /* Port Association Vector: when learning source addresses
......
...@@ -167,7 +167,7 @@ struct dsa_switch { ...@@ -167,7 +167,7 @@ struct dsa_switch {
* Slave mii_bus and devices for the individual ports. * Slave mii_bus and devices for the individual ports.
*/ */
u32 dsa_port_mask; u32 dsa_port_mask;
u32 phys_port_mask; u32 enabled_port_mask;
u32 phys_mii_mask; u32 phys_mii_mask;
struct mii_bus *slave_mii_bus; struct mii_bus *slave_mii_bus;
struct net_device *ports[DSA_MAX_PORTS]; struct net_device *ports[DSA_MAX_PORTS];
...@@ -185,7 +185,7 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p) ...@@ -185,7 +185,7 @@ static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p)
static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p) static inline bool dsa_is_port_initialized(struct dsa_switch *ds, int p)
{ {
return ds->phys_port_mask & (1 << p) && ds->ports[p]; return ds->enabled_port_mask & (1 << p) && ds->ports[p];
} }
static inline u8 dsa_upstream_port(struct dsa_switch *ds) static inline u8 dsa_upstream_port(struct dsa_switch *ds)
......
...@@ -246,7 +246,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent) ...@@ -246,7 +246,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
} else if (!strcmp(name, "dsa")) { } else if (!strcmp(name, "dsa")) {
ds->dsa_port_mask |= 1 << i; ds->dsa_port_mask |= 1 << i;
} else { } else {
ds->phys_port_mask |= 1 << i; ds->enabled_port_mask |= 1 << i;
} }
valid_name_found = true; valid_name_found = true;
} }
...@@ -259,7 +259,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent) ...@@ -259,7 +259,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
/* Make the built-in MII bus mask match the number of ports, /* Make the built-in MII bus mask match the number of ports,
* switch drivers can override this later * switch drivers can override this later
*/ */
ds->phys_mii_mask = ds->phys_port_mask; ds->phys_mii_mask = ds->enabled_port_mask;
/* /*
* If the CPU connects to this switch, set the switch tree * If the CPU connects to this switch, set the switch tree
...@@ -325,7 +325,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent) ...@@ -325,7 +325,7 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
* Create network devices for physical switch ports. * Create network devices for physical switch ports.
*/ */
for (i = 0; i < DSA_MAX_PORTS; i++) { for (i = 0; i < DSA_MAX_PORTS; i++) {
if (!(ds->phys_port_mask & (1 << i))) if (!(ds->enabled_port_mask & (1 << i)))
continue; continue;
ret = dsa_slave_create(ds, parent, i, pd->port_names[i]); ret = dsa_slave_create(ds, parent, i, pd->port_names[i]);
...@@ -435,7 +435,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds) ...@@ -435,7 +435,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
/* Destroy network devices for physical switch ports. */ /* Destroy network devices for physical switch ports. */
for (port = 0; port < DSA_MAX_PORTS; port++) { for (port = 0; port < DSA_MAX_PORTS; port++) {
if (!(ds->phys_port_mask & (1 << port))) if (!(ds->enabled_port_mask & (1 << port)))
continue; continue;
if (!ds->ports[port]) if (!ds->ports[port])
......
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