mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-21 12:05:23 +00:00
kernel: backport b53/bcm_sf2 changes from v5.5
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
parent
202d404f74
commit
067d7e9f90
@ -26,7 +26,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/gpio.h>
|
||||
@@ -2475,8 +2473,9 @@ int b53_switch_detect(struct b53_device
|
||||
@@ -2533,8 +2531,9 @@ int b53_switch_detect(struct b53_device
|
||||
dev->chip_id = id32;
|
||||
break;
|
||||
default:
|
||||
@ -38,7 +38,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
@@ -2506,7 +2505,8 @@ int b53_switch_register(struct b53_devic
|
||||
@@ -2564,7 +2563,8 @@ int b53_switch_register(struct b53_devic
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -23,7 +23,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -2271,6 +2271,22 @@ static const struct b53_chip_data b53_sw
|
||||
@@ -2329,6 +2329,22 @@ static const struct b53_chip_data b53_sw
|
||||
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
|
||||
.jumbo_size_reg = B53_JUMBO_MAX_SIZE,
|
||||
},
|
||||
@ -68,7 +68,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
offset = CORE_STS_OVERRIDE_IMP;
|
||||
else
|
||||
offset = CORE_STS_OVERRIDE_IMP2;
|
||||
@@ -543,7 +544,8 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
@@ -555,7 +556,8 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
if (port == core_readl(priv, CORE_IMP0_PRT_ID))
|
||||
return;
|
||||
|
||||
@ -78,7 +78,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
offset = CORE_STS_OVERRIDE_GMIIP_PORT(port);
|
||||
else
|
||||
offset = CORE_STS_OVERRIDE_GMIIP2_PORT(port);
|
||||
@@ -990,6 +992,30 @@ struct bcm_sf2_of_data {
|
||||
@@ -1005,6 +1007,30 @@ struct bcm_sf2_of_data {
|
||||
unsigned int num_cfp_rules;
|
||||
};
|
||||
|
||||
@ -109,7 +109,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
/* Register offsets for the SWITCH_REG_* block */
|
||||
static const u16 bcm_sf2_7445_reg_offsets[] = {
|
||||
[REG_SWITCH_CNTRL] = 0x00,
|
||||
@@ -1038,6 +1064,9 @@ static const struct bcm_sf2_of_data bcm_
|
||||
@@ -1053,6 +1079,9 @@ static const struct bcm_sf2_of_data bcm_
|
||||
};
|
||||
|
||||
static const struct of_device_id bcm_sf2_of_match[] = {
|
||||
|
@ -18,7 +18,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -380,8 +380,9 @@ static void bcm_sf2_intr_disable(struct
|
||||
@@ -392,8 +392,9 @@ static void bcm_sf2_intr_disable(struct
|
||||
static void bcm_sf2_identify_ports(struct bcm_sf2_priv *priv,
|
||||
struct device_node *dn)
|
||||
{
|
||||
@ -29,7 +29,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
unsigned int port_num;
|
||||
|
||||
priv->moca_port = -1;
|
||||
@@ -390,19 +391,26 @@ static void bcm_sf2_identify_ports(struc
|
||||
@@ -402,19 +403,26 @@ static void bcm_sf2_identify_ports(struc
|
||||
if (of_property_read_u32(port, "reg", &port_num))
|
||||
continue;
|
||||
|
||||
@ -62,7 +62,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
if (of_property_read_bool(port, "brcm,use-bcm-hdr"))
|
||||
--- a/drivers/net/dsa/bcm_sf2.h
|
||||
+++ b/drivers/net/dsa/bcm_sf2.h
|
||||
@@ -43,6 +43,7 @@ struct bcm_sf2_hw_params {
|
||||
@@ -44,6 +44,7 @@ struct bcm_sf2_hw_params {
|
||||
#define BCM_SF2_REGS_NUM 6
|
||||
|
||||
struct bcm_sf2_port_status {
|
||||
|
@ -37,7 +37,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -369,6 +369,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2
|
||||
@@ -381,6 +381,44 @@ static int bcm_sf2_sw_rst(struct bcm_sf2
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static void bcm_sf2_intr_disable(struct bcm_sf2_priv *priv)
|
||||
{
|
||||
intrl2_0_mask_set(priv, 0xffffffff);
|
||||
@@ -739,6 +777,8 @@ static int bcm_sf2_sw_resume(struct dsa_
|
||||
@@ -751,6 +789,8 @@ static int bcm_sf2_sw_resume(struct dsa_
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
ret = bcm_sf2_cfp_resume(ds);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -1001,6 +1041,7 @@ struct bcm_sf2_of_data {
|
||||
@@ -1016,6 +1056,7 @@ struct bcm_sf2_of_data {
|
||||
const u16 *reg_offsets;
|
||||
unsigned int core_reg_align;
|
||||
unsigned int num_cfp_rules;
|
||||
@ -99,7 +99,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
};
|
||||
|
||||
static const u16 bcm_sf2_4908_reg_offsets[] = {
|
||||
@@ -1025,6 +1066,7 @@ static const struct bcm_sf2_of_data bcm_
|
||||
@@ -1040,6 +1081,7 @@ static const struct bcm_sf2_of_data bcm_
|
||||
.core_reg_align = 0,
|
||||
.reg_offsets = bcm_sf2_4908_reg_offsets,
|
||||
.num_cfp_rules = 0, /* FIXME */
|
||||
@ -107,15 +107,15 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
};
|
||||
|
||||
/* Register offsets for the SWITCH_REG_* block */
|
||||
@@ -1135,6 +1177,7 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
@@ -1150,6 +1192,7 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
priv->reg_offsets = data->reg_offsets;
|
||||
priv->core_reg_align = data->core_reg_align;
|
||||
priv->num_cfp_rules = data->num_cfp_rules;
|
||||
+ priv->num_crossbar_int_ports = data->num_crossbar_int_ports;
|
||||
|
||||
/* Auto-detection using standard registers will not work, so
|
||||
* provide an indication of what kind of device we are for
|
||||
@@ -1189,6 +1232,8 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev,
|
||||
"switch");
|
||||
@@ -1209,6 +1252,8 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
ret = bcm_sf2_mdio_register(ds);
|
||||
--- a/drivers/net/dsa/bcm_sf2.h
|
||||
+++ b/drivers/net/dsa/bcm_sf2.h
|
||||
@@ -70,6 +70,7 @@ struct bcm_sf2_priv {
|
||||
@@ -73,6 +73,7 @@ struct bcm_sf2_priv {
|
||||
const u16 *reg_offsets;
|
||||
unsigned int core_reg_align;
|
||||
unsigned int num_cfp_rules;
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -1065,7 +1065,7 @@ static const struct bcm_sf2_of_data bcm_
|
||||
@@ -1080,7 +1080,7 @@ static const struct bcm_sf2_of_data bcm_
|
||||
.type = BCM4908_DEVICE_ID,
|
||||
.core_reg_align = 0,
|
||||
.reg_offsets = bcm_sf2_4908_reg_offsets,
|
||||
|
@ -57,7 +57,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
|
||||
{
|
||||
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
|
||||
@@ -588,6 +613,7 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
@@ -600,6 +625,7 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
{
|
||||
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
|
||||
u32 id_mode_dis = 0, port_mode;
|
||||
@ -65,7 +65,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
u32 reg, offset;
|
||||
|
||||
if (port == core_readl(priv, CORE_IMP0_PRT_ID))
|
||||
@@ -617,10 +643,12 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
@@ -629,10 +655,12 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
goto force_link;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
reg &= ~ID_MODE_DIS;
|
||||
reg &= ~(PORT_MODE_MASK << PORT_MODE_SHIFT);
|
||||
reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN);
|
||||
@@ -635,7 +663,7 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
@@ -647,7 +675,7 @@ static void bcm_sf2_sw_mac_config(struct
|
||||
reg |= RX_PAUSE_EN;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
force_link:
|
||||
/* Force link settings detected from the PHY */
|
||||
@@ -666,6 +694,7 @@ static void bcm_sf2_sw_mac_link_set(stru
|
||||
@@ -678,6 +706,7 @@ static void bcm_sf2_sw_mac_link_set(stru
|
||||
phy_interface_t interface, bool link)
|
||||
{
|
||||
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
|
||||
@ -96,7 +96,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
u32 reg;
|
||||
|
||||
if (!phy_interface_mode_is_rgmii(interface) &&
|
||||
@@ -673,13 +702,15 @@ static void bcm_sf2_sw_mac_link_set(stru
|
||||
@@ -685,13 +714,15 @@ static void bcm_sf2_sw_mac_link_set(stru
|
||||
interface != PHY_INTERFACE_MODE_REVMII)
|
||||
return;
|
||||
|
||||
|
@ -33,7 +33,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
break;
|
||||
default:
|
||||
switch (port) {
|
||||
@@ -1084,9 +1089,7 @@ static const u16 bcm_sf2_4908_reg_offset
|
||||
@@ -1099,9 +1104,7 @@ static const u16 bcm_sf2_4908_reg_offset
|
||||
[REG_PHY_REVISION] = 0x14,
|
||||
[REG_SPHY_CNTRL] = 0x24,
|
||||
[REG_CROSSBAR] = 0xc8,
|
||||
|
@ -82,7 +82,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1090,9 +1127,14 @@ static const u16 bcm_sf2_4908_reg_offset
|
||||
@@ -1105,9 +1142,14 @@ static const u16 bcm_sf2_4908_reg_offset
|
||||
[REG_SPHY_CNTRL] = 0x24,
|
||||
[REG_CROSSBAR] = 0xc8,
|
||||
[REG_RGMII_11_CNTRL] = 0x014c,
|
||||
@ -102,7 +102,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
static const struct bcm_sf2_of_data bcm_sf2_4908_data = {
|
||||
--- a/drivers/net/dsa/bcm_sf2.h
|
||||
+++ b/drivers/net/dsa/bcm_sf2.h
|
||||
@@ -203,6 +203,16 @@ SF2_IO_MACRO(acb);
|
||||
@@ -206,6 +206,16 @@ SF2_IO_MACRO(acb);
|
||||
SWITCH_INTR_L2(0);
|
||||
SWITCH_INTR_L2(1);
|
||||
|
||||
|
@ -29,7 +29,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -1368,10 +1368,14 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
@@ -1388,10 +1388,14 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
rev = reg_readl(priv, REG_PHY_REVISION);
|
||||
priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK;
|
||||
|
||||
|
@ -15,7 +15,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -1382,6 +1382,12 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
@@ -1402,6 +1402,12 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff,
|
||||
priv->irq0, priv->irq1);
|
||||
|
||||
|
@ -0,0 +1,31 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Wed, 7 Dec 2022 07:57:58 +0100
|
||||
Subject: [PATCH] Revert "net: dsa: b53: Fix valid setting for MDB entries"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit 1fae6eb0fc91d3ecb539e03f9e4dcd1c53ada553.
|
||||
|
||||
Upstream commit was a fix for an overlook of setting "ent.is_valid"
|
||||
twice after 5d65b64a3d97 ("net: dsa: b53: Add support for MDB").
|
||||
|
||||
Since MDB support was not backported to stable kernels (it's not a bug
|
||||
fix) there is nothing to fix there. Backporting this commit resulted in
|
||||
"env.is_valid" not being set at all.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_common.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -1551,6 +1551,7 @@ static int b53_arl_op(struct b53_device
|
||||
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
ent.port = port;
|
||||
+ ent.is_valid = is_valid;
|
||||
ent.vid = vid;
|
||||
ent.is_static = true;
|
||||
memcpy(ent.mac, addr, ETH_ALEN);
|
@ -0,0 +1,130 @@
|
||||
From 5d65b64a3d97011796b225ce315b3ce0011551e7 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Date: Thu, 24 Oct 2019 12:45:07 -0700
|
||||
Subject: [PATCH] net: dsa: b53: Add support for MDB
|
||||
|
||||
In preparation for supporting IGMP snooping with or without the use of
|
||||
a bridge, add support within b53_common.c to program the ARL entries for
|
||||
multicast operations. The key difference is that a multicast ARL entry
|
||||
is comprised of a bitmask of enabled ports, instead of a port number.
|
||||
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_common.c | 62 ++++++++++++++++++++++++++++++--
|
||||
drivers/net/dsa/b53/b53_priv.h | 8 ++++-
|
||||
2 files changed, 67 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -1549,11 +1549,25 @@ static int b53_arl_op(struct b53_device
|
||||
break;
|
||||
}
|
||||
|
||||
- memset(&ent, 0, sizeof(ent));
|
||||
- ent.port = port;
|
||||
+ /* For multicast address, the port is a bitmask and the validity
|
||||
+ * is determined by having at least one port being still active
|
||||
+ */
|
||||
+ if (!is_multicast_ether_addr(addr)) {
|
||||
+ ent.port = port;
|
||||
+ ent.is_valid = is_valid;
|
||||
+ } else {
|
||||
+ if (is_valid)
|
||||
+ ent.port |= BIT(port);
|
||||
+ else
|
||||
+ ent.port &= ~BIT(port);
|
||||
+
|
||||
+ ent.is_valid = !!(ent.port);
|
||||
+ }
|
||||
+
|
||||
ent.is_valid = is_valid;
|
||||
ent.vid = vid;
|
||||
ent.is_static = true;
|
||||
+ ent.is_age = false;
|
||||
memcpy(ent.mac, addr, ETH_ALEN);
|
||||
b53_arl_from_entry(&mac_vid, &fwd_entry, &ent);
|
||||
|
||||
@@ -1672,6 +1686,47 @@ int b53_fdb_dump(struct dsa_switch *ds,
|
||||
}
|
||||
EXPORT_SYMBOL(b53_fdb_dump);
|
||||
|
||||
+int b53_mdb_prepare(struct dsa_switch *ds, int port,
|
||||
+ const struct switchdev_obj_port_mdb *mdb)
|
||||
+{
|
||||
+ struct b53_device *priv = ds->priv;
|
||||
+
|
||||
+ /* 5325 and 5365 require some more massaging, but could
|
||||
+ * be supported eventually
|
||||
+ */
|
||||
+ if (is5325(priv) || is5365(priv))
|
||||
+ return -EOPNOTSUPP;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL(b53_mdb_prepare);
|
||||
+
|
||||
+void b53_mdb_add(struct dsa_switch *ds, int port,
|
||||
+ const struct switchdev_obj_port_mdb *mdb)
|
||||
+{
|
||||
+ struct b53_device *priv = ds->priv;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, true);
|
||||
+ if (ret)
|
||||
+ dev_err(ds->dev, "failed to add MDB entry\n");
|
||||
+}
|
||||
+EXPORT_SYMBOL(b53_mdb_add);
|
||||
+
|
||||
+int b53_mdb_del(struct dsa_switch *ds, int port,
|
||||
+ const struct switchdev_obj_port_mdb *mdb)
|
||||
+{
|
||||
+ struct b53_device *priv = ds->priv;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = b53_arl_op(priv, 0, port, mdb->addr, mdb->vid, false);
|
||||
+ if (ret)
|
||||
+ dev_err(ds->dev, "failed to delete MDB entry\n");
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL(b53_mdb_del);
|
||||
+
|
||||
int b53_br_join(struct dsa_switch *ds, int port, struct net_device *br)
|
||||
{
|
||||
struct b53_device *dev = ds->priv;
|
||||
@@ -2050,6 +2105,9 @@ static const struct dsa_switch_ops b53_s
|
||||
.port_fdb_del = b53_fdb_del,
|
||||
.port_mirror_add = b53_mirror_add,
|
||||
.port_mirror_del = b53_mirror_del,
|
||||
+ .port_mdb_prepare = b53_mdb_prepare,
|
||||
+ .port_mdb_add = b53_mdb_add,
|
||||
+ .port_mdb_del = b53_mdb_del,
|
||||
};
|
||||
|
||||
struct b53_chip_data {
|
||||
--- a/drivers/net/dsa/b53/b53_priv.h
|
||||
+++ b/drivers/net/dsa/b53/b53_priv.h
|
||||
@@ -250,7 +250,7 @@ b53_build_op(write48, u64);
|
||||
b53_build_op(write64, u64);
|
||||
|
||||
struct b53_arl_entry {
|
||||
- u8 port;
|
||||
+ u16 port;
|
||||
u8 mac[ETH_ALEN];
|
||||
u16 vid;
|
||||
u8 is_valid:1;
|
||||
@@ -351,6 +351,12 @@ int b53_fdb_del(struct dsa_switch *ds, i
|
||||
const unsigned char *addr, u16 vid);
|
||||
int b53_fdb_dump(struct dsa_switch *ds, int port,
|
||||
dsa_fdb_dump_cb_t *cb, void *data);
|
||||
+int b53_mdb_prepare(struct dsa_switch *ds, int port,
|
||||
+ const struct switchdev_obj_port_mdb *mdb);
|
||||
+void b53_mdb_add(struct dsa_switch *ds, int port,
|
||||
+ const struct switchdev_obj_port_mdb *mdb);
|
||||
+int b53_mdb_del(struct dsa_switch *ds, int port,
|
||||
+ const struct switchdev_obj_port_mdb *mdb);
|
||||
int b53_mirror_add(struct dsa_switch *ds, int port,
|
||||
struct dsa_mall_mirror_tc_entry *mirror, bool ingress);
|
||||
enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port);
|
@ -0,0 +1,27 @@
|
||||
From 29bb5e8337caf2e3d9802ee6a6804561f125bfcf Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Date: Thu, 24 Oct 2019 12:45:08 -0700
|
||||
Subject: [PATCH] net: dsa: bcm_sf2: Wire up MDB operations
|
||||
|
||||
Leverage the recently add b53_mdb_{add,del,prepare} functions since they
|
||||
work as-is for bcm_sf2.
|
||||
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/bcm_sf2.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -981,6 +981,9 @@ static const struct dsa_switch_ops bcm_s
|
||||
.set_rxnfc = bcm_sf2_set_rxnfc,
|
||||
.port_mirror_add = b53_mirror_add,
|
||||
.port_mirror_del = b53_mirror_del,
|
||||
+ .port_mdb_prepare = b53_mdb_prepare,
|
||||
+ .port_mdb_add = b53_mdb_add,
|
||||
+ .port_mdb_del = b53_mdb_del,
|
||||
};
|
||||
|
||||
struct bcm_sf2_of_data {
|
@ -0,0 +1,81 @@
|
||||
From eee87e4377a4b86dc2eea0ade162b0dc33f40576 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Date: Mon, 4 Nov 2019 13:51:39 -0800
|
||||
Subject: [PATCH] net: dsa: bcm_sf2: Add support for optional reset controller
|
||||
line
|
||||
|
||||
Grab an optional and exclusive reset controller line for the switch and
|
||||
manage it during probe/remove functions accordingly. For 7278 devices we
|
||||
change bcm_sf2_sw_rst() to use the reset controller line since the
|
||||
WATCHDOG_CTRL register does not reset the switch contrary to stated
|
||||
documentation.
|
||||
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/bcm_sf2.c | 19 +++++++++++++++++++
|
||||
drivers/net/dsa/bcm_sf2.h | 3 +++
|
||||
2 files changed, 22 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -346,6 +346,18 @@ static int bcm_sf2_sw_rst(struct bcm_sf2
|
||||
{
|
||||
unsigned int timeout = 1000;
|
||||
u32 reg;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* The watchdog reset does not work on 7278, we need to hit the
|
||||
+ * "external" reset line through the reset controller.
|
||||
+ */
|
||||
+ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev)) {
|
||||
+ ret = reset_control_assert(priv->rcdev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return reset_control_deassert(priv->rcdev);
|
||||
+ }
|
||||
|
||||
reg = core_readl(priv, CORE_WATCHDOG_CTRL);
|
||||
reg |= SOFTWARE_RESET | EN_CHIP_RST | EN_SW_RESET;
|
||||
@@ -1099,6 +1111,11 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
priv->core_reg_align = data->core_reg_align;
|
||||
priv->num_cfp_rules = data->num_cfp_rules;
|
||||
|
||||
+ priv->rcdev = devm_reset_control_get_optional_exclusive(&pdev->dev,
|
||||
+ "switch");
|
||||
+ if (PTR_ERR(priv->rcdev) == -EPROBE_DEFER)
|
||||
+ return PTR_ERR(priv->rcdev);
|
||||
+
|
||||
/* Auto-detection using standard registers will not work, so
|
||||
* provide an indication of what kind of device we are for
|
||||
* b53_common to work with
|
||||
@@ -1237,6 +1254,8 @@ static int bcm_sf2_sw_remove(struct plat
|
||||
dsa_unregister_switch(priv->dev->ds);
|
||||
bcm_sf2_cfp_exit(priv->dev->ds);
|
||||
bcm_sf2_mdio_unregister(priv);
|
||||
+ if (priv->type == BCM7278_DEVICE_ID && !IS_ERR(priv->rcdev))
|
||||
+ reset_control_assert(priv->rcdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--- a/drivers/net/dsa/bcm_sf2.h
|
||||
+++ b/drivers/net/dsa/bcm_sf2.h
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/if_vlan.h>
|
||||
+#include <linux/reset.h>
|
||||
|
||||
#include <net/dsa.h>
|
||||
|
||||
@@ -64,6 +65,8 @@ struct bcm_sf2_priv {
|
||||
void __iomem *fcb;
|
||||
void __iomem *acb;
|
||||
|
||||
+ struct reset_control *rcdev;
|
||||
+
|
||||
/* Register offsets indirection tables */
|
||||
u32 type;
|
||||
const u16 *reg_offsets;
|
@ -0,0 +1,30 @@
|
||||
From eab167f4851a19c514469dfa81147f77e17b5b20 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Date: Mon, 20 Apr 2020 20:26:52 -0700
|
||||
Subject: [PATCH] net: dsa: b53: Fix valid setting for MDB entries
|
||||
|
||||
When support for the MDB entries was added, the valid bit was correctly
|
||||
changed to be assigned depending on the remaining port bitmask, that is,
|
||||
if there were no more ports added to the entry's port bitmask, the entry
|
||||
now becomes invalid. There was another assignment a few lines below that
|
||||
would override this which would invalidate entries even when there were
|
||||
still multiple ports left in the MDB entry.
|
||||
|
||||
Fixes: 5d65b64a3d97 ("net: dsa: b53: Add support for MDB")
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
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 | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -1564,7 +1564,6 @@ static int b53_arl_op(struct b53_device
|
||||
ent.is_valid = !!(ent.port);
|
||||
}
|
||||
|
||||
- ent.is_valid = is_valid;
|
||||
ent.vid = vid;
|
||||
ent.is_static = true;
|
||||
ent.is_age = false;
|
@ -38,7 +38,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
const struct switchdev_obj_port_vlan *vlan);
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -641,7 +641,9 @@ static void bcm_sf2_sw_mac_link_down(str
|
||||
@@ -653,7 +653,9 @@ static void bcm_sf2_sw_mac_link_down(str
|
||||
static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port,
|
||||
unsigned int mode,
|
||||
phy_interface_t interface,
|
||||
|
Loading…
Reference in New Issue
Block a user