All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately
@ 2020-09-18 10:57 Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 01/11] net: dsa: felix: use ocelot_field_{read,write} helpers consistently Vladimir Oltean
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

When introducing the Seville switch support to the Felix driver, some
technical debt was created. Since both VSC9959 and VSC9953 are embedded
switches (one on an arm64 SoC and the other on a powerpc SoC), there is
no use case for having the code for both be present in the same module.

This was necessary at the time due to the common SERDES PCS code that
they were using, but that has been since refactored into
drivers/net/pcs/pcs-lynx.c.

This makes the Seville driver stop uselessly depending upon PCI and
FSL_ENETC_MDIO, which were only dependencies of Felix in fact.

Some whitespace/tab conversions are also present in this series as part
of the cleanup process.

Vladimir Oltean (11):
  net: dsa: felix: use ocelot_field_{read,write} helpers consistently
  net: dsa: seville: don't write to MEM_ENA twice
  net: dsa: seville: first enable memories, then initialize them
  net: dsa: ocelot: document why reset procedure is different for
    felix/seville
  net: dsa: seville: remove unused defines for the mdio controller
  net: dsa: seville: reindent defines for MDIO controller
  net: dsa: felix: replace tabs with spaces
  net: dsa: seville: duplicate vsc9959_mdio_bus_free
  net: mscc: ocelot: make ocelot_init_timestamp take a const struct
    ptp_clock_info
  net: dsa: felix: move the PTP clock structure to felix_vsc9959.c
  net: dsa: seville: build as separate module

 drivers/net/dsa/ocelot/Kconfig           | 22 +++++----
 drivers/net/dsa/ocelot/Makefile          |  6 ++-
 drivers/net/dsa/ocelot/felix.c           | 47 +------------------
 drivers/net/dsa/ocelot/felix.h           |  7 +--
 drivers/net/dsa/ocelot/felix_vsc9959.c   | 57 +++++++++++++++++-------
 drivers/net/dsa/ocelot/seville_vsc9953.c | 55 ++++++++++++++---------
 drivers/net/ethernet/mscc/ocelot_ptp.c   |  3 +-
 include/soc/mscc/ocelot_ptp.h            |  3 +-
 8 files changed, 102 insertions(+), 98 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH net-next 01/11] net: dsa: felix: use ocelot_field_{read,write} helpers consistently
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 02/11] net: dsa: seville: don't write to MEM_ENA twice Vladimir Oltean
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Since these helpers for regmap fields are available, use them.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 126a53a811f7..397d24c9f7c2 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -727,7 +727,7 @@ static int vsc9959_gcb_soft_rst_status(struct ocelot *ocelot)
 {
 	int val;
 
-	regmap_field_read(ocelot->regfields[GCB_SOFT_RST_SWC_RST], &val);
+	ocelot_field_read(ocelot, GCB_SOFT_RST_SWC_RST, &val);
 
 	return val;
 }
@@ -742,7 +742,7 @@ static int vsc9959_reset(struct ocelot *ocelot)
 	int val, err;
 
 	/* soft-reset the switch core */
-	regmap_field_write(ocelot->regfields[GCB_SOFT_RST_SWC_RST], 1);
+	ocelot_field_write(ocelot, GCB_SOFT_RST_SWC_RST, 1);
 
 	err = readx_poll_timeout(vsc9959_gcb_soft_rst_status, ocelot, val, !val,
 				 VSC9959_GCB_RST_SLEEP, VSC9959_INIT_TIMEOUT);
@@ -762,7 +762,7 @@ static int vsc9959_reset(struct ocelot *ocelot)
 	}
 
 	/* enable switch core */
-	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1);
+	ocelot_field_write(ocelot, SYS_RESET_CFG_CORE_ENA, 1);
 
 	return 0;
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 02/11] net: dsa: seville: don't write to MEM_ENA twice
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 01/11] net: dsa: felix: use ocelot_field_{read,write} helpers consistently Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 03/11] net: dsa: seville: first enable memories, then initialize them Vladimir Oltean
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

There is another one of these right above the readx_poll_status.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/seville_vsc9953.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index 83a1ab9393e9..df5709326ce1 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -847,7 +847,6 @@ static int vsc9953_reset(struct ocelot *ocelot)
 	}
 
 	/* enable switch core */
-	ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_ENA, 1);
 	ocelot_field_write(ocelot, SYS_RESET_CFG_CORE_ENA, 1);
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 03/11] net: dsa: seville: first enable memories, then initialize them
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 01/11] net: dsa: felix: use ocelot_field_{read,write} helpers consistently Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 02/11] net: dsa: seville: don't write to MEM_ENA twice Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 04/11] net: dsa: ocelot: document why reset procedure is different for felix/seville Vladimir Oltean
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

As per documentation, proper startup sequence is:
* Enable memories
* Initialize memories
* Enable core

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/seville_vsc9953.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index df5709326ce1..a1f25f5e0efc 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -835,8 +835,8 @@ static int vsc9953_reset(struct ocelot *ocelot)
 	}
 
 	/* initialize switch mem ~40us */
-	ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_INIT, 1);
 	ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_ENA, 1);
+	ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_INIT, 1);
 
 	err = readx_poll_timeout(vsc9953_sys_ram_init_status, ocelot, val, !val,
 				 VSC9953_SYS_RAMINIT_SLEEP,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 04/11] net: dsa: ocelot: document why reset procedure is different for felix/seville
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (2 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 03/11] net: dsa: seville: first enable memories, then initialize them Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller Vladimir Oltean
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

The overall idea (issue soft reset, enable memories, initialize
memories, enable core) is the same, so it would make sense that an
attempt is made to unify the procedures.

It is not immediately obvious that the fields are not part of the same
register targets, though. So add a comment.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix_vsc9959.c   | 3 +++
 drivers/net/dsa/ocelot/seville_vsc9953.c | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 397d24c9f7c2..6f6e4ef299c3 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -737,6 +737,9 @@ static int vsc9959_sys_ram_init_status(struct ocelot *ocelot)
 	return ocelot_read(ocelot, SYS_RAM_INIT);
 }
 
+/* CORE_ENA is in SYS:SYSTEM:RESET_CFG
+ * RAM_INIT is in SYS:RAM_CTRL:RAM_INIT
+ */
 static int vsc9959_reset(struct ocelot *ocelot)
 {
 	int val, err;
diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index a1f25f5e0efc..dfc9a1b2a504 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -820,6 +820,10 @@ static int vsc9953_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
 	return err;
 }
 
+/* CORE_ENA is in SYS:SYSTEM:RESET_CFG
+ * MEM_INIT is in SYS:SYSTEM:RESET_CFG
+ * MEM_ENA is in SYS:SYSTEM:RESET_CFG
+ */
 static int vsc9953_reset(struct ocelot *ocelot)
 {
 	int val, err;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (3 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 04/11] net: dsa: ocelot: document why reset procedure is different for felix/seville Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 15:46   ` Alexandre Belloni
  2020-09-18 10:57 ` [PATCH net-next 06/11] net: dsa: seville: reindent defines for MDIO controller Vladimir Oltean
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Some definitions were likely copied from
drivers/net/mdio/mdio-mscc-miim.c.

They are not necessary, remove them.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/seville_vsc9953.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index dfc9a1b2a504..0b6ceec85891 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -16,23 +16,12 @@
 #define VSC9953_VCAP_IS2_ENTRY_WIDTH		376
 #define VSC9953_VCAP_PORT_CNT			10
 
-#define MSCC_MIIM_REG_STATUS			0x0
-#define		MSCC_MIIM_STATUS_STAT_BUSY	BIT(3)
-#define MSCC_MIIM_REG_CMD			0x8
 #define		MSCC_MIIM_CMD_OPR_WRITE		BIT(1)
 #define		MSCC_MIIM_CMD_OPR_READ		BIT(2)
 #define		MSCC_MIIM_CMD_WRDATA_SHIFT	4
 #define		MSCC_MIIM_CMD_REGAD_SHIFT	20
 #define		MSCC_MIIM_CMD_PHYAD_SHIFT	25
 #define		MSCC_MIIM_CMD_VLD		BIT(31)
-#define MSCC_MIIM_REG_DATA			0xC
-#define		MSCC_MIIM_DATA_ERROR		(BIT(16) | BIT(17))
-
-#define MSCC_PHY_REG_PHY_CFG		0x0
-#define		PHY_CFG_PHY_ENA		(BIT(0) | BIT(1) | BIT(2) | BIT(3))
-#define		PHY_CFG_PHY_COMMON_RESET BIT(4)
-#define		PHY_CFG_PHY_RESET	(BIT(5) | BIT(6) | BIT(7) | BIT(8))
-#define MSCC_PHY_REG_PHY_STATUS		0x4
 
 static const u32 vsc9953_ana_regmap[] = {
 	REG(ANA_ADVLEARN,			0x00b500),
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 06/11] net: dsa: seville: reindent defines for MDIO controller
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (4 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 07/11] net: dsa: felix: replace tabs with spaces Vladimir Oltean
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Reindent these definitions to be in line with the rest of the driver.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/seville_vsc9953.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index 0b6ceec85891..224f7326ddb6 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -16,12 +16,12 @@
 #define VSC9953_VCAP_IS2_ENTRY_WIDTH		376
 #define VSC9953_VCAP_PORT_CNT			10
 
-#define		MSCC_MIIM_CMD_OPR_WRITE		BIT(1)
-#define		MSCC_MIIM_CMD_OPR_READ		BIT(2)
-#define		MSCC_MIIM_CMD_WRDATA_SHIFT	4
-#define		MSCC_MIIM_CMD_REGAD_SHIFT	20
-#define		MSCC_MIIM_CMD_PHYAD_SHIFT	25
-#define		MSCC_MIIM_CMD_VLD		BIT(31)
+#define MSCC_MIIM_CMD_OPR_WRITE			BIT(1)
+#define MSCC_MIIM_CMD_OPR_READ			BIT(2)
+#define MSCC_MIIM_CMD_WRDATA_SHIFT		4
+#define MSCC_MIIM_CMD_REGAD_SHIFT		20
+#define MSCC_MIIM_CMD_PHYAD_SHIFT		25
+#define MSCC_MIIM_CMD_VLD			BIT(31)
 
 static const u32 vsc9953_ana_regmap[] = {
 	REG(ANA_ADVLEARN,			0x00b500),
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 07/11] net: dsa: felix: replace tabs with spaces
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (5 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 06/11] net: dsa: seville: reindent defines for MDIO controller Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 08/11] net: dsa: seville: duplicate vsc9959_mdio_bus_free Vladimir Oltean
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Over the time, some patches have introduced structures aligned with
spaces, near structures aligned with tabs. Fix the inconsistencies.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix.c         |  2 +-
 drivers/net/dsa/ocelot/felix.h         |  2 +-
 drivers/net/dsa/ocelot/felix_vsc9959.c | 22 +++++++++++-----------
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index 64939ee14648..b523ea3a2e5f 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -803,7 +803,7 @@ const struct dsa_switch_ops felix_switch_ops = {
 	.cls_flower_add		= felix_cls_flower_add,
 	.cls_flower_del		= felix_cls_flower_del,
 	.cls_flower_stats	= felix_cls_flower_stats,
-	.port_setup_tc          = felix_port_setup_tc,
+	.port_setup_tc		= felix_port_setup_tc,
 };
 
 static int __init felix_init(void)
diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index 9bceb994b7db..807f18b74847 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -20,7 +20,7 @@ struct felix_info {
 	const struct ocelot_stat_layout	*stats_layout;
 	unsigned int			num_stats;
 	int				num_ports;
-	int                             num_tx_queues;
+	int				num_tx_queues;
 	struct vcap_field		*vcap_is2_keys;
 	struct vcap_field		*vcap_is2_actions;
 	const struct vcap_props		*vcap;
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 6f6e4ef299c3..4dbc3283f7ea 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -296,15 +296,15 @@ static const u32 vsc9959_sys_regmap[] = {
 };
 
 static const u32 vsc9959_ptp_regmap[] = {
-	REG(PTP_PIN_CFG,                   0x000000),
-	REG(PTP_PIN_TOD_SEC_MSB,           0x000004),
-	REG(PTP_PIN_TOD_SEC_LSB,           0x000008),
-	REG(PTP_PIN_TOD_NSEC,              0x00000c),
-	REG(PTP_PIN_WF_HIGH_PERIOD,        0x000014),
-	REG(PTP_PIN_WF_LOW_PERIOD,         0x000018),
-	REG(PTP_CFG_MISC,                  0x0000a0),
-	REG(PTP_CLK_CFG_ADJ_CFG,           0x0000a4),
-	REG(PTP_CLK_CFG_ADJ_FREQ,          0x0000a8),
+	REG(PTP_PIN_CFG,			0x000000),
+	REG(PTP_PIN_TOD_SEC_MSB,		0x000004),
+	REG(PTP_PIN_TOD_SEC_LSB,		0x000008),
+	REG(PTP_PIN_TOD_NSEC,			0x00000c),
+	REG(PTP_PIN_WF_HIGH_PERIOD,		0x000014),
+	REG(PTP_PIN_WF_LOW_PERIOD,		0x000018),
+	REG(PTP_CFG_MISC,			0x0000a0),
+	REG(PTP_CLK_CFG_ADJ_CFG,		0x0000a4),
+	REG(PTP_CLK_CFG_ADJ_FREQ,		0x0000a8),
 };
 
 static const u32 vsc9959_gcb_regmap[] = {
@@ -1173,8 +1173,8 @@ static const struct felix_info felix_info_vsc9959 = {
 	.mdio_bus_free		= vsc9959_mdio_bus_free,
 	.phylink_validate	= vsc9959_phylink_validate,
 	.prevalidate_phy_mode	= vsc9959_prevalidate_phy_mode,
-	.port_setup_tc          = vsc9959_port_setup_tc,
-	.port_sched_speed_set   = vsc9959_sched_speed_set,
+	.port_setup_tc		= vsc9959_port_setup_tc,
+	.port_sched_speed_set	= vsc9959_sched_speed_set,
 	.xmit_template_populate	= vsc9959_xmit_template_populate,
 };
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 08/11] net: dsa: seville: duplicate vsc9959_mdio_bus_free
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (6 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 07/11] net: dsa: felix: replace tabs with spaces Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 09/11] net: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info Vladimir Oltean
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

While we don't plan on making any changes to this function, currently
this is the only remaining dependency between felix and seville, after
the PCS has been refactored out into pcs-lynx.c.

Duplicate this function in seville to break the dependency completely.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix.h           |  2 --
 drivers/net/dsa/ocelot/felix_vsc9959.c   |  2 +-
 drivers/net/dsa/ocelot/seville_vsc9953.c | 19 ++++++++++++++++++-
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index 807f18b74847..1d41eeda126e 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -55,6 +55,4 @@ struct felix {
 	resource_size_t			imdio_base;
 };
 
-void vsc9959_mdio_bus_free(struct ocelot *ocelot);
-
 #endif
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 4dbc3283f7ea..b198fe9cb62b 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -936,7 +936,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
 	return 0;
 }
 
-void vsc9959_mdio_bus_free(struct ocelot *ocelot)
+static void vsc9959_mdio_bus_free(struct ocelot *ocelot)
 {
 	struct felix *felix = ocelot_to_felix(ocelot);
 	int port;
diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index 224f7326ddb6..23f66bb1ab4e 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -981,6 +981,23 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)
 	return 0;
 }
 
+static void vsc9953_mdio_bus_free(struct ocelot *ocelot)
+{
+	struct felix *felix = ocelot_to_felix(ocelot);
+	int port;
+
+	for (port = 0; port < ocelot->num_phys_ports; port++) {
+		struct lynx_pcs *pcs = felix->pcs[port];
+
+		if (!pcs)
+			continue;
+
+		mdio_device_free(pcs->mdio);
+		lynx_pcs_destroy(pcs);
+	}
+	mdiobus_unregister(felix->imdio);
+}
+
 static void vsc9953_xmit_template_populate(struct ocelot *ocelot, int port)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
@@ -1014,7 +1031,7 @@ static const struct felix_info seville_info_vsc9953 = {
 	.num_mact_rows		= 2048,
 	.num_ports		= 10,
 	.mdio_bus_alloc		= vsc9953_mdio_bus_alloc,
-	.mdio_bus_free		= vsc9959_mdio_bus_free,
+	.mdio_bus_free		= vsc9953_mdio_bus_free,
 	.phylink_validate	= vsc9953_phylink_validate,
 	.prevalidate_phy_mode	= vsc9953_prevalidate_phy_mode,
 	.xmit_template_populate	= vsc9953_xmit_template_populate,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 09/11] net: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (7 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 08/11] net: dsa: seville: duplicate vsc9959_mdio_bus_free Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 15:31   ` Alexandre Belloni
  2020-09-18 10:57 ` [PATCH net-next 10/11] net: dsa: felix: move the PTP clock structure to felix_vsc9959.c Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 11/11] net: dsa: seville: build as separate module Vladimir Oltean
  10 siblings, 1 reply; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

It is a good measure to ensure correctness if the structures that are
meant to remain constant are only processed by functions that thake
constant arguments.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot_ptp.c | 3 ++-
 include/soc/mscc/ocelot_ptp.h          | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot_ptp.c b/drivers/net/ethernet/mscc/ocelot_ptp.c
index 1e08fe4daaef..a33ab315cc6b 100644
--- a/drivers/net/ethernet/mscc/ocelot_ptp.c
+++ b/drivers/net/ethernet/mscc/ocelot_ptp.c
@@ -300,7 +300,8 @@ int ocelot_ptp_enable(struct ptp_clock_info *ptp,
 }
 EXPORT_SYMBOL(ocelot_ptp_enable);
 
-int ocelot_init_timestamp(struct ocelot *ocelot, struct ptp_clock_info *info)
+int ocelot_init_timestamp(struct ocelot *ocelot,
+			  const struct ptp_clock_info *info)
 {
 	struct ptp_clock *ptp_clock;
 	int i;
diff --git a/include/soc/mscc/ocelot_ptp.h b/include/soc/mscc/ocelot_ptp.h
index 4a6b2f71b6b2..6a7388fa7cc5 100644
--- a/include/soc/mscc/ocelot_ptp.h
+++ b/include/soc/mscc/ocelot_ptp.h
@@ -53,6 +53,7 @@ int ocelot_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
 		      enum ptp_pin_function func, unsigned int chan);
 int ocelot_ptp_enable(struct ptp_clock_info *ptp,
 		      struct ptp_clock_request *rq, int on);
-int ocelot_init_timestamp(struct ocelot *ocelot, struct ptp_clock_info *info);
+int ocelot_init_timestamp(struct ocelot *ocelot,
+			  const struct ptp_clock_info *info);
 int ocelot_deinit_timestamp(struct ocelot *ocelot);
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 10/11] net: dsa: felix: move the PTP clock structure to felix_vsc9959.c
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (8 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 09/11] net: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  2020-09-18 10:57 ` [PATCH net-next 11/11] net: dsa: seville: build as separate module Vladimir Oltean
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Not only does Sevile not have a PTP clock, but with separate modules,
this structure cannot even live in felix.c, due to the .owner =
THIS_MODULE assignment causing this link time error:

drivers/net/dsa/ocelot/felix.o:(.data+0x0): undefined reference to `__this_module'

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/felix.c         | 19 +------------------
 drivers/net/dsa/ocelot/felix.h         |  1 +
 drivers/net/dsa/ocelot/felix_vsc9959.c | 18 ++++++++++++++++++
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index b523ea3a2e5f..fb1b3e117c78 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -538,23 +538,6 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
 	return 0;
 }
 
-static struct ptp_clock_info ocelot_ptp_clock_info = {
-	.owner		= THIS_MODULE,
-	.name		= "felix ptp",
-	.max_adj	= 0x7fffffff,
-	.n_alarm	= 0,
-	.n_ext_ts	= 0,
-	.n_per_out	= OCELOT_PTP_PINS_NUM,
-	.n_pins		= OCELOT_PTP_PINS_NUM,
-	.pps		= 0,
-	.gettime64	= ocelot_ptp_gettime64,
-	.settime64	= ocelot_ptp_settime64,
-	.adjtime	= ocelot_ptp_adjtime,
-	.adjfine	= ocelot_ptp_adjfine,
-	.verify		= ocelot_ptp_verify,
-	.enable		= ocelot_ptp_enable,
-};
-
 /* Hardware initialization done here so that we can allocate structures with
  * devm without fear of dsa_register_switch returning -EPROBE_DEFER and causing
  * us to allocate structures twice (leak memory) and map PCI memory twice
@@ -576,7 +559,7 @@ static int felix_setup(struct dsa_switch *ds)
 		return err;
 
 	if (ocelot->ptp) {
-		err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
+		err = ocelot_init_timestamp(ocelot, felix->info->ptp_caps);
 		if (err) {
 			dev_err(ocelot->dev,
 				"Timestamp initialization failed\n");
diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index 1d41eeda126e..d0b2043e0ccb 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -26,6 +26,7 @@ struct felix_info {
 	const struct vcap_props		*vcap;
 	int				switch_pci_bar;
 	int				imdio_pci_bar;
+	const struct ptp_clock_info	*ptp_caps;
 	int	(*mdio_bus_alloc)(struct ocelot *ocelot);
 	void	(*mdio_bus_free)(struct ocelot *ocelot);
 	void	(*phylink_validate)(struct ocelot *ocelot, int port,
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index b198fe9cb62b..38e0fba6bca8 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -719,6 +719,23 @@ static const struct vcap_props vsc9959_vcap_props[] = {
 	},
 };
 
+static const struct ptp_clock_info vsc9959_ptp_caps = {
+	.owner		= THIS_MODULE,
+	.name		= "felix ptp",
+	.max_adj	= 0x7fffffff,
+	.n_alarm	= 0,
+	.n_ext_ts	= 0,
+	.n_per_out	= OCELOT_PTP_PINS_NUM,
+	.n_pins		= OCELOT_PTP_PINS_NUM,
+	.pps		= 0,
+	.gettime64	= ocelot_ptp_gettime64,
+	.settime64	= ocelot_ptp_settime64,
+	.adjtime	= ocelot_ptp_adjtime,
+	.adjfine	= ocelot_ptp_adjfine,
+	.verify		= ocelot_ptp_verify,
+	.enable		= ocelot_ptp_enable,
+};
+
 #define VSC9959_INIT_TIMEOUT			50000
 #define VSC9959_GCB_RST_SLEEP			100
 #define VSC9959_SYS_RAMINIT_SLEEP		80
@@ -1169,6 +1186,7 @@ static const struct felix_info felix_info_vsc9959 = {
 	.num_tx_queues		= FELIX_NUM_TC,
 	.switch_pci_bar		= 4,
 	.imdio_pci_bar		= 0,
+	.ptp_caps		= &vsc9959_ptp_caps,
 	.mdio_bus_alloc		= vsc9959_mdio_bus_alloc,
 	.mdio_bus_free		= vsc9959_mdio_bus_free,
 	.phylink_validate	= vsc9959_phylink_validate,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH net-next 11/11] net: dsa: seville: build as separate module
  2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
                   ` (9 preceding siblings ...)
  2020-09-18 10:57 ` [PATCH net-next 10/11] net: dsa: felix: move the PTP clock structure to felix_vsc9959.c Vladimir Oltean
@ 2020-09-18 10:57 ` Vladimir Oltean
  10 siblings, 0 replies; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 10:57 UTC (permalink / raw)
  To: davem, netdev
  Cc: yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver, claudiu.manoil,
	alexandre.belloni, andrew, vivien.didelot, f.fainelli, kuba

From: Vladimir Oltean <vladimir.oltean@nxp.com>

Seville does not need to depend on PCI or on the ENETC MDIO controller.
There will also be other compile-time differences in the future.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/ocelot/Kconfig           | 22 ++++++++++++--------
 drivers/net/dsa/ocelot/Makefile          |  6 +++++-
 drivers/net/dsa/ocelot/felix.c           | 26 ------------------------
 drivers/net/dsa/ocelot/felix.h           |  2 --
 drivers/net/dsa/ocelot/felix_vsc9959.c   |  6 +++++-
 drivers/net/dsa/ocelot/seville_vsc9953.c |  6 +++++-
 6 files changed, 29 insertions(+), 39 deletions(-)

diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig
index e19718d4a7d4..c110e82a7973 100644
--- a/drivers/net/dsa/ocelot/Kconfig
+++ b/drivers/net/dsa/ocelot/Kconfig
@@ -10,11 +10,17 @@ config NET_DSA_MSCC_FELIX
 	select FSL_ENETC_MDIO
 	select PCS_LYNX
 	help
-	  This driver supports network switches from the Vitesse /
-	  Microsemi / Microchip Ocelot family of switching cores that are
-	  connected to their host CPU via Ethernet.
-	  The following switches are supported:
-	  - VSC9959 (Felix): embedded as a PCIe function of the NXP LS1028A
-	    ENETC integrated endpoint.
-	  - VSC9953 (Seville): embedded as a platform device on the
-	    NXP T1040 SoC.
+	  This driver supports the VSC9959 (Felix) switch, which is embedded as
+	  a PCIe function of the NXP LS1028A ENETC RCiEP.
+
+config NET_DSA_MSCC_SEVILLE
+	tristate "Ocelot / Seville Ethernet switch support"
+	depends on NET_DSA
+	depends on NET_VENDOR_MICROSEMI
+	depends on HAS_IOMEM
+	select MSCC_OCELOT_SWITCH_LIB
+	select NET_DSA_TAG_OCELOT
+	select PCS_LYNX
+	help
+	  This driver supports the VSC9953 (Seville) switch, which is embedded
+	  as a platform device on the NXP T1040 SoC.
diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makefile
index ec57a5a12330..f6dd131e7491 100644
--- a/drivers/net/dsa/ocelot/Makefile
+++ b/drivers/net/dsa/ocelot/Makefile
@@ -1,7 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o
+obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o
 
 mscc_felix-objs := \
 	felix.o \
-	felix_vsc9959.o \
+	felix_vsc9959.o
+
+mscc_seville-objs := \
+	felix.o \
 	seville_vsc9953.o
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c
index fb1b3e117c78..5f395d4119ac 100644
--- a/drivers/net/dsa/ocelot/felix.c
+++ b/drivers/net/dsa/ocelot/felix.c
@@ -788,29 +788,3 @@ const struct dsa_switch_ops felix_switch_ops = {
 	.cls_flower_stats	= felix_cls_flower_stats,
 	.port_setup_tc		= felix_port_setup_tc,
 };
-
-static int __init felix_init(void)
-{
-	int err;
-
-	err = pci_register_driver(&felix_vsc9959_pci_driver);
-	if (err)
-		return err;
-
-	err = platform_driver_register(&seville_vsc9953_driver);
-	if (err)
-		return err;
-
-	return 0;
-}
-module_init(felix_init);
-
-static void __exit felix_exit(void)
-{
-	pci_unregister_driver(&felix_vsc9959_pci_driver);
-	platform_driver_unregister(&seville_vsc9953_driver);
-}
-module_exit(felix_exit);
-
-MODULE_DESCRIPTION("Felix Switch driver");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h
index d0b2043e0ccb..cc3ec83a600a 100644
--- a/drivers/net/dsa/ocelot/felix.h
+++ b/drivers/net/dsa/ocelot/felix.h
@@ -42,8 +42,6 @@ struct felix_info {
 };
 
 extern const struct dsa_switch_ops felix_switch_ops;
-extern struct pci_driver felix_vsc9959_pci_driver;
-extern struct platform_driver seville_vsc9953_driver;
 
 /* DSA glue / front-end for struct ocelot */
 struct felix {
diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
index 38e0fba6bca8..79ddc4ba27a3 100644
--- a/drivers/net/dsa/ocelot/felix_vsc9959.c
+++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
@@ -1328,9 +1328,13 @@ static struct pci_device_id felix_ids[] = {
 };
 MODULE_DEVICE_TABLE(pci, felix_ids);
 
-struct pci_driver felix_vsc9959_pci_driver = {
+static struct pci_driver felix_vsc9959_pci_driver = {
 	.name		= "mscc_felix",
 	.id_table	= felix_ids,
 	.probe		= felix_pci_probe,
 	.remove		= felix_pci_remove,
 };
+module_pci_driver(felix_vsc9959_pci_driver);
+
+MODULE_DESCRIPTION("Felix Switch driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index 23f66bb1ab4e..650f7c0e6e6a 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -1110,7 +1110,7 @@ static const struct of_device_id seville_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, seville_of_match);
 
-struct platform_driver seville_vsc9953_driver = {
+static struct platform_driver seville_vsc9953_driver = {
 	.probe		= seville_probe,
 	.remove		= seville_remove,
 	.driver = {
@@ -1118,3 +1118,7 @@ struct platform_driver seville_vsc9953_driver = {
 		.of_match_table	= of_match_ptr(seville_of_match),
 	},
 };
+module_platform_driver(seville_vsc9953_driver);
+
+MODULE_DESCRIPTION("Seville Switch driver");
+MODULE_LICENSE("GPL v2");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH net-next 09/11] net: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info
  2020-09-18 10:57 ` [PATCH net-next 09/11] net: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info Vladimir Oltean
@ 2020-09-18 15:31   ` Alexandre Belloni
  0 siblings, 0 replies; 18+ messages in thread
From: Alexandre Belloni @ 2020-09-18 15:31 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: davem, netdev, yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver,
	claudiu.manoil, andrew, vivien.didelot, f.fainelli, kuba

On 18/09/2020 13:57:51+0300, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> It is a good measure to ensure correctness if the structures that are
> meant to remain constant are only processed by functions that thake
> constant arguments.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/net/ethernet/mscc/ocelot_ptp.c | 3 ++-
>  include/soc/mscc/ocelot_ptp.h          | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_ptp.c b/drivers/net/ethernet/mscc/ocelot_ptp.c
> index 1e08fe4daaef..a33ab315cc6b 100644
> --- a/drivers/net/ethernet/mscc/ocelot_ptp.c
> +++ b/drivers/net/ethernet/mscc/ocelot_ptp.c
> @@ -300,7 +300,8 @@ int ocelot_ptp_enable(struct ptp_clock_info *ptp,
>  }
>  EXPORT_SYMBOL(ocelot_ptp_enable);
>  
> -int ocelot_init_timestamp(struct ocelot *ocelot, struct ptp_clock_info *info)
> +int ocelot_init_timestamp(struct ocelot *ocelot,
> +			  const struct ptp_clock_info *info)
>  {
>  	struct ptp_clock *ptp_clock;
>  	int i;
> diff --git a/include/soc/mscc/ocelot_ptp.h b/include/soc/mscc/ocelot_ptp.h
> index 4a6b2f71b6b2..6a7388fa7cc5 100644
> --- a/include/soc/mscc/ocelot_ptp.h
> +++ b/include/soc/mscc/ocelot_ptp.h
> @@ -53,6 +53,7 @@ int ocelot_ptp_verify(struct ptp_clock_info *ptp, unsigned int pin,
>  		      enum ptp_pin_function func, unsigned int chan);
>  int ocelot_ptp_enable(struct ptp_clock_info *ptp,
>  		      struct ptp_clock_request *rq, int on);
> -int ocelot_init_timestamp(struct ocelot *ocelot, struct ptp_clock_info *info);
> +int ocelot_init_timestamp(struct ocelot *ocelot,
> +			  const struct ptp_clock_info *info);
>  int ocelot_deinit_timestamp(struct ocelot *ocelot);
>  #endif
> -- 
> 2.25.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller
  2020-09-18 10:57 ` [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller Vladimir Oltean
@ 2020-09-18 15:46   ` Alexandre Belloni
  2020-09-18 15:54     ` Vladimir Oltean
  0 siblings, 1 reply; 18+ messages in thread
From: Alexandre Belloni @ 2020-09-18 15:46 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: davem, netdev, yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver,
	claudiu.manoil, andrew, vivien.didelot, f.fainelli, kuba

On 18/09/2020 13:57:47+0300, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Some definitions were likely copied from
> drivers/net/mdio/mdio-mscc-miim.c.
> 
> They are not necessary, remove them.

Seeing that the mdio controller is probably the same, couldn't
mdio-mscc-miim be reused?

> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/dsa/ocelot/seville_vsc9953.c | 11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
> index dfc9a1b2a504..0b6ceec85891 100644
> --- a/drivers/net/dsa/ocelot/seville_vsc9953.c
> +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
> @@ -16,23 +16,12 @@
>  #define VSC9953_VCAP_IS2_ENTRY_WIDTH		376
>  #define VSC9953_VCAP_PORT_CNT			10
>  
> -#define MSCC_MIIM_REG_STATUS			0x0
> -#define		MSCC_MIIM_STATUS_STAT_BUSY	BIT(3)
> -#define MSCC_MIIM_REG_CMD			0x8
>  #define		MSCC_MIIM_CMD_OPR_WRITE		BIT(1)
>  #define		MSCC_MIIM_CMD_OPR_READ		BIT(2)
>  #define		MSCC_MIIM_CMD_WRDATA_SHIFT	4
>  #define		MSCC_MIIM_CMD_REGAD_SHIFT	20
>  #define		MSCC_MIIM_CMD_PHYAD_SHIFT	25
>  #define		MSCC_MIIM_CMD_VLD		BIT(31)
> -#define MSCC_MIIM_REG_DATA			0xC
> -#define		MSCC_MIIM_DATA_ERROR		(BIT(16) | BIT(17))
> -
> -#define MSCC_PHY_REG_PHY_CFG		0x0
> -#define		PHY_CFG_PHY_ENA		(BIT(0) | BIT(1) | BIT(2) | BIT(3))
> -#define		PHY_CFG_PHY_COMMON_RESET BIT(4)
> -#define		PHY_CFG_PHY_RESET	(BIT(5) | BIT(6) | BIT(7) | BIT(8))
> -#define MSCC_PHY_REG_PHY_STATUS		0x4
>  
>  static const u32 vsc9953_ana_regmap[] = {
>  	REG(ANA_ADVLEARN,			0x00b500),
> -- 
> 2.25.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller
  2020-09-18 15:46   ` Alexandre Belloni
@ 2020-09-18 15:54     ` Vladimir Oltean
  2020-09-18 17:37       ` Alexandre Belloni
  0 siblings, 1 reply; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 15:54 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: davem, netdev, yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver,
	claudiu.manoil, andrew, vivien.didelot, f.fainelli, kuba

On Fri, Sep 18, 2020 at 05:46:45PM +0200, Alexandre Belloni wrote:
> On 18/09/2020 13:57:47+0300, Vladimir Oltean wrote:
> > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> > Some definitions were likely copied from
> > drivers/net/mdio/mdio-mscc-miim.c.
> >
> > They are not necessary, remove them.
>
> Seeing that the mdio controller is probably the same, couldn't
> mdio-mscc-miim be reused?

Yeah, it probably can, but for 75 lines of code, is it worth it to
butcher mdio-mscc-miim too? I'm not sure at what level that reuse should
be. Should we pass it our regmap? mdio-mscc-miim doesn't use regmap.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller
  2020-09-18 15:54     ` Vladimir Oltean
@ 2020-09-18 17:37       ` Alexandre Belloni
  2020-09-18 18:59         ` Vladimir Oltean
  0 siblings, 1 reply; 18+ messages in thread
From: Alexandre Belloni @ 2020-09-18 17:37 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: davem, netdev, yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver,
	claudiu.manoil, andrew, vivien.didelot, f.fainelli, kuba

On 18/09/2020 18:54:42+0300, Vladimir Oltean wrote:
> On Fri, Sep 18, 2020 at 05:46:45PM +0200, Alexandre Belloni wrote:
> > On 18/09/2020 13:57:47+0300, Vladimir Oltean wrote:
> > > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> > >
> > > Some definitions were likely copied from
> > > drivers/net/mdio/mdio-mscc-miim.c.
> > >
> > > They are not necessary, remove them.
> >
> > Seeing that the mdio controller is probably the same, couldn't
> > mdio-mscc-miim be reused?
> 
> Yeah, it probably can, but for 75 lines of code, is it worth it to
> butcher mdio-mscc-miim too? I'm not sure at what level that reuse should
> be. Should we pass it our regmap? mdio-mscc-miim doesn't use regmap.

It may be worth it, I'm going to add DSA support for ocelot over SPI. So
to abstract the bus, it is probably worth moving to regmap.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller
  2020-09-18 17:37       ` Alexandre Belloni
@ 2020-09-18 18:59         ` Vladimir Oltean
  2020-09-18 20:11           ` Alexandre Belloni
  0 siblings, 1 reply; 18+ messages in thread
From: Vladimir Oltean @ 2020-09-18 18:59 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: davem, netdev, yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver,
	claudiu.manoil, andrew, vivien.didelot, f.fainelli, kuba

On Fri, Sep 18, 2020 at 07:37:19PM +0200, Alexandre Belloni wrote:
> On 18/09/2020 18:54:42+0300, Vladimir Oltean wrote:
> > On Fri, Sep 18, 2020 at 05:46:45PM +0200, Alexandre Belloni wrote:
> > > On 18/09/2020 13:57:47+0300, Vladimir Oltean wrote:
> > > > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> > > >
> > > > Some definitions were likely copied from
> > > > drivers/net/mdio/mdio-mscc-miim.c.
> > > >
> > > > They are not necessary, remove them.
> > >
> > > Seeing that the mdio controller is probably the same, couldn't
> > > mdio-mscc-miim be reused?
> >
> > Yeah, it probably can, but for 75 lines of code, is it worth it to
> > butcher mdio-mscc-miim too? I'm not sure at what level that reuse should
> > be. Should we pass it our regmap? mdio-mscc-miim doesn't use regmap.
>
> It may be worth it, I'm going to add DSA support for ocelot over SPI. So
> to abstract the bus, it is probably worth moving to regmap.

Wow, that's interesting, tell me more. For traffic, will you be using
an NPI port, or some other configuration?

And as for reusing mdio-mscc-miim, I think I'll look into that as a
separate set of patches.

Thanks,
-Vladimir

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller
  2020-09-18 18:59         ` Vladimir Oltean
@ 2020-09-18 20:11           ` Alexandre Belloni
  0 siblings, 0 replies; 18+ messages in thread
From: Alexandre Belloni @ 2020-09-18 20:11 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: davem, netdev, yangbo.lu, xiaoliang.yang_1, UNGLinuxDriver,
	claudiu.manoil, andrew, vivien.didelot, f.fainelli, kuba

On 18/09/2020 21:59:50+0300, Vladimir Oltean wrote:
> On Fri, Sep 18, 2020 at 07:37:19PM +0200, Alexandre Belloni wrote:
> > On 18/09/2020 18:54:42+0300, Vladimir Oltean wrote:
> > > On Fri, Sep 18, 2020 at 05:46:45PM +0200, Alexandre Belloni wrote:
> > > > On 18/09/2020 13:57:47+0300, Vladimir Oltean wrote:
> > > > > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> > > > >
> > > > > Some definitions were likely copied from
> > > > > drivers/net/mdio/mdio-mscc-miim.c.
> > > > >
> > > > > They are not necessary, remove them.
> > > >
> > > > Seeing that the mdio controller is probably the same, couldn't
> > > > mdio-mscc-miim be reused?
> > >
> > > Yeah, it probably can, but for 75 lines of code, is it worth it to
> > > butcher mdio-mscc-miim too? I'm not sure at what level that reuse should
> > > be. Should we pass it our regmap? mdio-mscc-miim doesn't use regmap.
> >
> > It may be worth it, I'm going to add DSA support for ocelot over SPI. So
> > to abstract the bus, it is probably worth moving to regmap.
> 
> Wow, that's interesting, tell me more. For traffic, will you be using
> an NPI port, or some other configuration?
> 

Yes, the plan is to use SPI for configuration and an NPI port for
traffic. The internal MIPS CPU will be disabled. If I'm not mistaken,
this is what is done for vsc73xx.

> And as for reusing mdio-mscc-miim, I think I'll look into that as a
> separate set of patches.
> 

No worries, I can also take care of that. Or maybe you are right and it
doesn't make sense to do it.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-09-18 20:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 10:57 [PATCH net-next 00/11] Felix DSA driver cleanup: build Seville separately Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 01/11] net: dsa: felix: use ocelot_field_{read,write} helpers consistently Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 02/11] net: dsa: seville: don't write to MEM_ENA twice Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 03/11] net: dsa: seville: first enable memories, then initialize them Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 04/11] net: dsa: ocelot: document why reset procedure is different for felix/seville Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 05/11] net: dsa: seville: remove unused defines for the mdio controller Vladimir Oltean
2020-09-18 15:46   ` Alexandre Belloni
2020-09-18 15:54     ` Vladimir Oltean
2020-09-18 17:37       ` Alexandre Belloni
2020-09-18 18:59         ` Vladimir Oltean
2020-09-18 20:11           ` Alexandre Belloni
2020-09-18 10:57 ` [PATCH net-next 06/11] net: dsa: seville: reindent defines for MDIO controller Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 07/11] net: dsa: felix: replace tabs with spaces Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 08/11] net: dsa: seville: duplicate vsc9959_mdio_bus_free Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 09/11] net: mscc: ocelot: make ocelot_init_timestamp take a const struct ptp_clock_info Vladimir Oltean
2020-09-18 15:31   ` Alexandre Belloni
2020-09-18 10:57 ` [PATCH net-next 10/11] net: dsa: felix: move the PTP clock structure to felix_vsc9959.c Vladimir Oltean
2020-09-18 10:57 ` [PATCH net-next 11/11] net: dsa: seville: build as separate module Vladimir Oltean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.