Skip to content

Commit 8fab459

Browse files
ffainellidavem330
authored andcommitted
net: dsa: b53: Enable Broadcom tags for 531x5/539x families
The BCM531x5 and BCM539x families require that the IMP port be enabled within the management page and that management mode (SM_SW_FWD_MODE) be turned on. Once this is done, everything works as expected, including multicast with standalone DSA devices or bridge devices. Because such switches are frequencly cascaded with other internal Broadcom switches on which we want to enable Broadcom tags, update b53_can_enable_brcm_tags() to check the kind of DSA master tagging protocol being used, if it is one of the two supported Broadcom tagging protocols, force DSA_TAG_PROTO_NONE. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4d77648 commit 8fab459

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,6 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable,
371371
b53_read8(dev, B53_VLAN_PAGE, B53_VLAN_CTRL5, &vc5);
372372
}
373373

374-
mgmt &= ~SM_SW_FWD_MODE;
375-
376374
if (enable) {
377375
vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID;
378376
vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN;
@@ -594,6 +592,22 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
594592
break;
595593
}
596594

595+
/* Enable management mode if tagging is requested */
596+
b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &hdr_ctl);
597+
if (tag_en)
598+
hdr_ctl |= SM_SW_FWD_MODE;
599+
else
600+
hdr_ctl &= ~SM_SW_FWD_MODE;
601+
b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, hdr_ctl);
602+
603+
/* Configure the appropriate IMP port */
604+
b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &hdr_ctl);
605+
if (port == 8)
606+
hdr_ctl |= GC_FRM_MGMT_PORT_MII;
607+
else if (port == 5)
608+
hdr_ctl |= GC_FRM_MGMT_PORT_M;
609+
b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl);
610+
597611
/* Enable Broadcom tags for IMP port */
598612
b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl);
599613
if (tag_en)
@@ -1865,13 +1879,29 @@ static bool b53_possible_cpu_port(struct dsa_switch *ds, int port)
18651879
return false;
18661880
}
18671881

1868-
static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port)
1882+
static bool b53_can_enable_brcm_tags(struct dsa_switch *ds, int port,
1883+
enum dsa_tag_protocol tag_protocol)
18691884
{
18701885
bool ret = b53_possible_cpu_port(ds, port);
18711886

1872-
if (!ret)
1887+
if (!ret) {
18731888
dev_warn(ds->dev, "Port %d is not Broadcom tag capable\n",
18741889
port);
1890+
return ret;
1891+
}
1892+
1893+
switch (tag_protocol) {
1894+
case DSA_TAG_PROTO_BRCM:
1895+
case DSA_TAG_PROTO_BRCM_PREPEND:
1896+
dev_warn(ds->dev,
1897+
"Port %d is stacked to Broadcom tag switch\n", port);
1898+
ret = false;
1899+
break;
1900+
default:
1901+
ret = true;
1902+
break;
1903+
}
1904+
18751905
return ret;
18761906
}
18771907

@@ -1881,12 +1911,10 @@ enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
18811911
struct b53_device *dev = ds->priv;
18821912

18831913
/* Older models (5325, 5365) support a different tag format that we do
1884-
* not support in net/dsa/tag_brcm.c yet. 539x and 531x5 require managed
1885-
* mode to be turned on which means we need to specifically manage ARL
1886-
* misses on multicast addresses (TBD).
1914+
* not support in net/dsa/tag_brcm.c yet.
18871915
*/
1888-
if (is5325(dev) || is5365(dev) || is539x(dev) || is531x5(dev) ||
1889-
!b53_can_enable_brcm_tags(ds, port)) {
1916+
if (is5325(dev) || is5365(dev) ||
1917+
!b53_can_enable_brcm_tags(ds, port, mprot)) {
18901918
dev->tag_protocol = DSA_TAG_PROTO_NONE;
18911919
goto out;
18921920
}

0 commit comments

Comments
 (0)