[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190618175712.71148-2-b.spranger@linutronix.de>
Date: Tue, 18 Jun 2019 19:57:11 +0200
From: Benedikt Spranger <b.spranger@...utronix.de>
To: netdev@...r.kernel.org
Cc: Florian Fainelli <f.fainelli@...il.com>,
Benedikt Spranger <b.spranger@...utronix.de>
Subject: [RFC PATCH 1/2] net: dsa: b53: Turn on managed mode and set IMP port
From: Florian Fainelli <f.fainelli@...il.com>
When enabling Broadcom tags on earlier devices such as BCM53125, we need
to also enable Managed mode, as well as configure which port is going to
be the IMP port. If we did not do that, the switch would just pass
through the Broadcom tags on the wire and not act on them. We need to
have bcm_sf2 stop overwriting the SWMODE register and let b53 deal with
that now.
Fixes: 7edc58d614d4 ("net: dsa: b53: Turn on Broadcom tags")
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
Signed-off-by: Benedikt Spranger <b.spranger@...utronix.de>
---
drivers/net/dsa/b53/b53_common.c | 19 +++++++++++++++----
drivers/net/dsa/bcm_sf2.c | 3 ---
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index c8040ecf4425..06b9a7a81ae0 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -331,9 +331,9 @@ static void b53_set_forwarding(struct b53_device *dev, int enable)
b53_read8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, &mgmt);
if (enable)
- mgmt |= SM_SW_FWD_EN;
+ mgmt |= SM_SW_FWD_EN | SM_SW_FWD_MODE;
else
- mgmt &= ~SM_SW_FWD_EN;
+ mgmt &= ~(SM_SW_FWD_EN | SM_SW_FWD_MODE);
b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);
@@ -364,8 +364,6 @@ static void b53_enable_vlan(struct b53_device *dev, bool enable,
b53_read8(dev, B53_VLAN_PAGE, B53_VLAN_CTRL5, &vc5);
}
- mgmt &= ~SM_SW_FWD_MODE;
-
if (enable) {
vc0 |= VC0_VLAN_EN | VC0_VID_CHK_EN | VC0_VID_HASH_VID;
vc1 |= VC1_RX_MCST_UNTAG_EN | VC1_RX_MCST_FWD_EN;
@@ -589,6 +587,19 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
hdr_ctl &= ~val;
b53_write8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, hdr_ctl);
+ /* Set IMP port number, necessary for Broadcom tags to be used
+ * while in managed mode
+ */
+ if (tag_en) {
+ b53_read8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, &hdr_ctl);
+ hdr_ctl &= ~GC_FRM_MGMT_PORT_M;
+ val = 0;
+ if (port == 8)
+ val = GC_FRM_MGMT_PORT_MII;
+ hdr_ctl |= val;
+ b53_write8(dev, B53_MGMT_PAGE, B53_GLOBAL_CONFIG, hdr_ctl);
+ }
+
/* Registers below are only accessible on newer devices */
if (!is58xx(dev))
return;
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 3811fdbda13e..47f55dab14f6 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -53,9 +53,6 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
reg &= ~(RX_DIS | TX_DIS);
core_writel(priv, reg, CORE_IMP_CTL);
- /* Enable forwarding */
- core_writel(priv, SW_FWDG_EN, CORE_SWMODE);
-
/* Enable IMP port in dumb mode */
reg = core_readl(priv, CORE_SWITCH_CTRL);
reg |= MII_DUMB_FWDG_EN;
--
2.19.0
Powered by blists - more mailing lists