aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/dsa/mt7530.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-10-28 00:00:10 +0900
committerDavid S. Miller <davem@davemloft.net>2017-10-28 00:00:10 +0900
commite324615b47fba404f28c709ee0db02d75829ce43 (patch)
treead4d849b5d26b0745930361f7d22f2f47e66b205 /drivers/net/dsa/mt7530.c
parent5bca178eed601cd4584c38c5290f7abbcacf3fb3 (diff)
parent5749f0f3772b9d98f37e3a92539f49fafaa64eca (diff)
Merge branch 'dsa-define-port-types'
Vivien Didelot says: ==================== net: dsa: define port types The DSA code currently has 3 bitmaps in the dsa_switch structure: cpu_port_mask, dsa_port_mask and enabled_port_mask. They are used to store the type of each switch port. This dates back from when DSA didn't have a dsa_port structure to hold port-specific data. The dsa_switch structure is mainly used to communicate with DSA drivers and must not contain such static data parsed from DTS or pdata, which belongs the DSA core structures, such as dsa_switch_tree and dsa_port. Also the enabled_port_mask is misleading, often misinterpreted as the complement of disabled ports (thus including DSA and CPU ports), while in fact it only masks the user ports. A port can be of 3 types when it is not unused: "cpu" (interfacing with a master device), "dsa" (interconnecting with another "dsa" port from another switch chip), or "user" (user-facing port.) This patchset first fixes the usage of DSA port type helpers, then defines the DSA_PORT_TYPE_UNUSED, DSA_PORT_TYPE_CPU, DSA_PORT_TYPE_DSA, and DSA_PORT_TYPE_USER port types, and finally removes the misleading port bitmaps. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mt7530.c')
-rw-r--r--drivers/net/dsa/mt7530.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 21431be2831e..627c039f12ca 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -688,7 +688,7 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv,
* the switch
*/
mt7530_write(priv, MT7530_PCR_P(port),
- PCR_MATRIX(priv->ds->enabled_port_mask));
+ PCR_MATRIX(dsa_user_ports(priv->ds)));
return 0;
}
@@ -781,7 +781,7 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port,
* same bridge. If the port is disabled, port matrix is kept
* and not being setup until the port becomes enabled.
*/
- if (ds->enabled_port_mask & BIT(i) && i != port) {
+ if (dsa_is_user_port(ds, i) && i != port) {
if (dsa_to_port(ds, i)->bridge_dev != bridge)
continue;
if (priv->ports[i].enable)
@@ -818,7 +818,7 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
* in the same bridge. If the port is disabled, port matrix
* is kept and not being setup until the port becomes enabled.
*/
- if (ds->enabled_port_mask & BIT(i) && i != port) {
+ if (dsa_is_user_port(ds, i) && i != port) {
if (dsa_to_port(ds, i)->bridge_dev != bridge)
continue;
if (priv->ports[i].enable)