mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arun Ramadoss <arun.ramadoss@microchip.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: Woojung Huh <woojung.huh@microchip.com>,
	<UNGLinuxDriver@microchip.com>, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"Russell King" <linux@armlinux.org.uk>
Subject: [Patch net-next 06/13] net: dsa: microchip: move multicast enable to ksz_setup
Date: Wed, 22 Jun 2022 14:34:18 +0530	[thread overview]
Message-ID: <20220622090425.17709-7-arun.ramadoss@microchip.com> (raw)
In-Reply-To: <20220622090425.17709-1-arun.ramadoss@microchip.com>

This patch moves the enabling the multicast storm protection from
individual setup function to ksz_setup function.

Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
 drivers/net/dsa/microchip/ksz8795.c     |  2 --
 drivers/net/dsa/microchip/ksz8795_reg.h |  1 -
 drivers/net/dsa/microchip/ksz9477.c     |  2 --
 drivers/net/dsa/microchip/ksz9477_reg.h |  1 -
 drivers/net/dsa/microchip/ksz_common.c  | 16 ++++++++++++++++
 drivers/net/dsa/microchip/ksz_common.h  |  3 +++
 6 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 1bbad202b238..662493db8638 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -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);
diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h
index 7b56e533a688..f2b0399d69d1 100644
--- a/drivers/net/dsa/microchip/ksz8795_reg.h
+++ b/drivers/net/dsa/microchip/ksz8795_reg.h
@@ -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)
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index b2a6d2365c82..827e62b032d2 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -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);
 
diff --git a/drivers/net/dsa/microchip/ksz9477_reg.h b/drivers/net/dsa/microchip/ksz9477_reg.h
index 0345fc7ac850..57e03dfcf869 100644
--- a/drivers/net/dsa/microchip/ksz9477_reg.h
+++ b/drivers/net/dsa/microchip/ksz9477_reg.h
@@ -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)
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 976b2b18908f..719fa1b0884e 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -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;
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 6aeee4771f06..35d734ee932e 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -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
-- 
2.36.1


  parent reply	other threads:[~2022-06-22  9:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  9:04 [Patch net-next 00/13] net: dsa: microchip: common spi probe for the ksz series switches - part 2 Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 01/13] net: dsa: microchip: rename shutdown to reset in ksz_dev_ops Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 02/13] net: dsa: microchip: add config_cpu_port to struct ksz_dev_ops Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 03/13] net: dsa: microchip: add the enable_stp_addr pointer in ksz_dev_ops Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 04/13] net: dsa: microchip: move setup function to ksz_common Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 05/13] net: dsa: microchip: move broadcast rate limit to ksz_setup Arun Ramadoss
2022-06-22  9:04 ` Arun Ramadoss [this message]
2022-06-22  9:04 ` [Patch net-next 07/13] net: dsa: microchip: move start of switch " Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 08/13] net: dsa: microchip: common dsa_switch_ops for ksz switches Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 09/13] net: dsa: microchip: ksz9477: separate phylink mode from switch register Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 10/13] net: dsa: microchip: common menuconfig for ksz series switch Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 11/13] net: dsa: microchip: move ksz_dev_ops to ksz_common.c Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 12/13] net: dsa: microchip: remove the ksz8/ksz9477_switch_register Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 13/13] net: dsa: microchip: common ksz_spi_probe for ksz switches Arun Ramadoss
2022-06-24 10:50 ` [Patch net-next 00/13] net: dsa: microchip: common spi probe for the ksz series switches - part 2 patchwork-bot+netdevbpf
2022-06-24 11:23 ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220622090425.17709-7-arun.ramadoss@microchip.com \
    --to=arun.ramadoss@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®