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 07/13] net: dsa: microchip: move start of switch to ksz_setup
Date: Wed, 22 Jun 2022 14:34:19 +0530	[thread overview]
Message-ID: <20220622090425.17709-8-arun.ramadoss@microchip.com> (raw)
In-Reply-To: <20220622090425.17709-1-arun.ramadoss@microchip.com>

This patch move the setting the start bit from the individual switch
configuration to ksz_setup

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

diff --git a/drivers/net/dsa/microchip/ksz8795_reg.h b/drivers/net/dsa/microchip/ksz8795_reg.h
index f2b0399d69d1..32d985296520 100644
--- a/drivers/net/dsa/microchip/ksz8795_reg.h
+++ b/drivers/net/dsa/microchip/ksz8795_reg.h
@@ -16,7 +16,6 @@
 
 #define SW_REVISION_M			0x0E
 #define SW_REVISION_S			1
-#define SW_START			0x01
 
 #define KSZ8863_REG_SW_RESET		0x43
 
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 827e62b032d2..5fa5b3d09146 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1287,9 +1287,6 @@ static int ksz9477_setup(struct dsa_switch *ds)
 	/* enable global MIB counter freeze function */
 	ksz_cfg(dev, REG_SW_MAC_CTRL_6, SW_MIB_COUNTER_FREEZE, true);
 
-	/* start switch */
-	ksz_cfg(dev, REG_SW_OPERATION, SW_START, true);
-
 	return 0;
 }
 
diff --git a/drivers/net/dsa/microchip/ksz9477_reg.h b/drivers/net/dsa/microchip/ksz9477_reg.h
index 57e03dfcf869..c0ad83753b13 100644
--- a/drivers/net/dsa/microchip/ksz9477_reg.h
+++ b/drivers/net/dsa/microchip/ksz9477_reg.h
@@ -165,7 +165,6 @@
 
 #define SW_DOUBLE_TAG			BIT(7)
 #define SW_RESET			BIT(1)
-#define SW_START			BIT(0)
 
 #define REG_SW_MAC_ADDR_0		0x0302
 #define REG_SW_MAC_ADDR_1		0x0303
diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 719fa1b0884e..6da4df520397 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -155,6 +155,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x02,
 		.broadcast_ctrl_reg =  0x06,
 		.multicast_ctrl_reg = 0x04,
+		.start_ctrl_reg = 0x01,
 		.supports_mii = {false, false, false, false, true},
 		.supports_rmii = {false, false, false, false, true},
 		.supports_rgmii = {false, false, false, false, true},
@@ -190,6 +191,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x02,
 		.broadcast_ctrl_reg =  0x06,
 		.multicast_ctrl_reg = 0x04,
+		.start_ctrl_reg = 0x01,
 		.supports_mii = {false, false, false, false, true},
 		.supports_rmii = {false, false, false, false, true},
 		.supports_rgmii = {false, false, false, false, true},
@@ -211,6 +213,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x02,
 		.broadcast_ctrl_reg =  0x06,
 		.multicast_ctrl_reg = 0x04,
+		.start_ctrl_reg = 0x01,
 		.supports_mii = {false, false, false, false, true},
 		.supports_rmii = {false, false, false, false, true},
 		.supports_rgmii = {false, false, false, false, true},
@@ -231,6 +234,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x02,
 		.broadcast_ctrl_reg =  0x06,
 		.multicast_ctrl_reg = 0x04,
+		.start_ctrl_reg = 0x01,
 		.supports_mii = {false, false, true},
 		.supports_rmii = {false, false, true},
 		.internal_phy = {true, true, false},
@@ -251,6 +255,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii	= {false, false, false, false,
 				   false, true, false},
 		.supports_rmii	= {false, false, false, false,
@@ -276,6 +281,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii	= {false, false, false, false,
 				   false, true, true},
 		.supports_rmii	= {false, false, false, false,
@@ -300,6 +306,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii = {false, false, true},
 		.supports_rmii = {false, false, true},
 		.supports_rgmii = {false, false, true},
@@ -321,6 +328,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii	= {false, false, false, false,
 				   false, true, true},
 		.supports_rmii	= {false, false, false, false,
@@ -345,6 +353,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii = {false, false, false, false, true},
 		.supports_rmii = {false, false, false, false, true},
 		.supports_rgmii = {false, false, false, false, true},
@@ -365,6 +374,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii = {false, false, false, false, true, true},
 		.supports_rmii = {false, false, false, false, true, true},
 		.supports_rgmii = {false, false, false, false, true, true},
@@ -385,6 +395,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii	= {false, false, false, false,
 				   true, true, false, false},
 		.supports_rmii	= {false, false, false, false,
@@ -409,6 +420,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii	= {false, false, false, false,
 				   true, true, false, false},
 		.supports_rmii	= {false, false, false, false,
@@ -433,6 +445,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
 		.stp_ctrl_reg = 0x0B04,
 		.broadcast_ctrl_reg =  0x0332,
 		.multicast_ctrl_reg = 0x0331,
+		.start_ctrl_reg = 0x0300,
 		.supports_mii	= {false, false, false, false,
 				   true, true, false, false},
 		.supports_rmii	= {false, false, false, false,
@@ -672,6 +685,10 @@ int ksz_setup(struct dsa_switch *ds)
 			return ret;
 	}
 
+	/* start switch */
+	regmap_update_bits(dev->regmap[0], dev->info->start_ctrl_reg,
+			   SW_START, SW_START);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(ksz_setup);
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 35d734ee932e..2cf8474ba626 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -49,6 +49,7 @@ struct ksz_chip_data {
 	int stp_ctrl_reg;
 	int broadcast_ctrl_reg;
 	int multicast_ctrl_reg;
+	int start_ctrl_reg;
 	bool supports_mii[KSZ_MAX_NUM_PORTS];
 	bool supports_rmii[KSZ_MAX_NUM_PORTS];
 	bool supports_rgmii[KSZ_MAX_NUM_PORTS];
@@ -429,6 +430,8 @@ static inline void ksz_regmap_unlock(void *__mtx)
 
 #define MULTICAST_STORM_DISABLE		BIT(6)
 
+#define SW_START			0x01
+
 /* 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:10 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 ` [Patch net-next 06/13] net: dsa: microchip: move multicast enable " Arun Ramadoss
2022-06-22  9:04 ` Arun Ramadoss [this message]
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-8-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®