net: dsa: b53: Export b53_imp_vlan_setup()
authorFlorian Fainelli <f.fainelli@gmail.com>
Tue, 19 Sep 2017 17:46:52 +0000 (10:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Sep 2017 23:08:54 +0000 (16:08 -0700)
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>
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_priv.h
drivers/net/dsa/bcm_sf2.c

index 4e37ec27e496abc493a6f3634c34626aa86e4469..c3f1cd2c33eacdb0f6b3890de4a3e503e4d4e9f1 100644 (file)
@@ -484,7 +484,7 @@ static int b53_fast_age_vlan(struct b53_device *dev, u16 vid)
        return b53_flush_arl(dev, FAST_AGE_VLAN);
 }
 
-static void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
+void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
 {
        struct b53_device *dev = ds->priv;
        unsigned int i;
@@ -500,6 +500,7 @@ static void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
                b53_write16(dev, B53_PVLAN_PAGE, B53_PVLAN_PORT_MASK(i), pvlan);
        }
 }
+EXPORT_SYMBOL(b53_imp_vlan_setup);
 
 static int b53_enable_port(struct dsa_switch *ds, int port,
                           struct phy_device *phy)
index aabe80eab25dc175c8877df01b78ee1c108bc4bc..8f4f83e2e4bdafe5ee6ec2b6df4ff6c98110f3be 100644 (file)
@@ -284,6 +284,7 @@ static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
 #endif
 
 /* Exported functions towards other drivers */
+void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
 void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data);
 void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
 int b53_get_sset_count(struct dsa_switch *ds);
index 4e8ef4c07eab8c271b8ff9fdd4e1d2d5274d5045..08639674947abf4915008ff74f3e5de80e45c335 100644 (file)
@@ -40,27 +40,6 @@ static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds)
        return DSA_TAG_PROTO_BRCM;
 }
 
-static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
-{
-       struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
-       unsigned int i;
-       u32 reg;
-
-       /* Enable the IMP Port to be in the same VLAN as the other ports
-        * on a per-port basis such that we only have Port i and IMP in
-        * the same VLAN.
-        */
-       for (i = 0; i < priv->hw_params.num_ports; i++) {
-               if (!((1 << i) & ds->enabled_port_mask))
-                       continue;
-
-               reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i));
-               reg |= (1 << cpu_port);
-               core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(i));
-       }
-}
-
-
 static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
 {
        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,
        reg |= priv->dev->ports[port].vlan_ctl_mask;
        core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(port));
 
-       bcm_sf2_imp_vlan_setup(ds, cpu_port);
+       b53_imp_vlan_setup(ds, cpu_port);
 
        /* If EEE was enabled, restore it */
        if (priv->dev->ports[port].eee.eee_enabled)