The dsa probing currently disable multiple spanning tree for RTL93xx
and keeps the bootloader setup for RTL83xx untouched. Additionally it
does this by checking for the family id. Refactor this to a common
"disable msti" setup.
To make it clear: From now on RTL83xx will also run in MSTI disabled
state. Tested on Linksys LGS310C.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22749
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
priv->ds->ops = priv->r->switch_ops;
priv->ds->phylink_mac_ops = priv->r->phylink_mac_ops;
priv->ds->num_lag_ids = priv->r->num_lag_ids;
+ priv->ds->num_ports = priv->r->cpu_port + 1;
priv->dev = dev;
dev_set_drvdata(dev, priv);
priv->family_id = soc_info.family;
priv->id = soc_info.id;
- switch (soc_info.family) {
- case RTL9300_FAMILY_ID:
- sw_w32(0, RTL930X_ST_CTRL);
- break;
- case RTL9310_FAMILY_ID:
- sw_w32(0, RTL931x_ST_CTRL);
- break;
- }
- priv->ds->num_ports = priv->r->cpu_port + 1;
+ sw_w32(0, priv->r->spanning_tree_ctrl);
priv->irq_mask = GENMASK_ULL(priv->r->cpu_port - 1, 0);
err = rtl83xx_mdio_probe(priv);
const struct rtldsa_config rtldsa_838x_cfg = {
.switch_ops = &rtldsa_83xx_switch_ops,
.phylink_mac_ops = &rtldsa_83xx_phylink_mac_ops,
+ .spanning_tree_ctrl = RTL838X_VLAN_STP_CTRL,
.l2_bucket_size = 4,
.n_mst = 64,
.num_lag_ids = 8,
#define MV_ACT_TRAP2CPU 2
#define MV_ACT_COPY2CPU 3
+#define RTL838X_VLAN_STP_CTRL (0x3b20)
+#define RTL839X_ST_CTRL (0x27e4)
#define RTL930X_ST_CTRL (0x8798)
-#define RTL931x_ST_CTRL (0x8000)
+#define RTL931X_ST_CTRL (0x8000)
#define RTL930X_L2_PORT_SABLK_CTRL (0x905c)
#define RTL930X_L2_PORT_DABLK_CTRL (0x9060)
u32 fib_entries;
int trk_ctrl;
int trk_hash_ctrl;
+ int spanning_tree_ctrl;
void (*vlan_tables_read)(u32 vlan, struct rtl838x_vlan_info *info);
void (*vlan_set_tagged)(u32 vlan, struct rtl838x_vlan_info *info);
void (*vlan_set_untagged)(u32 vlan, u64 portmask);
const struct rtldsa_config rtldsa_839x_cfg = {
.switch_ops = &rtldsa_83xx_switch_ops,
.phylink_mac_ops = &rtldsa_83xx_phylink_mac_ops,
+ .spanning_tree_ctrl = RTL839X_ST_CTRL,
.l2_bucket_size = 4,
.n_mst = 256,
.num_lag_ids = 16,
const struct rtldsa_config rtldsa_930x_cfg = {
.switch_ops = &rtldsa_93xx_switch_ops,
.phylink_mac_ops = &rtldsa_93xx_phylink_mac_ops,
+ .spanning_tree_ctrl = RTL930X_ST_CTRL,
.l2_bucket_size = 8,
.n_mst = 64,
.num_lag_ids = 16,
const struct rtldsa_config rtldsa_931x_cfg = {
.switch_ops = &rtldsa_93xx_switch_ops,
.phylink_mac_ops = &rtldsa_93xx_phylink_mac_ops,
+ .spanning_tree_ctrl = RTL931X_ST_CTRL,
.l2_bucket_size = 8,
.n_mst = 128,
.num_lag_ids = 16,