Commit 0abab9f3 authored by Arun Ramadoss's avatar Arun Ramadoss Committed by David S. Miller

net: dsa: microchip: move multicast enable to ksz_setup

This patch moves the enabling the multicast storm protection from
individual setup function to ksz_setup function.
Signed-off-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1ca6437f
......@@ -1406,8 +1406,6 @@ static int ksz8_setup(struct dsa_switch *ds)
UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP,
UNICAST_VLAN_BOUNDARY | NO_EXC_COLLISION_DROP);
ksz_cfg(dev, REG_SW_CTRL_2, MULTICAST_STORM_DISABLE, true);
ksz_cfg(dev, S_REPLACE_VID_CTRL, SW_REPLACE_VID, false);
ksz_cfg(dev, S_MIRROR_CTRL, SW_MIRROR_RX_TX, false);
......
......@@ -44,7 +44,6 @@
#define REG_SW_CTRL_2 0x04
#define UNICAST_VLAN_BOUNDARY BIT(7)
#define MULTICAST_STORM_DISABLE BIT(6)
#define SW_BACK_PRESSURE BIT(5)
#define FAIR_FLOW_CTRL BIT(4)
#define NO_EXC_COLLISION_DROP BIT(3)
......
......@@ -1281,8 +1281,6 @@ static int ksz9477_setup(struct dsa_switch *ds)
if (ret)
return ret;
ksz_cfg(dev, REG_SW_MAC_CTRL_1, MULTICAST_STORM_DISABLE, true);
/* queue based egress rate limit */
ksz_cfg(dev, REG_SW_MAC_CTRL_5, SW_OUT_RATE_LIMIT_QUEUE_BASED, true);
......
......@@ -265,7 +265,6 @@
#define REG_SW_MAC_CTRL_1 0x0331
#define MULTICAST_STORM_DISABLE BIT(6)
#define SW_BACK_PRESSURE BIT(5)
#define FAIR_FLOW_CTRL BIT(4)
#define NO_EXC_COLLISION_DROP BIT(3)
......
......@@ -154,6 +154,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
......@@ -188,6 +189,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
......@@ -208,6 +210,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
......@@ -227,6 +230,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04,
.supports_mii = {false, false, true},
.supports_rmii = {false, false, true},
.internal_phy = {true, true, false},
......@@ -246,6 +250,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false,
false, true, false},
.supports_rmii = {false, false, false, false,
......@@ -270,6 +275,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false,
false, true, true},
.supports_rmii = {false, false, false, false,
......@@ -293,6 +299,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, true},
.supports_rmii = {false, false, true},
.supports_rgmii = {false, false, true},
......@@ -313,6 +320,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false,
false, true, true},
.supports_rmii = {false, false, false, false,
......@@ -336,6 +344,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true},
......@@ -355,6 +364,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false, true, true},
.supports_rmii = {false, false, false, false, true, true},
.supports_rgmii = {false, false, false, false, true, true},
......@@ -374,6 +384,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false,
true, true, false, false},
.supports_rmii = {false, false, false, false,
......@@ -397,6 +408,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false,
true, true, false, false},
.supports_rmii = {false, false, false, false,
......@@ -420,6 +432,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.reg_mib_cnt = MIB_COUNTER_NUM,
.stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331,
.supports_mii = {false, false, false, false,
true, true, false, false},
.supports_rmii = {false, false, false, false,
......@@ -646,6 +659,9 @@ int ksz_setup(struct dsa_switch *ds)
dev->dev_ops->enable_stp_addr(dev);
regmap_update_bits(dev->regmap[0], dev->info->multicast_ctrl_reg,
MULTICAST_STORM_DISABLE, MULTICAST_STORM_DISABLE);
ksz_init_mib_timer(dev);
ds->configure_vlan_while_not_filtering = false;
......
......@@ -48,6 +48,7 @@ struct ksz_chip_data {
u8 reg_mib_cnt;
int stp_ctrl_reg;
int broadcast_ctrl_reg;
int multicast_ctrl_reg;
bool supports_mii[KSZ_MAX_NUM_PORTS];
bool supports_rmii[KSZ_MAX_NUM_PORTS];
bool supports_rgmii[KSZ_MAX_NUM_PORTS];
......@@ -426,6 +427,8 @@ static inline void ksz_regmap_unlock(void *__mtx)
#define BROADCAST_STORM_RATE_LO 0xFF
#define BROADCAST_STORM_RATE 0x07FF
#define MULTICAST_STORM_DISABLE BIT(6)
/* Regmap tables generation */
#define KSZ_SPI_OP_RD 3
#define KSZ_SPI_OP_WR 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment