Skip to content

Commit aac0286

Browse files
ffainellidavem330
authored andcommitted
net: dsa: b53: Export b53_imp_vlan_setup()
bcm_sf2 and b53 do exactly the same thing, so share that piece. Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f43a2db commit aac0286

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static int b53_fast_age_vlan(struct b53_device *dev, u16 vid)
484484
return b53_flush_arl(dev, FAST_AGE_VLAN);
485485
}
486486

487-
static void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
487+
void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
488488
{
489489
struct b53_device *dev = ds->priv;
490490
unsigned int i;
@@ -500,6 +500,7 @@ static void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
500500
b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), pvlan);
501501
}
502502
}
503+
EXPORT_SYMBOL(b53_imp_vlan_setup);
503504

504505
static int b53_enable_port(struct dsa_switch *ds, int port,
505506
struct phy_device *phy)

drivers/net/dsa/b53/b53_priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
284284
#endif
285285

286286
/* Exported functions towards other drivers */
287+
void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
287288
void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data);
288289
void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
289290
int b53_get_sset_count(struct dsa_switch *ds);

drivers/net/dsa/bcm_sf2.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,6 @@ static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds)
4040
return DSA_TAG_PROTO_BRCM;
4141
}
4242

43-
static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
44-
{
45-
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
46-
unsigned int i;
47-
u32 reg;
48-
49-
/* Enable the IMP Port to be in the same VLAN as the other ports
50-
* on a per-port basis such that we only have Port i and IMP in
51-
* the same VLAN.
52-
*/
53-
for (i = 0; i < priv->hw_params.num_ports; i++) {
54-
if (!((1 << i) & ds->enabled_port_mask))
55-
continue;
56-
57-
reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i));
58-
reg |= (1 << cpu_port);
59-
core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(i));
60-
}
61-
}
62-
63-
6443
static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
6544
{
6645
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
@@ -240,7 +219,7 @@ static int bcm_sf2_port_setup(struct dsa_switch *ds, int port,
240219
reg |= priv->dev->ports[port].vlan_ctl_mask;
241220
core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(port));
242221

243-
bcm_sf2_imp_vlan_setup(ds, cpu_port);
222+
b53_imp_vlan_setup(ds, cpu_port);
244223

245224
/* If EEE was enabled, restore it */
246225
if (priv->dev->ports[port].eee.eee_enabled)

0 commit comments

Comments
 (0)