[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1440543015-14693-6-git-send-email-f.fainelli@gmail.com>
Date: Tue, 25 Aug 2015 15:50:15 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net, andrew@...n.ch, linux@...ck-us.net,
jiri@...nulli.us, sfeldma@...il.com,
Florian Fainelli <f.fainelli@...il.com>
Subject: [PATCH RFC 5/5] net: dsa: bcm_sf2: Allow disabling tagging protocol
Update the IMP port configuration to check whether tagging is enabled
(DSA_TAG_PROTO_BRCM) or disabled (DSA_TAG_PROTO_NONE) and correctly
program the relevant registers in both cases.
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
drivers/net/dsa/bcm_sf2.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 289e20443d83..68abcc545231 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -159,6 +159,7 @@ static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
{
+ bool tagging_disabled = !!(ds->tag_protocol == DSA_TAG_PROTO_NONE);
struct bcm_sf2_priv *priv = ds_to_priv(ds);
u32 reg, val;
@@ -199,21 +200,30 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
/* Enable Broadcom tags for IMP port */
reg = core_readl(priv, CORE_BRCM_HDR_CTRL);
- reg |= val;
+ if (!tagging_disabled)
+ reg |= val;
+ else
+ reg &= ~val;
core_writel(priv, reg, CORE_BRCM_HDR_CTRL);
/* Enable reception Broadcom tag for CPU TX (switch RX) to
* allow us to tag outgoing frames
*/
reg = core_readl(priv, CORE_BRCM_HDR_RX_DIS);
- reg &= ~(1 << port);
+ if (tagging_disabled)
+ reg |= 1 << port;
+ else
+ reg &= ~(1 << port);
core_writel(priv, reg, CORE_BRCM_HDR_RX_DIS);
/* Enable transmission of Broadcom tags from the switch (CPU RX) to
* allow delivering frames to the per-port net_devices
*/
reg = core_readl(priv, CORE_BRCM_HDR_TX_DIS);
- reg &= ~(1 << port);
+ if (tagging_disabled)
+ reg |= 1 << port;
+ else
+ reg &= ~(1 << port);
core_writel(priv, reg, CORE_BRCM_HDR_TX_DIS);
/* Force link status for IMP port */
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists