mt7530.c (41fb0cf1bced59c1fe178cf6cc9f716b5da9e40e) | mt7530.c (d3eed0e57d5d1bcbf1bd60f83a4adfe7d7b8dd9c) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Mediatek MT7530 DSA Switch driver 4 * Copyright (C) 2017 Sean Wang <sean.wang@mediatek.com> 5 */ 6#include <linux/etherdevice.h> 7#include <linux/if_bridge.h> 8#include <linux/iopoll.h> --- 1172 unchanged lines hidden (view full) --- 1181 mt7530_rmw(priv, MT7530_MFC, BC_FFP(BIT(port)), 1182 flags.val & BR_BCAST_FLOOD ? BC_FFP(BIT(port)) : 0); 1183 1184 return 0; 1185} 1186 1187static int 1188mt7530_port_bridge_join(struct dsa_switch *ds, int port, | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Mediatek MT7530 DSA Switch driver 4 * Copyright (C) 2017 Sean Wang <sean.wang@mediatek.com> 5 */ 6#include <linux/etherdevice.h> 7#include <linux/if_bridge.h> 8#include <linux/iopoll.h> --- 1172 unchanged lines hidden (view full) --- 1181 mt7530_rmw(priv, MT7530_MFC, BC_FFP(BIT(port)), 1182 flags.val & BR_BCAST_FLOOD ? BC_FFP(BIT(port)) : 0); 1183 1184 return 0; 1185} 1186 1187static int 1188mt7530_port_bridge_join(struct dsa_switch *ds, int port, |
1189 struct net_device *bridge) | 1189 struct dsa_bridge bridge) |
1190{ 1191 struct dsa_port *dp = dsa_to_port(ds, port), *other_dp; 1192 u32 port_bitmap = BIT(MT7530_CPU_PORT); 1193 struct mt7530_priv *priv = ds->priv; 1194 1195 mutex_lock(&priv->reg_mutex); 1196 1197 dsa_switch_for_each_user_port(other_dp, ds) { 1198 int other_port = other_dp->index; 1199 1200 if (dp == other_dp) 1201 continue; 1202 1203 /* Add this port to the port matrix of the other ports in the 1204 * same bridge. If the port is disabled, port matrix is kept 1205 * and not being setup until the port becomes enabled. 1206 */ | 1190{ 1191 struct dsa_port *dp = dsa_to_port(ds, port), *other_dp; 1192 u32 port_bitmap = BIT(MT7530_CPU_PORT); 1193 struct mt7530_priv *priv = ds->priv; 1194 1195 mutex_lock(&priv->reg_mutex); 1196 1197 dsa_switch_for_each_user_port(other_dp, ds) { 1198 int other_port = other_dp->index; 1199 1200 if (dp == other_dp) 1201 continue; 1202 1203 /* Add this port to the port matrix of the other ports in the 1204 * same bridge. If the port is disabled, port matrix is kept 1205 * and not being setup until the port becomes enabled. 1206 */ |
1207 if (dsa_port_bridge_dev_get(other_dp) != bridge) | 1207 if (!dsa_port_offloads_bridge(other_dp, &bridge)) |
1208 continue; 1209 1210 if (priv->ports[other_port].enable) 1211 mt7530_set(priv, MT7530_PCR_P(other_port), 1212 PCR_MATRIX(BIT(port))); 1213 priv->ports[other_port].pm |= PCR_MATRIX(BIT(port)); 1214 1215 port_bitmap |= BIT(other_port); --- 82 unchanged lines hidden (view full) --- 1298 */ 1299 mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK, 1300 VLAN_ATTR(MT7530_VLAN_USER) | 1301 PVC_EG_TAG(MT7530_VLAN_EG_DISABLED)); 1302} 1303 1304static void 1305mt7530_port_bridge_leave(struct dsa_switch *ds, int port, | 1208 continue; 1209 1210 if (priv->ports[other_port].enable) 1211 mt7530_set(priv, MT7530_PCR_P(other_port), 1212 PCR_MATRIX(BIT(port))); 1213 priv->ports[other_port].pm |= PCR_MATRIX(BIT(port)); 1214 1215 port_bitmap |= BIT(other_port); --- 82 unchanged lines hidden (view full) --- 1298 */ 1299 mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK, 1300 VLAN_ATTR(MT7530_VLAN_USER) | 1301 PVC_EG_TAG(MT7530_VLAN_EG_DISABLED)); 1302} 1303 1304static void 1305mt7530_port_bridge_leave(struct dsa_switch *ds, int port, |
1306 struct net_device *bridge) | 1306 struct dsa_bridge bridge) |
1307{ 1308 struct dsa_port *dp = dsa_to_port(ds, port), *other_dp; 1309 struct mt7530_priv *priv = ds->priv; 1310 1311 mutex_lock(&priv->reg_mutex); 1312 1313 dsa_switch_for_each_user_port(other_dp, ds) { 1314 int other_port = other_dp->index; 1315 1316 if (dp == other_dp) 1317 continue; 1318 1319 /* Remove this port from the port matrix of the other ports 1320 * in the same bridge. If the port is disabled, port matrix 1321 * is kept and not being setup until the port becomes enabled. 1322 */ | 1307{ 1308 struct dsa_port *dp = dsa_to_port(ds, port), *other_dp; 1309 struct mt7530_priv *priv = ds->priv; 1310 1311 mutex_lock(&priv->reg_mutex); 1312 1313 dsa_switch_for_each_user_port(other_dp, ds) { 1314 int other_port = other_dp->index; 1315 1316 if (dp == other_dp) 1317 continue; 1318 1319 /* Remove this port from the port matrix of the other ports 1320 * in the same bridge. If the port is disabled, port matrix 1321 * is kept and not being setup until the port becomes enabled. 1322 */ |
1323 if (dsa_port_bridge_dev_get(other_dp) != bridge) | 1323 if (!dsa_port_offloads_bridge(other_dp, &bridge)) |
1324 continue; 1325 1326 if (priv->ports[other_port].enable) 1327 mt7530_clear(priv, MT7530_PCR_P(other_port), 1328 PCR_MATRIX(BIT(port))); 1329 priv->ports[other_port].pm &= ~PCR_MATRIX(BIT(port)); 1330 } 1331 --- 2008 unchanged lines hidden --- | 1324 continue; 1325 1326 if (priv->ports[other_port].enable) 1327 mt7530_clear(priv, MT7530_PCR_P(other_port), 1328 PCR_MATRIX(BIT(port))); 1329 priv->ports[other_port].pm &= ~PCR_MATRIX(BIT(port)); 1330 } 1331 --- 2008 unchanged lines hidden --- |