aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-08-22 10:01:01 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-23 00:08:08 -0400
commit7b314362a2344feaafbdf6aa8f3d57077728e37a (patch)
tree348a762b9bcfb4bb4adc2d0648dcd44e3d04865c /drivers/net/dsa
parent1ae292a2457cd692828da2be87cb967260993ad0 (diff)
net: dsa: Allow the DSA driver to indicate the tag protocol
DSA drivers may drive different families of switches which need different tag protocol. Rather than hard code the tag protocol in the driver structure, have a callback for the DSA core to call. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r--drivers/net/dsa/b53/b53_common.c7
-rw-r--r--drivers/net/dsa/bcm_sf2.c7
-rw-r--r--drivers/net/dsa/mv88e6060.c7
-rw-r--r--drivers/net/dsa/mv88e6xxx/chip.c7
4 files changed, 24 insertions, 4 deletions
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 38ee10de7884..65ecb51f99e5 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1373,8 +1373,13 @@ static void b53_br_set_stp_state(struct dsa_switch *ds, int port,
1373 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), reg); 1373 b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(port), reg);
1374} 1374}
1375 1375
1376static enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds)
1377{
1378 return DSA_TAG_PROTO_NONE;
1379}
1380
1376static struct dsa_switch_driver b53_switch_ops = { 1381static struct dsa_switch_driver b53_switch_ops = {
1377 .tag_protocol = DSA_TAG_PROTO_NONE, 1382 .get_tag_protocol = b53_get_tag_protocol,
1378 .setup = b53_setup, 1383 .setup = b53_setup,
1379 .set_addr = b53_set_addr, 1384 .set_addr = b53_set_addr,
1380 .get_strings = b53_get_strings, 1385 .get_strings = b53_get_strings,
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 8e6fe13dbec3..b47a74b37a42 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -136,6 +136,11 @@ static int bcm_sf2_sw_get_sset_count(struct dsa_switch *ds)
136 return BCM_SF2_STATS_SIZE; 136 return BCM_SF2_STATS_SIZE;
137} 137}
138 138
139static enum dsa_tag_protocol bcm_sf2_sw_get_tag_protocol(struct dsa_switch *ds)
140{
141 return DSA_TAG_PROTO_BRCM;
142}
143
139static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port) 144static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
140{ 145{
141 struct bcm_sf2_priv *priv = ds_to_priv(ds); 146 struct bcm_sf2_priv *priv = ds_to_priv(ds);
@@ -1577,8 +1582,8 @@ static int bcm_sf2_sw_setup(struct dsa_switch *ds)
1577} 1582}
1578 1583
1579static struct dsa_switch_driver bcm_sf2_switch_driver = { 1584static struct dsa_switch_driver bcm_sf2_switch_driver = {
1580 .tag_protocol = DSA_TAG_PROTO_BRCM,
1581 .setup = bcm_sf2_sw_setup, 1585 .setup = bcm_sf2_sw_setup,
1586 .get_tag_protocol = bcm_sf2_sw_get_tag_protocol,
1582 .set_addr = bcm_sf2_sw_set_addr, 1587 .set_addr = bcm_sf2_sw_set_addr,
1583 .get_phy_flags = bcm_sf2_sw_get_phy_flags, 1588 .get_phy_flags = bcm_sf2_sw_get_phy_flags,
1584 .get_strings = bcm_sf2_sw_get_strings, 1589 .get_strings = bcm_sf2_sw_get_strings,
diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index e36b40886bd8..1fdfbf3a50bc 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -69,6 +69,11 @@ static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
69 return NULL; 69 return NULL;
70} 70}
71 71
72static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds)
73{
74 return DSA_TAG_PROTO_TRAILER;
75}
76
72static const char *mv88e6060_drv_probe(struct device *dsa_dev, 77static const char *mv88e6060_drv_probe(struct device *dsa_dev,
73 struct device *host_dev, int sw_addr, 78 struct device *host_dev, int sw_addr,
74 void **_priv) 79 void **_priv)
@@ -248,7 +253,7 @@ mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
248} 253}
249 254
250static struct dsa_switch_driver mv88e6060_switch_driver = { 255static struct dsa_switch_driver mv88e6060_switch_driver = {
251 .tag_protocol = DSA_TAG_PROTO_TRAILER, 256 .get_tag_protocol = mv88e6060_get_tag_protocol,
252 .probe = mv88e6060_drv_probe, 257 .probe = mv88e6060_drv_probe,
253 .setup = mv88e6060_setup, 258 .setup = mv88e6060_setup,
254 .set_addr = mv88e6060_set_addr, 259 .set_addr = mv88e6060_set_addr,
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 014b52bd72f1..63cad6c00bc7 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3924,6 +3924,11 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip,
3924 return 0; 3924 return 0;
3925} 3925}
3926 3926
3927static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds)
3928{
3929 return DSA_TAG_PROTO_EDSA;
3930}
3931
3927static const char *mv88e6xxx_drv_probe(struct device *dsa_dev, 3932static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,
3928 struct device *host_dev, int sw_addr, 3933 struct device *host_dev, int sw_addr,
3929 void **priv) 3934 void **priv)
@@ -3967,8 +3972,8 @@ free:
3967} 3972}
3968 3973
3969static struct dsa_switch_driver mv88e6xxx_switch_driver = { 3974static struct dsa_switch_driver mv88e6xxx_switch_driver = {
3970 .tag_protocol = DSA_TAG_PROTO_EDSA,
3971 .probe = mv88e6xxx_drv_probe, 3975 .probe = mv88e6xxx_drv_probe,
3976 .get_tag_protocol = mv88e6xxx_get_tag_protocol,
3972 .setup = mv88e6xxx_setup, 3977 .setup = mv88e6xxx_setup,
3973 .set_addr = mv88e6xxx_set_addr, 3978 .set_addr = mv88e6xxx_set_addr,
3974 .adjust_link = mv88e6xxx_adjust_link, 3979 .adjust_link = mv88e6xxx_adjust_link,