Skip to contentSkip to conversation

DSA driver for Vitesse Felix switch

PATCH Superseded Vladimir Oltean 6 participants 52 messages Nov 12, 2019 – Nov 13, 2019

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Vladimir Oltean

author maintainer
#0 lore raw

cover DSA driver for Vitesse Felix switch

This series builds upon the previous "Accomodate DSA front-end into Ocelot" topic and does the following:

- Reworks the Ocelot (VSC7514) driver to support one more switching core (VSC9959), used in NPI mode. Some code which was thought to be SoC-specific (ocelot_board.c) wasn't, and vice versa, so it is being accordingly moved.
- Exports ocelot driver structures and functions to include/soc/mscc.
- Adds a DSA ocelot front-end for VSC9959, which is a PCI device and uses the exported ocelot functionality for hardware configuration.
- Adds a tagger driver for the Vitesse injection/extraction DSA headers. This is known to be compatible with at least Ocelot and Felix.

Claudiu Manoil (2):
net: mscc: ocelot: move resource ioremap and regmap init to common
code
net: mscc: ocelot: filter out ocelot SoC specific PCS config from
common path

Vladimir Oltean (10):
net: mscc: ocelot: move invariant configs out of adjust_link
net: mscc: ocelot: create a helper for changing the port MTU
net: mscc: ocelot: export a constant for the tag length in bytes
net: mscc: ocelot: adjust MTU on the CPU port in NPI mode
net: mscc: ocelot: separate the implementation of switch reset
net: mscc: ocelot: publish structure definitions to
include/soc/mscc/ocelot.h
net: mscc: ocelot: publish ocelot_sys.h to include/soc/mscc
net: dsa: vitesse: move vsc73xx driver to a separate folder
net: dsa: vitesse: add basic Felix switch driver
net: dsa: vitesse: add tagger for Ocelot/Felix switches

 MAINTAINERS                                   |   8 +
 drivers/net/dsa/Kconfig                       |  31 +-
 drivers/net/dsa/Makefile                      |   4 +-
 drivers/net/dsa/vitesse/Kconfig               |  44 ++
 drivers/net/dsa/vitesse/Makefile              |  10 +
 drivers/net/dsa/vitesse/felix-regs.c          | 647 ++++++++++++++++
 drivers/net/dsa/vitesse/felix.c               | 358 +++++++++
 drivers/net/dsa/vitesse/felix.h               |  36 +
 .../vsc73xx-core.c}                           |   2 +-
 .../vsc73xx-platform.c}                       |   2 +-
 .../vsc73xx-spi.c}                            |   2 +-
 .../{vitesse-vsc73xx.h => vitesse/vsc73xx.h}  |   0
 drivers/net/ethernet/mscc/ocelot.c            | 205 ++---
 drivers/net/ethernet/mscc/ocelot.h            | 479 +-----------
 drivers/net/ethernet/mscc/ocelot_board.c      |  85 ++-
 drivers/net/ethernet/mscc/ocelot_io.c         |  14 +-
 drivers/net/ethernet/mscc/ocelot_regs.c       |   4 +-
 include/net/dsa.h                             |   2 +
 include/soc/mscc/ocelot.h                     | 698 ++++++++++++++++++
 .../soc}/mscc/ocelot_sys.h                    |   0
 net/dsa/Kconfig                               |   7 +
 net/dsa/Makefile                              |   1 +
 net/dsa/tag_ocelot.c                          | 229 ++++++
 23 files changed, 2231 insertions(+), 637 deletions(-)
 create mode 100644 drivers/net/dsa/vitesse/Kconfig
 create mode 100644 drivers/net/dsa/vitesse/Makefile
 create mode 100644 drivers/net/dsa/vitesse/felix-regs.c
 create mode 100644 drivers/net/dsa/vitesse/felix.c
 create mode 100644 drivers/net/dsa/vitesse/felix.h
 rename drivers/net/dsa/{vitesse-vsc73xx-core.c => vitesse/vsc73xx-core.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-platform.c => vitesse/vsc73xx-platform.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-spi.c => vitesse/vsc73xx-spi.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx.h => vitesse/vsc73xx.h} (100%)
 create mode 100644 include/soc/mscc/ocelot.h
 rename {drivers/net/ethernet => include/soc}/mscc/ocelot_sys.h (100%)
 create mode 100644 net/dsa/tag_ocelot.c
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH 1/12 net: mscc: ocelot: move resource ioremap and regmap init to common code

From: Claudiu Manoil <[email protected]>

Let's make this ioremap and regmap init code common. It should not be platform dependent as it should be usable by PCI devices too. Use better names where necessary to avoid clashes.

---
 drivers/net/ethernet/mscc/ocelot.h       |  4 +---
 drivers/net/ethernet/mscc/ocelot_board.c | 17 ++++++++++-------
 drivers/net/ethernet/mscc/ocelot_io.c    | 14 +++++---------
 3 files changed, 16 insertions(+), 19 deletions(-)
drivers/net/ethernet/mscc/ocelot.h +1 -3
index 4d8e769ccad9..b5802cea7cc4 100644
@@ -546,9 +546,7 @@ void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg);
 
 int ocelot_regfields_init(struct ocelot *ocelot,
 			  const struct reg_field *const regfields);
-struct regmap *ocelot_io_platform_init(struct ocelot *ocelot,
-				       struct platform_device *pdev,
-				       const char *name);
+struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
 
 #define ocelot_field_write(ocelot, reg, val) regmap_field_write((ocelot)->regfields[(reg)], (val))
 #define ocelot_field_read(ocelot, reg, val) regmap_field_read((ocelot)->regfields[(reg)], (val))
drivers/net/ethernet/mscc/ocelot_board.c +10 -7
index 811599f32910..ddb34f17fa52 100644
@@ -268,7 +268,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 		enum ocelot_target id;
 		char *name;
 		u8 optional:1;
-	} res[] = {
+	} io_target[] = {
 		{ SYS, "sys" },
 		{ REW, "rew" },
 		{ QSYS, "qsys" },
@@ -288,20 +288,23 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, ocelot);
 	ocelot->dev = &pdev->dev;
 
-	for (i = 0; i < ARRAY_SIZE(res); i++) {
+	for (i = 0; i < ARRAY_SIZE(io_target); i++) {
 		struct regmap *target;
+		struct resource *res;
+
+		res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+						   io_target[i].name);
 
-		target = ocelot_io_platform_init(ocelot, pdev, res[i].name);
+		target = ocelot_regmap_init(ocelot, res);
 		if (IS_ERR(target)) {
-			if (res[i].optional) {
-				ocelot->targets[res[i].id] = NULL;
+			if (io_target[i].optional) {
+				ocelot->targets[io_target[i].id] = NULL;
 				continue;
 			}
-
 			return PTR_ERR(target);
 		}
 
-		ocelot->targets[res[i].id] = target;
+		ocelot->targets[io_target[i].id] = target;
 	}
 
 	hsio = syscon_regmap_lookup_by_compatible("mscc,ocelot-hsio");
drivers/net/ethernet/mscc/ocelot_io.c +5 -9
index c6db8ad31fdf..b229b1cb68ef 100644
@@ -97,20 +97,16 @@ static struct regmap_config ocelot_regmap_config = {
 	.reg_stride	= 4,
 };
 
-struct regmap *ocelot_io_platform_init(struct ocelot *ocelot,
-				       struct platform_device *pdev,
-				       const char *name)
+struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res)
 {
-	struct resource *res;
 	void __iomem *regs;
 
-	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
 	regs = devm_ioremap_resource(ocelot->dev, res);
 	if (IS_ERR(regs))
 		return ERR_CAST(regs);
 
-	ocelot_regmap_config.name = name;
-	return devm_regmap_init_mmio(ocelot->dev, regs,
-				     &ocelot_regmap_config);
+	ocelot_regmap_config.name = res->name;
+
+	return devm_regmap_init_mmio(ocelot->dev, regs, &ocelot_regmap_config);
 }
-EXPORT_SYMBOL(ocelot_io_platform_init);
+EXPORT_SYMBOL(ocelot_regmap_init);
Signature · 1 line
2.17.1
author maintainer
#6 lore raw

PATCH 3/12 net: mscc: ocelot: move invariant configs out of adjust_link

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

It doesn't make sense to rewrite all these registers every time the PHY library notifies us about a link state change.

In a future patch we will customize the MTU for the CPU port, and since the MTU was previously configured from adjust_link, if we don't make this change, its value would have got overridden.

---
 drivers/net/ethernet/mscc/ocelot.c | 85 +++++++++++++++---------------
 1 file changed, 43 insertions(+), 42 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +43 -42
index 2b6792ab0eda..4558c09e2e8a 100644
@@ -408,7 +408,7 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 			       struct phy_device *phydev)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
-	int speed, atop_wm, mode = 0;
+	int speed, mode = 0;
 
 	switch (phydev->speed) {
 	case SPEED_10:
@@ -440,32 +440,9 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 	ocelot_port_writel(ocelot_port, DEV_MAC_MODE_CFG_FDX_ENA |
 			   mode, DEV_MAC_MODE_CFG);
 
-	/* Set MAC IFG Gaps
-	 * FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 0
-	 * !FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 5
-	 */
-	ocelot_port_writel(ocelot_port, DEV_MAC_IFG_CFG_TX_IFG(5),
-			   DEV_MAC_IFG_CFG);
-
-	/* Load seed (0) and set MAC HDX late collision  */
-	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67) |
-			   DEV_MAC_HDX_CFG_SEED_LOAD,
-			   DEV_MAC_HDX_CFG);
-	mdelay(1);
-	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67),
-			   DEV_MAC_HDX_CFG);
-
 	if (ocelot->ops->pcs_init)
 		ocelot->ops->pcs_init(ocelot, port);
 
-	/* Set Max Length and maximum tags allowed */
-	ocelot_port_writel(ocelot_port, VLAN_ETH_FRAME_LEN,
-			   DEV_MAC_MAXLEN_CFG);
-	ocelot_port_writel(ocelot_port, DEV_MAC_TAGS_CFG_TAG_ID(ETH_P_8021AD) |
-			   DEV_MAC_TAGS_CFG_VLAN_AWR_ENA |
-			   DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA,
-			   DEV_MAC_TAGS_CFG);
-
 	/* Enable MAC module */
 	ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA |
 			   DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG);
@@ -475,22 +452,10 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 	ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed),
 			   DEV_CLOCK_CFG);
 
-	/* Set SMAC of Pause frame (00:00:00:00:00:00) */
-	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_HIGH_CFG);
-	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_LOW_CFG);
-
 	/* No PFC */
 	ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed),
 			 ANA_PFC_PFC_CFG, port);
 
-	/* Set Pause WM hysteresis
-	 * 152 = 6 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
-	 * 101 = 4 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
-	 */
-	ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
-			 SYS_PAUSE_CFG_PAUSE_STOP(101) |
-			 SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
-
 	/* Core: Enable port for frame transfer */
 	ocelot_write_rix(ocelot, QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE |
 			 QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG(1) |
@@ -505,12 +470,6 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 			 SYS_MAC_FC_CFG_FC_LINK_SPEED(speed),
 			 SYS_MAC_FC_CFG, port);
 	ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port);
-
-	/* Tail dropping watermark */
-	atop_wm = (ocelot->shared_queue_sz - 9 * VLAN_ETH_FRAME_LEN) / OCELOT_BUFFER_CELL_SZ;
-	ocelot_write_rix(ocelot, ocelot_wm_enc(9 * VLAN_ETH_FRAME_LEN),
-			 SYS_ATOP, port);
-	ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
 }
 
 static void ocelot_port_adjust_link(struct net_device *dev)
@@ -2141,11 +2100,53 @@ static int ocelot_init_timestamp(struct ocelot *ocelot)
 static void ocelot_init_port(struct ocelot *ocelot, int port)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
+	int atop_wm;
 
 	INIT_LIST_HEAD(&ocelot_port->skbs);
 
 	/* Basic L2 initialization */
 
+	/* Set MAC IFG Gaps
+	 * FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 0
+	 * !FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 5
+	 */
+	ocelot_port_writel(ocelot_port, DEV_MAC_IFG_CFG_TX_IFG(5),
+			   DEV_MAC_IFG_CFG);
+
+	/* Load seed (0) and set MAC HDX late collision  */
+	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67) |
+			   DEV_MAC_HDX_CFG_SEED_LOAD,
+			   DEV_MAC_HDX_CFG);
+	mdelay(1);
+	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67),
+			   DEV_MAC_HDX_CFG);
+
+	/* Set Max Length and maximum tags allowed */
+	ocelot_port_writel(ocelot_port, VLAN_ETH_FRAME_LEN,
+			   DEV_MAC_MAXLEN_CFG);
+	ocelot_port_writel(ocelot_port, DEV_MAC_TAGS_CFG_TAG_ID(ETH_P_8021AD) |
+			   DEV_MAC_TAGS_CFG_VLAN_AWR_ENA |
+			   DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA,
+			   DEV_MAC_TAGS_CFG);
+
+	/* Set SMAC of Pause frame (00:00:00:00:00:00) */
+	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_HIGH_CFG);
+	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_LOW_CFG);
+
+	/* Set Pause WM hysteresis
+	 * 152 = 6 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
+	 * 101 = 4 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
+	 */
+	ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
+			 SYS_PAUSE_CFG_PAUSE_STOP(101) |
+			 SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
+
+	/* Tail dropping watermark */
+	atop_wm = (ocelot->shared_queue_sz - 9 * VLAN_ETH_FRAME_LEN) / OCELOT_BUFFER_CELL_SZ;
+	ocelot_write_rix(ocelot, ocelot_wm_enc(9 * VLAN_ETH_FRAME_LEN),
+			 SYS_ATOP, port);
+	ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
+
 	/* Drop frames with multicast source address */
 	ocelot_rmw_gix(ocelot, ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,
 		       ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH 2/12 net: mscc: ocelot: filter out ocelot SoC specific PCS config from common path

In reply to Vladimir Oltean

From: Claudiu Manoil <[email protected]>

The adjust_link routine should be generic enough to be (re)used by any SoC that integrates a switch core compatible with the Ocelot core switch driver. Currently all configurations are generic except for the PCS settings that are SoC specific. Move these out to the Ocelot SoC/board instance.

---
 drivers/net/ethernet/mscc/ocelot.c       | 19 ++--------------
 drivers/net/ethernet/mscc/ocelot.h       |  8 ++++++-
 drivers/net/ethernet/mscc/ocelot_board.c | 29 +++++++++++++++++++++++-
 drivers/net/ethernet/mscc/ocelot_regs.c  |  4 ++--
 4 files changed, 39 insertions(+), 21 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +2 -17
index 3e7a2796c37d..2b6792ab0eda 100644
@@ -455,23 +455,8 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67),
 			   DEV_MAC_HDX_CFG);
 
-	/* Disable HDX fast control */
-	ocelot_port_writel(ocelot_port, DEV_PORT_MISC_HDX_FAST_DIS,
-			   DEV_PORT_MISC);
-
-	/* SGMII only for now */
-	ocelot_port_writel(ocelot_port, PCS1G_MODE_CFG_SGMII_MODE_ENA,
-			   PCS1G_MODE_CFG);
-	ocelot_port_writel(ocelot_port, PCS1G_SD_CFG_SD_SEL, PCS1G_SD_CFG);
-
-	/* Enable PCS */
-	ocelot_port_writel(ocelot_port, PCS1G_CFG_PCS_ENA, PCS1G_CFG);
-
-	/* No aneg on SGMII */
-	ocelot_port_writel(ocelot_port, 0, PCS1G_ANEG_CFG);
-
-	/* No loopback */
-	ocelot_port_writel(ocelot_port, 0, PCS1G_LB_CFG);
+	if (ocelot->ops->pcs_init)
+		ocelot->ops->pcs_init(ocelot, port);
 
 	/* Set Max Length and maximum tags allowed */
 	ocelot_port_writel(ocelot_port, VLAN_ETH_FRAME_LEN,
drivers/net/ethernet/mscc/ocelot.h +7 -1
index b5802cea7cc4..7e28434c22c1 100644
@@ -435,13 +435,19 @@ enum ocelot_tag_prefix {
 };
 
 struct ocelot_port;
+struct ocelot;
 
 struct ocelot_stat_layout {
 	u32 offset;
 	char name[ETH_GSTRING_LEN];
 };
 
+struct ocelot_ops {
+	void (*pcs_init)(struct ocelot *ocelot, int port);
+};
+
 struct ocelot {
+	const struct ocelot_ops *ops;
 	struct device *dev;
 
 	struct regmap *targets[TARGET_MAX];
@@ -553,7 +559,7 @@ struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res);
 
 int ocelot_init(struct ocelot *ocelot);
 void ocelot_deinit(struct ocelot *ocelot);
-int ocelot_chip_init(struct ocelot *ocelot);
+int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops);
 int ocelot_probe_port(struct ocelot *ocelot, u8 port,
 		      void __iomem *regs,
 		      struct phy_device *phy);
drivers/net/ethernet/mscc/ocelot_board.c +28 -1
index ddb34f17fa52..de2da6d33d43 100644
@@ -254,6 +254,33 @@ static const struct of_device_id mscc_ocelot_match[] = {
 };
 MODULE_DEVICE_TABLE(of, mscc_ocelot_match);
 
+static void ocelot_port_pcs_init(struct ocelot *ocelot, int port)
+{
+	struct ocelot_port *ocelot_port = ocelot->ports[port];
+
+	/* Disable HDX fast control */
+	ocelot_port_writel(ocelot_port, DEV_PORT_MISC_HDX_FAST_DIS,
+			   DEV_PORT_MISC);
+
+	/* SGMII only for now */
+	ocelot_port_writel(ocelot_port, PCS1G_MODE_CFG_SGMII_MODE_ENA,
+			   PCS1G_MODE_CFG);
+	ocelot_port_writel(ocelot_port, PCS1G_SD_CFG_SD_SEL, PCS1G_SD_CFG);
+
+	/* Enable PCS */
+	ocelot_port_writel(ocelot_port, PCS1G_CFG_PCS_ENA, PCS1G_CFG);
+
+	/* No aneg on SGMII */
+	ocelot_port_writel(ocelot_port, 0, PCS1G_ANEG_CFG);
+
+	/* No loopback */
+	ocelot_port_writel(ocelot_port, 0, PCS1G_LB_CFG);
+}
+
+static const struct ocelot_ops ocelot_ops = {
+	.pcs_init		= ocelot_port_pcs_init,
+};
+
 static int mscc_ocelot_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
@@ -315,7 +342,7 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 
 	ocelot->targets[HSIO] = hsio;
 
-	err = ocelot_chip_init(ocelot);
+	err = ocelot_chip_init(ocelot, &ocelot_ops);
 	if (err)
 		return err;
 
drivers/net/ethernet/mscc/ocelot_regs.c +2 -2
index e59977d20400..d715a924108b 100644
@@ -423,7 +423,7 @@ static void ocelot_pll5_init(struct ocelot *ocelot)
 		     HSIO_PLL5G_CFG2_AMPC_SEL(0x10));
 }
 
-int ocelot_chip_init(struct ocelot *ocelot)
+int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops)
 {
 	int ret;
 
@@ -431,6 +431,7 @@ int ocelot_chip_init(struct ocelot *ocelot)
 	ocelot->stats_layout = ocelot_stats_layout;
 	ocelot->num_stats = ARRAY_SIZE(ocelot_stats_layout);
 	ocelot->shared_queue_sz = 224 * 1024;
+	ocelot->ops = ops;
 
 	ret = ocelot_regfields_init(ocelot, ocelot_regfields);
 	if (ret)
@@ -443,4 +444,3 @@ int ocelot_chip_init(struct ocelot *ocelot)
 
 	return 0;
 }
-EXPORT_SYMBOL(ocelot_chip_init);
Signature · 1 line
2.17.1
author maintainer
#22 lore raw

PATCH 7/12 net: mscc: ocelot: separate the implementation of switch reset

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The Felix switch has a different reset procedure, so a function pointer needs to be created and added to the ocelot_ops structure.

The reset procedure has been moved into ocelot_init.

---
 drivers/net/ethernet/mscc/ocelot.c       |  3 ++
 drivers/net/ethernet/mscc/ocelot.h       |  1 +
 drivers/net/ethernet/mscc/ocelot_board.c | 37 +++++++++++++++---------
 3 files changed, 28 insertions(+), 13 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +3 -0
index 42da193a8240..0fe928026e61 100644
@@ -2294,6 +2294,9 @@ int ocelot_init(struct ocelot *ocelot)
 	ocelot_vlan_init(ocelot);
 	ocelot_ace_init(ocelot);
 
+	if (ocelot->ops->reset)
+		ocelot->ops->reset(ocelot);
+
 	for (port = 0; port < ocelot->num_phys_ports; port++) {
 		/* Clear all counters (5 groups) */
 		ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(port) |
drivers/net/ethernet/mscc/ocelot.h +1 -0
index bdc9b1d34b81..199ca2d6ea32 100644
@@ -446,6 +446,7 @@ struct ocelot_stat_layout {
 
 struct ocelot_ops {
 	void (*pcs_init)(struct ocelot *ocelot, int port);
+	int (*reset)(struct ocelot *ocelot);
 };
 
 struct ocelot {
drivers/net/ethernet/mscc/ocelot_board.c +24 -13
index 32aafd951483..5581b3b0165c 100644
@@ -277,8 +277,32 @@ static void ocelot_port_pcs_init(struct ocelot *ocelot, int port)
 	ocelot_port_writel(ocelot_port, 0, PCS1G_LB_CFG);
 }
 
+static int ocelot_reset(struct ocelot *ocelot)
+{
+	int retries = 100;
+	u32 val;
+
+	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1);
+	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
+
+	do {
+		msleep(1);
+		regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT],
+				  &val);
+	} while (val && --retries);
+
+	if (!retries)
+		return -ETIMEDOUT;
+
+	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
+	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1);
+
+	return 0;
+}
+
 static const struct ocelot_ops ocelot_ops = {
 	.pcs_init		= ocelot_port_pcs_init,
+	.reset			= ocelot_reset,
 };
 
 static int mscc_ocelot_probe(struct platform_device *pdev)
@@ -289,7 +313,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 	struct ocelot *ocelot;
 	struct regmap *hsio;
 	unsigned int i;
-	u32 val;
 
 	struct {
 		enum ocelot_target id;
@@ -369,18 +392,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 		ocelot->ptp = 1;
 	}
 
-	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1);
-	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
-
-	do {
-		msleep(1);
-		regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT],
-				  &val);
-	} while (val);
-
-	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1);
-	regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1);
-
 	ocelot->num_cpu_ports = 1; /* 1 port on the switch, two groups */
 
 	ports = of_get_child_by_name(np, "ethernet-ports");
Signature · 1 line
2.17.1
author maintainer
#17 lore raw

PATCH 6/12 net: mscc: ocelot: adjust MTU on the CPU port in NPI mode

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

When using the NPI port, the DSA tag is passed through Ethernet, so the switch's MAC needs to accept it as it comes from the DSA master. Increase the MTU on the external CPU port to account for the length of the injection header.

---
 drivers/net/ethernet/mscc/ocelot.c | 9 +++++++++
 drivers/net/ethernet/mscc/ocelot.h | 2 ++
 2 files changed, 11 insertions(+)
drivers/net/ethernet/mscc/ocelot.c +9 -0
index 8b73d760dfa5..42da193a8240 100644
@@ -2230,9 +2230,18 @@ void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu,
 	 * Only one port can be an NPI at the same time.
 	 */
 	if (cpu < ocelot->num_phys_ports) {
+		int mtu = VLAN_ETH_FRAME_LEN + OCELOT_TAG_LEN;
+
 		ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M |
 			     QSYS_EXT_CPU_CFG_EXT_CPU_PORT(cpu),
 			     QSYS_EXT_CPU_CFG);
+
+		if (injection == OCELOT_TAG_PREFIX_SHORT)
+			mtu += OCELOT_SHORT_PREFIX_LEN;
+		else if (injection == OCELOT_TAG_PREFIX_LONG)
+			mtu += OCELOT_LONG_PREFIX_LEN;
+
+		ocelot_port_set_mtu(ocelot, cpu, mtu);
 	}
 
 	/* CPU port Injection/Extraction configuration */
drivers/net/ethernet/mscc/ocelot.h +2 -0
index 9159b0adf1e7..bdc9b1d34b81 100644
@@ -65,6 +65,8 @@ struct frame_info {
 #define IFH_REW_OP_ORIGIN_PTP		0x5
 
 #define OCELOT_TAG_LEN			16
+#define OCELOT_SHORT_PREFIX_LEN		4
+#define OCELOT_LONG_PREFIX_LEN		16
 
 #define OCELOT_SPEED_2500 0
 #define OCELOT_SPEED_1000 1
Signature · 1 line
2.17.1
author maintainer
#14 lore raw

PATCH 5/12 net: mscc: ocelot: export a constant for the tag length in bytes

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

This constant will be used in a future patch to increase the MTU on NPI ports, and will also be used in the tagger driver for Felix.

---
 drivers/net/ethernet/mscc/ocelot.c       | 4 ++--
 drivers/net/ethernet/mscc/ocelot.h       | 4 ++--
 drivers/net/ethernet/mscc/ocelot_board.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +2 -2
index 8ede8ad902c9..8b73d760dfa5 100644
@@ -576,11 +576,11 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct skb_shared_info *shinfo = skb_shinfo(skb);
 	struct ocelot_port *ocelot_port = &priv->port;
 	struct ocelot *ocelot = ocelot_port->ocelot;
+	u32 val, ifh[OCELOT_TAG_LEN / 4];
 	struct frame_info info = {};
 	u8 grp = 0; /* Send everything on CPU group 0 */
 	unsigned int i, count, last;
 	int port = priv->chip_port;
-	u32 val, ifh[IFH_LEN];
 
 	val = ocelot_read(ocelot, QS_INJ_STATUS);
 	if (!(val & QS_INJ_STATUS_FIFO_RDY(BIT(grp))) ||
@@ -603,7 +603,7 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	ocelot_gen_ifh(ifh, &info);
 
-	for (i = 0; i < IFH_LEN; i++)
+	for (i = 0; i < OCELOT_TAG_LEN / 4; i++)
 		ocelot_write_rix(ocelot, (__force u32)cpu_to_be32(ifh[i]),
 				 QS_INJ_WR, grp);
 
drivers/net/ethernet/mscc/ocelot.h +2 -2
index 7e28434c22c1..9159b0adf1e7 100644
@@ -43,8 +43,6 @@
 
 #define OCELOT_PTP_QUEUE_SZ	128
 
-#define IFH_LEN 4
-
 struct frame_info {
 	u32 len;
 	u16 port;
@@ -66,6 +64,8 @@ struct frame_info {
 #define IFH_REW_OP_TWO_STEP_PTP		0x3
 #define IFH_REW_OP_ORIGIN_PTP		0x5
 
+#define OCELOT_TAG_LEN			16
+
 #define OCELOT_SPEED_2500 0
 #define OCELOT_SPEED_1000 1
 #define OCELOT_SPEED_100  2
drivers/net/ethernet/mscc/ocelot_board.c +1 -1
index de2da6d33d43..32aafd951483 100644
@@ -105,7 +105,7 @@ static irqreturn_t ocelot_xtr_irq_handler(int irq, void *arg)
 		int sz, len, buf_len;
 		struct sk_buff *skb;
 
-		for (i = 0; i < IFH_LEN; i++) {
+		for (i = 0; i < OCELOT_TAG_LEN / 4; i++) {
 			err = ocelot_rx_frame_word(ocelot, grp, true, &ifh[i]);
 			if (err != 4)
 				break;
Signature · 1 line
2.17.1
author maintainer
#10 lore raw

PATCH 4/12 net: mscc: ocelot: create a helper for changing the port MTU

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

Since in an NPI/DSA setup, not all ports will have the same MTU, we need to make sure the watermarks for pause frames and/or tail dropping logic that existed in the driver is still coherent for the new MTU values.

---
 drivers/net/ethernet/mscc/ocelot.c | 40 +++++++++++++++++-------------
 1 file changed, 23 insertions(+), 17 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +23 -17
index 4558c09e2e8a..8ede8ad902c9 100644
@@ -2097,11 +2097,32 @@ static int ocelot_init_timestamp(struct ocelot *ocelot)
 	return 0;
 }
 
-static void ocelot_init_port(struct ocelot *ocelot, int port)
+static void ocelot_port_set_mtu(struct ocelot *ocelot, int port, size_t mtu)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	int atop_wm;
 
+	ocelot_port_writel(ocelot_port, mtu, DEV_MAC_MAXLEN_CFG);
+
+	/* Set Pause WM hysteresis
+	 * 152 = 6 * mtu / OCELOT_BUFFER_CELL_SZ
+	 * 101 = 4 * mtu / OCELOT_BUFFER_CELL_SZ
+	 */
+	ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
+			 SYS_PAUSE_CFG_PAUSE_STOP(101) |
+			 SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
+
+	/* Tail dropping watermark */
+	atop_wm = (ocelot->shared_queue_sz - 9 * mtu) / OCELOT_BUFFER_CELL_SZ;
+	ocelot_write_rix(ocelot, ocelot_wm_enc(9 * mtu),
+			 SYS_ATOP, port);
+	ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
+}
+
+static void ocelot_init_port(struct ocelot *ocelot, int port)
+{
+	struct ocelot_port *ocelot_port = ocelot->ports[port];
+
 	INIT_LIST_HEAD(&ocelot_port->skbs);
 
 	/* Basic L2 initialization */
@@ -2122,8 +2143,7 @@ static void ocelot_init_port(struct ocelot *ocelot, int port)
 			   DEV_MAC_HDX_CFG);
 
 	/* Set Max Length and maximum tags allowed */
-	ocelot_port_writel(ocelot_port, VLAN_ETH_FRAME_LEN,
-			   DEV_MAC_MAXLEN_CFG);
+	ocelot_port_set_mtu(ocelot, port, VLAN_ETH_FRAME_LEN);
 	ocelot_port_writel(ocelot_port, DEV_MAC_TAGS_CFG_TAG_ID(ETH_P_8021AD) |
 			   DEV_MAC_TAGS_CFG_VLAN_AWR_ENA |
 			   DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA,
@@ -2133,20 +2153,6 @@ static void ocelot_init_port(struct ocelot *ocelot, int port)
 	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_HIGH_CFG);
 	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_LOW_CFG);
 
-	/* Set Pause WM hysteresis
-	 * 152 = 6 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
-	 * 101 = 4 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
-	 */
-	ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
-			 SYS_PAUSE_CFG_PAUSE_STOP(101) |
-			 SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
-
-	/* Tail dropping watermark */
-	atop_wm = (ocelot->shared_queue_sz - 9 * VLAN_ETH_FRAME_LEN) / OCELOT_BUFFER_CELL_SZ;
-	ocelot_write_rix(ocelot, ocelot_wm_enc(9 * VLAN_ETH_FRAME_LEN),
-			 SYS_ATOP, port);
-	ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
-
 	/* Drop frames with multicast source address */
 	ocelot_rmw_gix(ocelot, ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,
 		       ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,
Signature · 1 line
2.17.1
author maintainer
#34 lore raw

PATCH 10/12 net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The vitesse/ folder will contain drivers for switching chips derived from legacy Vitesse IPs (VSC family), including those produced by Microsemi and Microchip (acquirers of Vitesse).

---
 drivers/net/dsa/Kconfig                       | 31 +------------------
 drivers/net/dsa/Makefile                      |  4 +--
 drivers/net/dsa/vitesse/Kconfig               | 31 +++++++++++++++++++
 drivers/net/dsa/vitesse/Makefile              |  3 ++
 .../vsc73xx-core.c}                           |  2 +-
 .../vsc73xx-platform.c}                       |  2 +-
 .../vsc73xx-spi.c}                            |  2 +-
 .../{vitesse-vsc73xx.h => vitesse/vsc73xx.h}  |  0
 8 files changed, 39 insertions(+), 36 deletions(-)
 create mode 100644 drivers/net/dsa/vitesse/Kconfig
 create mode 100644 drivers/net/dsa/vitesse/Makefile
 rename drivers/net/dsa/{vitesse-vsc73xx-core.c => vitesse/vsc73xx-core.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-platform.c => vitesse/vsc73xx-platform.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-spi.c => vitesse/vsc73xx-spi.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx.h => vitesse/vsc73xx.h} (100%)
drivers/net/dsa/Kconfig +1 -30
index 685e12b05a7c..ec91960e58ac 100644
@@ -99,35 +99,6 @@ config NET_DSA_SMSC_LAN9303_MDIO
 	  Enable access functions if the SMSC/Microchip LAN9303 is configured
 	  for MDIO managed mode.
 
-config NET_DSA_VITESSE_VSC73XX
-	tristate
-	depends on OF
-	depends on NET_DSA
-	select FIXED_PHY
-	select VITESSE_PHY
-	select GPIOLIB
-	---help---
-	  This enables support for the Vitesse VSC7385, VSC7388,
-	  VSC7395 and VSC7398 SparX integrated ethernet switches.
+source "drivers/net/dsa/vitesse/Kconfig"
 
-config NET_DSA_VITESSE_VSC73XX_SPI
-	tristate "Vitesse VSC7385/7388/7395/7398 SPI mode support"
-	depends on OF
-	depends on NET_DSA
-	depends on SPI
-	select NET_DSA_VITESSE_VSC73XX
-	---help---
-	  This enables support for the Vitesse VSC7385, VSC7388, VSC7395
-	  and VSC7398 SparX integrated ethernet switches in SPI managed mode.
-
-config NET_DSA_VITESSE_VSC73XX_PLATFORM
-	tristate "Vitesse VSC7385/7388/7395/7398 Platform mode support"
-	depends on OF
-	depends on NET_DSA
-	depends on HAS_IOMEM
-	select NET_DSA_VITESSE_VSC73XX
-	---help---
-	  This enables support for the Vitesse VSC7385, VSC7388, VSC7395
-	  and VSC7398 SparX integrated ethernet switches, connected over
-	  a CPU-attached address bus and work in memory-mapped I/O mode.
 endmenu
drivers/net/dsa/Makefile +1 -3
index ae70b79628d6..158d34f8c085 100644
@@ -14,10 +14,8 @@ realtek-smi-objs		:= realtek-smi-core.o rtl8366.o rtl8366rb.o
 obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
 obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o
 obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o
-obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vitesse-vsc73xx-core.o
-obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vitesse-vsc73xx-platform.o
-obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vitesse-vsc73xx-spi.o
 obj-y				+= b53/
 obj-y				+= microchip/
 obj-y				+= mv88e6xxx/
 obj-y				+= sja1105/
+obj-y				+= vitesse/
drivers/net/dsa/vitesse/Kconfig new file +31 -0
new file mode 100644
index 000000000000..54be4b34fd17
@@ -0,0 +1,31 @@
+config NET_DSA_VITESSE_VSC73XX
+	tristate
+	depends on OF
+	depends on NET_DSA
+	select FIXED_PHY
+	select VITESSE_PHY
+	select GPIOLIB
+	---help---
+	  This enables support for the Vitesse VSC7385, VSC7388,
+	  VSC7395 and VSC7398 SparX integrated ethernet switches.
+
+config NET_DSA_VITESSE_VSC73XX_SPI
+	tristate "Vitesse VSC7385/7388/7395/7398 SPI mode support"
+	depends on OF
+	depends on NET_DSA
+	depends on SPI
+	select NET_DSA_VITESSE_VSC73XX
+	---help---
+	  This enables support for the Vitesse VSC7385, VSC7388, VSC7395
+	  and VSC7398 SparX integrated ethernet switches in SPI managed mode.
+
+config NET_DSA_VITESSE_VSC73XX_PLATFORM
+	tristate "Vitesse VSC7385/7388/7395/7398 Platform mode support"
+	depends on OF
+	depends on NET_DSA
+	depends on HAS_IOMEM
+	select NET_DSA_VITESSE_VSC73XX
+	---help---
+	  This enables support for the Vitesse VSC7385, VSC7388, VSC7395
+	  and VSC7398 SparX integrated ethernet switches, connected over
+	  a CPU-attached address bus and work in memory-mapped I/O mode.
drivers/net/dsa/vitesse/Makefile new file +3 -0
new file mode 100644
index 000000000000..adceeeec5d12
@@ -0,0 +1,3 @@
+obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vsc73xx-core.o
+obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vsc73xx-platform.o
+obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vsc73xx-spi.o
drivers/net/dsa/vitesse/vsc73xx-core.c renamed from drivers/net/dsa/vitesse-vsc73xx-core.c +1 -1
similarity index 99%
rename from drivers/net/dsa/vitesse-vsc73xx-core.c
rename to drivers/net/dsa/vitesse/vsc73xx-core.c
index 42c1574d45f2..d44dc5821938 100644
@@ -28,7 +28,7 @@
 #include <linux/random.h>
 #include <net/dsa.h>
 
-#include "vitesse-vsc73xx.h"
+#include "vsc73xx.h"
 
 #define VSC73XX_BLOCK_MAC	0x1 /* Subblocks 0-4, 6 (CPU port) */
 #define VSC73XX_BLOCK_ANALYZER	0x2 /* Only subblock 0 */
drivers/net/dsa/vitesse/vsc73xx-platform.c renamed from drivers/net/dsa/vitesse-vsc73xx-platform.c +1 -1
similarity index 99%
rename from drivers/net/dsa/vitesse-vsc73xx-platform.c
rename to drivers/net/dsa/vitesse/vsc73xx-platform.c
index 0541785f9fee..0ccf622aff96 100644
@@ -20,7 +20,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
-#include "vitesse-vsc73xx.h"
+#include "vsc73xx.h"
 
 #define VSC73XX_CMD_PLATFORM_BLOCK_SHIFT		14
 #define VSC73XX_CMD_PLATFORM_BLOCK_MASK			0x7
drivers/net/dsa/vitesse/vsc73xx-spi.c renamed from drivers/net/dsa/vitesse-vsc73xx-spi.c +1 -1
similarity index 99%
rename from drivers/net/dsa/vitesse-vsc73xx-spi.c
rename to drivers/net/dsa/vitesse/vsc73xx-spi.c
index e73c8fcddc9f..d75fcee0defb 100644
@@ -17,7 +17,7 @@
 #include <linux/of.h>
 #include <linux/spi/spi.h>
 
-#include "vitesse-vsc73xx.h"
+#include "vsc73xx.h"
 
 #define VSC73XX_CMD_SPI_MODE_READ		0
 #define VSC73XX_CMD_SPI_MODE_WRITE		1
drivers/net/dsa/vitesse/vsc73xx.h renamed from drivers/net/dsa/vitesse-vsc73xx.h +0 -0
similarity index 100%
rename from drivers/net/dsa/vitesse-vsc73xx.h
rename to drivers/net/dsa/vitesse/vsc73xx.h
Signature · 1 line
2.17.1
author maintainer
#48 lore raw

PATCH 11/12 net: dsa: vitesse: add basic Felix switch driver

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

This supports an Ethernet switching core from Vitesse / Microsemi / Microchip (VSC9959) that can be integrated on different SoCs as a PCIe endpoint device.

The functionality is provided by the core of the Ocelot switch driver (net/ethernet/mscc). In this regard, the current driver is an instance of Microsemi's Ocelot core driver, with a DSA front-end.

The patch adds the logic for probing a PCI device and defines the register map for the Felix switch core, since it has some differences in register addresses and bitfield mappings compared to the Ocelot switch.

Also some registers or bitfields present on Ocelot are not available on Felix. It is very possible that even other instantiations of the Felix core, on other SoC's, will have shuffled ("optimized") register maps as well, so this driver declares the register map as part of the "instance table" (currently the NXP LS1028A is the only instance). Other than that, the common registers and bitfields have the same functionality and share the same name.

In a few cases, some h/w operations have to be done differently on Felix due to missing bitfields. This is the case for the switch core reset and init. Because for this operation Ocelot uses some bits that are not present on Felix, the latter has to use a register from the global registers block (GCB) instead.

Although it is a PCI driver, it relies on DT bindings for compatibility with DSA (CPU port link, PHY library). It does not have any custom device tree bindings, since we would like to minimize its dependency on device tree though.

---
 MAINTAINERS                          |   7 +
 drivers/net/dsa/vitesse/Kconfig      |  12 +
 drivers/net/dsa/vitesse/Makefile     |   7 +
 drivers/net/dsa/vitesse/felix-regs.c | 647 +++++++++++++++++++++++++++
 drivers/net/dsa/vitesse/felix.c      | 359 +++++++++++++++
 drivers/net/dsa/vitesse/felix.h      |  36 ++
 6 files changed, 1068 insertions(+)
 create mode 100644 drivers/net/dsa/vitesse/felix-regs.c
 create mode 100644 drivers/net/dsa/vitesse/felix.c
 create mode 100644 drivers/net/dsa/vitesse/felix.h
MAINTAINERS +7 -0
index 3e57fc1d9962..486300903366 100644
@@ -17359,6 +17359,13 @@ S:	Maintained
 F:	drivers/input/serio/userio.c
 F:	include/uapi/linux/userio.h
 
+VITESSE FELIX ETHERNET SWITCH DRIVER
+M:	Vladimir Oltean <[email protected]>
+M:	Claudiu Manoil <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/net/dsa/vitesse/felix*
+
 VIVID VIRTUAL VIDEO DRIVER
 M:	Hans Verkuil <[email protected]>
 L:	[email protected]
drivers/net/dsa/vitesse/Kconfig +12 -0
index 54be4b34fd17..ca47c55f9733 100644
@@ -1,3 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config NET_DSA_VITESSE_FELIX
+	tristate "Felix Ethernet switch support"
+	depends on NET_DSA && PCI
+	select MSCC_OCELOT_SWITCH
+	help
+	  This driver supports the Felix (VSC9959) network switch, which is a
+	  variant of the Vitesse Ocelot switch core that is embedded as a PCIe
+	  function of the NXP LS1028A ENETC integrated endpoint. It reuses
+	  large portions of the Ocelot common driver core, while presenting the
+	  switch as a DSA device.
+
 config NET_DSA_VITESSE_VSC73XX
 	tristate
 	depends on OF
drivers/net/dsa/vitesse/Makefile +7 -0
index adceeeec5d12..f0c0581aa670 100644
@@ -1,3 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_NET_DSA_VITESSE_FELIX) += vsc_felix.o
+
+vsc_felix-objs := \
+	felix.o \
+	felix-regs.o
+
 obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX) += vsc73xx-core.o
 obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_PLATFORM) += vsc73xx-platform.o
 obj-$(CONFIG_NET_DSA_VITESSE_VSC73XX_SPI) += vsc73xx-spi.o
drivers/net/dsa/vitesse/felix-regs.c new file +647 -0

647 lines not on this page · raw message

drivers/net/dsa/vitesse/felix.c new file +359 -0

359 lines not on this page · raw message

drivers/net/dsa/vitesse/felix.h new file +36 -0
new file mode 100644
index 000000000000..05209e1c415d
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright 2019 NXP Semiconductors
+ */
+#ifndef _MSCC_FELIX_H
+#define _MSCC_FELIX_H
+
+#define ocelot_to_felix(o)		container_of((o), struct felix, ocelot)
+
+enum felix_instance {
+	FELIX_INSTANCE_LS1028A		= 0,
+};
+
+struct felix_info {
+	struct resource			*target_io_res;
+	struct resource			*port_io_res;
+	const u32 *const		*map;
+	const struct ocelot_ops		*ops;
+	int				shared_queue_sz;
+	const struct ocelot_stat_layout	*stats_layout;
+	unsigned int			num_stats;
+	int				num_ports;
+	int				pci_bar;
+};
+
+struct felix {
+	struct dsa_switch		*ds;
+	struct pci_dev			*pdev;
+	struct felix_info		*info;
+	struct ocelot			ocelot;
+};
+
+extern struct felix_info		felix_info_ls1028a;
+
+int felix_init_structs(struct felix *felix, int num_phys_ports);
+
+#endif
Signature · 1 line
2.17.1
author maintainer
#27 lore raw

PATCH 8/12 net: mscc: ocelot: publish structure definitions to include/soc/mscc/ocelot.h

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

We will be registering another switch driver based on ocelot, which lives under drivers/net/dsa.

Make sure the Felix DSA front-end has the necessary abstractions to implement a new Ocelot driver instantiation. This includes the function prototypes for implementing DSA callbacks.

---
 drivers/net/ethernet/mscc/ocelot.c |  79 ++--
 drivers/net/ethernet/mscc/ocelot.h | 482 +-------------------
 include/soc/mscc/ocelot.h          | 698 +++++++++++++++++++++++++++++
 3 files changed, 747 insertions(+), 512 deletions(-)
 create mode 100644 include/soc/mscc/ocelot.h
drivers/net/ethernet/mscc/ocelot.c +46 -33
index 0fe928026e61..96f8d2d82570 100644
@@ -21,7 +21,6 @@
 #include <net/netevent.h>
 #include <net/rtnetlink.h>
 #include <net/switchdev.h>
-#include <net/dsa.h>
 
 #include "ocelot.h"
 #include "ocelot_ace.h"
@@ -184,8 +183,8 @@ static void ocelot_vlan_mode(struct ocelot *ocelot, int port,
 	ocelot_write(ocelot, val, ANA_VLANMASK);
 }
 
-static void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
-				       bool vlan_aware)
+void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
+				bool vlan_aware)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	u32 val;
@@ -230,6 +229,7 @@ static void ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
 		       REW_TAG_CFG_TAG_CFG_M,
 		       REW_TAG_CFG, port);
 }
+EXPORT_SYMBOL(ocelot_port_vlan_filtering);
 
 static int ocelot_port_set_native_vlan(struct ocelot *ocelot, int port,
 				       u16 vid)
@@ -267,8 +267,8 @@ static void ocelot_port_set_pvid(struct ocelot *ocelot, int port, u16 pvid)
 	ocelot_port->pvid = pvid;
 }
 
-static int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
-			   bool untagged)
+int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
+		    bool untagged)
 {
 	int ret;
 
@@ -291,6 +291,7 @@ static int ocelot_vlan_add(struct ocelot *ocelot, int port, u16 vid, bool pvid,
 
 	return 0;
 }
+EXPORT_SYMBOL(ocelot_vlan_add);
 
 static int ocelot_vlan_vid_add(struct net_device *dev, u16 vid, bool pvid,
 			       bool untagged)
@@ -312,7 +313,7 @@ static int ocelot_vlan_vid_add(struct net_device *dev, u16 vid, bool pvid,
 	return 0;
 }
 
-static int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
+int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	int ret;
@@ -333,6 +334,7 @@ static int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
 
 	return 0;
 }
+EXPORT_SYMBOL(ocelot_vlan_del);
 
 static int ocelot_vlan_vid_del(struct net_device *dev, u16 vid)
 {
@@ -404,8 +406,8 @@ static u16 ocelot_wm_enc(u16 value)
 	return value;
 }
 
-static void ocelot_adjust_link(struct ocelot *ocelot, int port,
-			       struct phy_device *phydev)
+void ocelot_adjust_link(struct ocelot *ocelot, int port,
+			struct phy_device *phydev)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 	int speed, mode = 0;
@@ -471,6 +473,7 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 			 SYS_MAC_FC_CFG, port);
 	ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port);
 }
+EXPORT_SYMBOL(ocelot_adjust_link);
 
 static void ocelot_port_adjust_link(struct net_device *dev)
 {
@@ -481,8 +484,8 @@ static void ocelot_port_adjust_link(struct net_device *dev)
 	ocelot_adjust_link(ocelot, port, dev->phydev);
 }
 
-static void ocelot_port_enable(struct ocelot *ocelot, int port,
-			       struct phy_device *phy)
+void ocelot_port_enable(struct ocelot *ocelot, int port,
+			struct phy_device *phy)
 {
 	/* Enable receiving frames on the port, and activate auto-learning of
 	 * MAC addresses.
@@ -492,6 +495,7 @@ static void ocelot_port_enable(struct ocelot *ocelot, int port,
 			 ANA_PORT_PORT_CFG_PORTID_VAL(port),
 			 ANA_PORT_PORT_CFG, port);
 }
+EXPORT_SYMBOL(ocelot_port_enable);
 
 static int ocelot_port_open(struct net_device *dev)
 {
@@ -526,7 +530,7 @@ static int ocelot_port_open(struct net_device *dev)
 	return 0;
 }
 
-static void ocelot_port_disable(struct ocelot *ocelot, int port)
+void ocelot_port_disable(struct ocelot *ocelot, int port)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 
@@ -534,6 +538,7 @@ static void ocelot_port_disable(struct ocelot *ocelot, int port)
 	ocelot_rmw_rix(ocelot, 0, QSYS_SWITCH_PORT_MODE_PORT_ENA,
 		       QSYS_SWITCH_PORT_MODE, port);
 }
+EXPORT_SYMBOL(ocelot_port_disable);
 
 static int ocelot_port_stop(struct net_device *dev)
 {
@@ -790,9 +795,8 @@ static void ocelot_get_stats64(struct net_device *dev,
 	stats->collisions = ocelot_read(ocelot, SYS_COUNT_TX_COLLISION);
 }
 
-static int ocelot_fdb_add(struct ocelot *ocelot, int port,
-			  const unsigned char *addr, u16 vid,
-			  bool vlan_aware)
+int ocelot_fdb_add(struct ocelot *ocelot, int port,
+		   const unsigned char *addr, u16 vid, bool vlan_aware)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 
@@ -812,6 +816,7 @@ static int ocelot_fdb_add(struct ocelot *ocelot, int port,
 
 	return ocelot_mact_learn(ocelot, port, addr, vid, ENTRYTYPE_LOCKED);
 }
+EXPORT_SYMBOL(ocelot_fdb_add);
 
 static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 			       struct net_device *dev,
@@ -826,11 +831,12 @@ static int ocelot_port_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 	return ocelot_fdb_add(ocelot, port, addr, vid, priv->vlan_aware);
 }
 
-static int ocelot_fdb_del(struct ocelot *ocelot, int port,
-			  const unsigned char *addr, u16 vid)
+int ocelot_fdb_del(struct ocelot *ocelot, int port,
+		   const unsigned char *addr, u16 vid)
 {
 	return ocelot_mact_forget(ocelot, addr, vid);
 }
+EXPORT_SYMBOL(ocelot_fdb_del);
 
 static int ocelot_port_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
 			       struct net_device *dev,
@@ -940,8 +946,8 @@ static int ocelot_mact_read(struct ocelot *ocelot, int port, int row, int col,
 	return 0;
 }
 
-static int ocelot_fdb_dump(struct ocelot *ocelot, int port,
-			   dsa_fdb_dump_cb_t *cb, void *data)
+int ocelot_fdb_dump(struct ocelot *ocelot, int port,
+		    dsa_fdb_dump_cb_t *cb, void *data)
 {
 	int i, j;
 
@@ -973,6 +979,7 @@ static int ocelot_fdb_dump(struct ocelot *ocelot, int port,
 
 	return 0;
 }
+EXPORT_SYMBOL(ocelot_fdb_dump);
 
 static int ocelot_port_fdb_dump(struct sk_buff *skb,
 				struct netlink_callback *cb,
@@ -1153,8 +1160,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = {
 	.ndo_do_ioctl			= ocelot_ioctl,
 };
 
-static void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset,
-			       u8 *data)
+void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data)
 {
 	int i;
 
@@ -1165,6 +1171,7 @@ static void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset,
 		memcpy(data + i * ETH_GSTRING_LEN, ocelot->stats_layout[i].name,
 		       ETH_GSTRING_LEN);
 }
+EXPORT_SYMBOL(ocelot_get_strings);
 
 static void ocelot_port_get_strings(struct net_device *netdev, u32 sset,
 				    u8 *data)
@@ -1216,7 +1223,7 @@ static void ocelot_check_stats_work(struct work_struct *work)
 			   OCELOT_STATS_CHECK_DELAY);
 }
 
-static void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data)
+void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data)
 {
 	int i;
 
@@ -1227,6 +1234,7 @@ static void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data)
 	for (i = 0; i < ocelot->num_stats; i++)
 		*data++ = ocelot->stats[port * ocelot->num_stats + i];
 }
+EXPORT_SYMBOL(ocelot_get_ethtool_stats);
 
 static void ocelot_port_get_ethtool_stats(struct net_device *dev,
 					  struct ethtool_stats *stats,
@@ -1239,13 +1247,14 @@ static void ocelot_port_get_ethtool_stats(struct net_device *dev,
 	ocelot_get_ethtool_stats(ocelot, port, data);
 }
 
-static int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset)
+int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset)
 {
 	if (sset != ETH_SS_STATS)
 		return -EOPNOTSUPP;
 
 	return ocelot->num_stats;
 }
+EXPORT_SYMBOL(ocelot_get_sset_count);
 
 static int ocelot_port_get_sset_count(struct net_device *dev, int sset)
 {
@@ -1256,8 +1265,8 @@ static int ocelot_port_get_sset_count(struct net_device *dev, int sset)
 	return ocelot_get_sset_count(ocelot, port, sset);
 }
 
-static int ocelot_get_ts_info(struct ocelot *ocelot, int port,
-			      struct ethtool_ts_info *info)
+int ocelot_get_ts_info(struct ocelot *ocelot, int port,
+		       struct ethtool_ts_info *info)
 {
 	info->phc_index = ocelot->ptp_clock ?
 			  ptp_clock_index(ocelot->ptp_clock) : -1;
@@ -1273,6 +1282,7 @@ static int ocelot_get_ts_info(struct ocelot *ocelot, int port,
 
 	return 0;
 }
+EXPORT_SYMBOL(ocelot_get_ts_info);
 
 static int ocelot_port_get_ts_info(struct net_device *dev,
 				   struct ethtool_ts_info *info)
@@ -1296,8 +1306,7 @@ static const struct ethtool_ops ocelot_ethtool_ops = {
 	.get_ts_info		= ocelot_port_get_ts_info,
 };
 
-static void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port,
-					u8 state)
+void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state)
 {
 	u32 port_cfg;
 	int p, i;
@@ -1358,6 +1367,7 @@ static void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port,
 		}
 	}
 }
+EXPORT_SYMBOL(ocelot_bridge_stp_state_set);
 
 static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port,
 					   struct switchdev_trans *trans,
@@ -1369,11 +1379,12 @@ static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port,
 	ocelot_bridge_stp_state_set(ocelot, port, state);
 }
 
-static void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
+void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs)
 {
 	ocelot_write(ocelot, ANA_AUTOAGE_AGE_PERIOD(msecs / 2),
 		     ANA_AUTOAGE);
 }
+EXPORT_SYMBOL(ocelot_set_ageing_time);
 
 static void ocelot_port_attr_ageing_set(struct ocelot *ocelot, int port,
 					unsigned long ageing_clock_t)
@@ -1604,8 +1615,8 @@ static int ocelot_port_obj_del(struct net_device *dev,
 	return ret;
 }
 
-static int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
-				   struct net_device *bridge)
+int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
+			    struct net_device *bridge)
 {
 	if (!ocelot->bridge_mask) {
 		ocelot->hw_bridge_dev = bridge;
@@ -1620,9 +1631,10 @@ static int ocelot_port_bridge_join(struct ocelot *ocelot, int port,
 
 	return 0;
 }
+EXPORT_SYMBOL(ocelot_port_bridge_join);
 
-static int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
-				    struct net_device *bridge)
+int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
+			     struct net_device *bridge)
 {
 	ocelot->bridge_mask &= ~BIT(port);
 
@@ -1633,6 +1645,7 @@ static int ocelot_port_bridge_leave(struct ocelot *ocelot, int port,
 	ocelot_port_set_pvid(ocelot, port, 0);
 	return ocelot_port_set_native_vlan(ocelot, port, 0);
 }
+EXPORT_SYMBOL(ocelot_port_bridge_leave);
 
 static void ocelot_set_aggr_pgids(struct ocelot *ocelot)
 {
@@ -2119,7 +2132,7 @@ static void ocelot_port_set_mtu(struct ocelot *ocelot, int port, size_t mtu)
 	ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
 }
 
-static void ocelot_init_port(struct ocelot *ocelot, int port)
+void ocelot_init_port(struct ocelot *ocelot, int port)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
 
@@ -2166,6 +2179,7 @@ static void ocelot_init_port(struct ocelot *ocelot, int port)
 	/* Enable vcap lookups */
 	ocelot_vcap_enable(ocelot, port);
 }
+EXPORT_SYMBOL(ocelot_init_port);
 
 int ocelot_probe_port(struct ocelot *ocelot, u8 port,
 		      void __iomem *regs,
@@ -2211,7 +2225,6 @@ int ocelot_probe_port(struct ocelot *ocelot, u8 port,
 
 	return err;
 }
-EXPORT_SYMBOL(ocelot_probe_port);
 
 void ocelot_set_cpu_port(struct ocelot *ocelot, int cpu,
 			 enum ocelot_tag_prefix injection,
drivers/net/ethernet/mscc/ocelot.h +3 -479

517 lines not on this page · raw message

include/soc/mscc/ocelot.h new file +698 -0

698 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#49 lore raw

PATCH 12/12 net: dsa: vitesse: add tagger for Ocelot/Felix switches

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

While it is entirely possible that this tagger format is in fact more generic than just these 2 switch families, I don't have that knowledge. The Seville switch in NXP T1040 has a similar frame format, but there are enough differences (e.g. DEST field starts at bit 57 instead of 56) that calling this file tag_vitesse.c is a bit of a stretch at the moment. The frame format has been listed in a comment so that people who add support for further Vitesse switches can rework this tagger while keeping compatibility with Felix.

The "ocelot" name was chosen instead of "felix" because even the Ocelot switch can act as a DSA device when it is used in NPI mode, and the Felix tagger format is almost identical. Currently it is only used for the Felix switch embedded in the NXP LS1028A chip.

The ABI for this tagger should be considered "not stable" at the moment. The DSA tag is always placed before the Ethernet header and therefore, we are using the long prefix for RX tags to avoid putting the DSA master port in promiscuous mode. Once there will be an API in DSA for drivers to request DSA masters to be in promiscuous mode unconditionally, we will switch to the "no prefix" extraction frame header, which will save 16 padding bytes for each RX frame.

---
 MAINTAINERS                     |   1 +
 drivers/net/dsa/vitesse/Kconfig |   1 +
 drivers/net/dsa/vitesse/felix.c |  15 +--
 include/net/dsa.h               |   2 +
 net/dsa/Kconfig                 |   7 +
 net/dsa/Makefile                |   1 +
 net/dsa/tag_ocelot.c            | 229 ++++++++++++++++++++++++++++++++
 7 files changed, 248 insertions(+), 8 deletions(-)
 create mode 100644 net/dsa/tag_ocelot.c
MAINTAINERS +1 -0
index 486300903366..e86c4199a52f 100644
@@ -17365,6 +17365,7 @@ M:	Claudiu Manoil <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/net/dsa/vitesse/felix*
+F:	net/dsa/tag_ocelot.c
 
 VIVID VIRTUAL VIDEO DRIVER
 M:	Hans Verkuil <[email protected]>
drivers/net/dsa/vitesse/Kconfig +1 -0
index ca47c55f9733..e3b82a8db4b7 100644
@@ -3,6 +3,7 @@ config NET_DSA_VITESSE_FELIX
 	tristate "Felix Ethernet switch support"
 	depends on NET_DSA && PCI
 	select MSCC_OCELOT_SWITCH
+	select NET_DSA_TAG_OCELOT
 	help
 	  This driver supports the Felix (VSC9959) network switch, which is a
 	  variant of the Vitesse Ocelot switch core that is embedded as a PCIe
drivers/net/dsa/vitesse/felix.c +7 -8
index 0f433971335a..e2439e9a1a12 100644
@@ -12,7 +12,7 @@
 static enum dsa_tag_protocol felix_get_tag_protocol(struct dsa_switch *ds,
 						    int port)
 {
-	return DSA_TAG_PROTO_NONE;
+	return DSA_TAG_PROTO_OCELOT;
 }
 
 static int felix_set_ageing_time(struct dsa_switch *ds,
@@ -201,15 +201,14 @@ static int felix_setup(struct dsa_switch *ds)
 
 	ocelot_init(ocelot);
 
-	for (port = 0; port < ds->num_ports; port++)
+	for (port = 0; port < ds->num_ports; port++) {
 		ocelot_init_port(ocelot, port);
 
-	/* Set the CPU port as one of the non-NPI ports, so that the switch
-	 * is dumb for now and passes untagged traffic to/from the CPU.
-	 */
-	ocelot_set_cpu_port(ocelot, ds->num_ports,
-			    OCELOT_TAG_PREFIX_NONE,
-			    OCELOT_TAG_PREFIX_NONE);
+		if (port == dsa_upstream_port(ds, port))
+			ocelot_set_cpu_port(ocelot, port,
+					    OCELOT_TAG_PREFIX_NONE,
+					    OCELOT_TAG_PREFIX_LONG);
+	}
 
 	return 0;
 }
include/net/dsa.h +2 -0
index 9507611a41f0..6767dc3f66c0 100644
@@ -42,6 +42,7 @@ struct phylink_link_state;
 #define DSA_TAG_PROTO_8021Q_VALUE		12
 #define DSA_TAG_PROTO_SJA1105_VALUE		13
 #define DSA_TAG_PROTO_KSZ8795_VALUE		14
+#define DSA_TAG_PROTO_OCELOT_VALUE		15
 
 enum dsa_tag_protocol {
 	DSA_TAG_PROTO_NONE		= DSA_TAG_PROTO_NONE_VALUE,
@@ -59,6 +60,7 @@ enum dsa_tag_protocol {
 	DSA_TAG_PROTO_8021Q		= DSA_TAG_PROTO_8021Q_VALUE,
 	DSA_TAG_PROTO_SJA1105		= DSA_TAG_PROTO_SJA1105_VALUE,
 	DSA_TAG_PROTO_KSZ8795		= DSA_TAG_PROTO_KSZ8795_VALUE,
+	DSA_TAG_PROTO_OCELOT		= DSA_TAG_PROTO_OCELOT_VALUE,
 };
 
 struct packet_type;
net/dsa/Kconfig +7 -0
index 29e2bd5cc5af..fd9ef19a9581 100644
@@ -67,6 +67,13 @@ config NET_DSA_TAG_EDSA
 	  Say Y or M if you want to enable support for tagging frames for the
 	  Marvell switches which use EtherType DSA headers.
 
+config NET_DSA_TAG_OCELOT
+	tristate "Tag driver for Vitesse Ocelot/Felix switch"
+	select PACKING
+	help
+	  Say Y or M if you want to enable support for tagging frames with the
+	  Vitesse Ocelot (VSC7514) and Felix (VSC9959) switching cores.
+
 config NET_DSA_TAG_MTK
 	tristate "Tag driver for Mediatek switches"
 	help
net/dsa/Makefile +1 -0
index 2c6d286f0511..9a482c38bdb1 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_NET_DSA_TAG_GSWIP) += tag_gswip.o
 obj-$(CONFIG_NET_DSA_TAG_KSZ) += tag_ksz.o
 obj-$(CONFIG_NET_DSA_TAG_LAN9303) += tag_lan9303.o
 obj-$(CONFIG_NET_DSA_TAG_MTK) += tag_mtk.o
+obj-$(CONFIG_NET_DSA_TAG_OCELOT) += tag_ocelot.o
 obj-$(CONFIG_NET_DSA_TAG_QCA) += tag_qca.o
 obj-$(CONFIG_NET_DSA_TAG_SJA1105) += tag_sja1105.o
 obj-$(CONFIG_NET_DSA_TAG_TRAILER) += tag_trailer.o
net/dsa/tag_ocelot.c new file +229 -0

229 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#32 lore raw

PATCH 9/12 net: mscc: ocelot: publish ocelot_sys.h to include/soc/mscc

In reply to Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The Felix DSA driver needs to write to SYS_RAM_INIT_RAM_INIT for its own chip initialization process.

---
 drivers/net/ethernet/mscc/ocelot.h                      | 2 +-
 {drivers/net/ethernet => include/soc}/mscc/ocelot_sys.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename {drivers/net/ethernet => include/soc}/mscc/ocelot_sys.h (100%)
drivers/net/ethernet/mscc/ocelot.h +1 -1
index 325afea3e846..32fef4f495aa 100644
@@ -18,12 +18,12 @@
 #include <linux/ptp_clock_kernel.h>
 #include <linux/regmap.h>
 
+#include <soc/mscc/ocelot_sys.h>
 #include <soc/mscc/ocelot.h>
 #include "ocelot_ana.h"
 #include "ocelot_dev.h"
 #include "ocelot_qsys.h"
 #include "ocelot_rew.h"
-#include "ocelot_sys.h"
 #include "ocelot_qs.h"
 #include "ocelot_tc.h"
 #include "ocelot_ptp.h"
include/soc/mscc/ocelot_sys.h renamed from drivers/net/ethernet/mscc/ocelot_sys.h +0 -0
similarity index 100%
rename from drivers/net/ethernet/mscc/ocelot_sys.h
rename to include/soc/mscc/ocelot_sys.h
Signature · 1 line
2.17.1
#35 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Vladimir Oltean

Hi,

Quoted 7 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The vitesse/ folder will contain drivers for switching chips derived from legacy Vitesse IPs (VSC family), including those produced by Microsemi and Microchip (acquirers of Vitesse).

Quoted 17 lines
---
 drivers/net/dsa/Kconfig                       | 31 +------------------
 drivers/net/dsa/Makefile                      |  4 +--
 drivers/net/dsa/vitesse/Kconfig               | 31 +++++++++++++++++++
 drivers/net/dsa/vitesse/Makefile              |  3 ++
 .../vsc73xx-core.c}                           |  2 +-
 .../vsc73xx-platform.c}                       |  2 +-
 .../vsc73xx-spi.c}                            |  2 +-
 .../{vitesse-vsc73xx.h => vitesse/vsc73xx.h}  |  0
 8 files changed, 39 insertions(+), 36 deletions(-)
 create mode 100644 drivers/net/dsa/vitesse/Kconfig
 create mode 100644 drivers/net/dsa/vitesse/Makefile
 rename drivers/net/dsa/{vitesse-vsc73xx-core.c => vitesse/vsc73xx-core.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-platform.c => vitesse/vsc73xx-platform.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-spi.c => vitesse/vsc73xx-spi.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx.h => vitesse/vsc73xx.h} (100%)

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
maintainer Reviewed-by on v1 2/12
#3 lore raw

Re: [PATCH net-next 02/12] net: mscc: ocelot: filter out ocelot SoC specific PCS config from common path

In reply to Vladimir Oltean
Quoted 10 lines · Vladimir Oltean

From: Claudiu Manoil <[email protected]>

The adjust_link routine should be generic enough to be (re)used by any SoC that integrates a switch core compatible with the Ocelot core switch driver. Currently all configurations are generic except for the PCS settings that are SoC specific. Move these out to the Ocelot SoC/board instance.

Andrew

maintainer Reviewed-by on v1 3/12
#7 lore raw

Re: [PATCH net-next 03/12] net: mscc: ocelot: move invariant configs out of adjust_link

In reply to Vladimir Oltean
Quoted 8 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

It doesn't make sense to rewrite all these registers every time the PHY library notifies us about a link state change.

In a future patch we will customize the MTU for the CPU port, and since the MTU was previously configured from adjust_link, if we don't make this change, its value would have got overridden.

This is also a good change in preparation of PHYLINK. When you do that conversion, ocelot_adjust_link() is likely to become ocelot_mac_config(). It should only change hardware state when there actually is a change in link state. This is something drivers often get wrong.

Quoted 1 line

Andrew

Quoted 143 lines
---
 drivers/net/ethernet/mscc/ocelot.c | 85 +++++++++++++++---------------
 1 file changed, 43 insertions(+), 42 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +43 -42
index 2b6792ab0eda..4558c09e2e8a 100644
@@ -408,7 +408,7 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 			       struct phy_device *phydev)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
-	int speed, atop_wm, mode = 0;
+	int speed, mode = 0;
 
 	switch (phydev->speed) {
 	case SPEED_10:
@@ -440,32 +440,9 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 	ocelot_port_writel(ocelot_port, DEV_MAC_MODE_CFG_FDX_ENA |
 			   mode, DEV_MAC_MODE_CFG);
 
-	/* Set MAC IFG Gaps
-	 * FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 0
-	 * !FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 5
-	 */
-	ocelot_port_writel(ocelot_port, DEV_MAC_IFG_CFG_TX_IFG(5),
-			   DEV_MAC_IFG_CFG);
-
-	/* Load seed (0) and set MAC HDX late collision  */
-	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67) |
-			   DEV_MAC_HDX_CFG_SEED_LOAD,
-			   DEV_MAC_HDX_CFG);
-	mdelay(1);
-	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67),
-			   DEV_MAC_HDX_CFG);
-
 	if (ocelot->ops->pcs_init)
 		ocelot->ops->pcs_init(ocelot, port);
 
-	/* Set Max Length and maximum tags allowed */
-	ocelot_port_writel(ocelot_port, VLAN_ETH_FRAME_LEN,
-			   DEV_MAC_MAXLEN_CFG);
-	ocelot_port_writel(ocelot_port, DEV_MAC_TAGS_CFG_TAG_ID(ETH_P_8021AD) |
-			   DEV_MAC_TAGS_CFG_VLAN_AWR_ENA |
-			   DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA,
-			   DEV_MAC_TAGS_CFG);
-
 	/* Enable MAC module */
 	ocelot_port_writel(ocelot_port, DEV_MAC_ENA_CFG_RX_ENA |
 			   DEV_MAC_ENA_CFG_TX_ENA, DEV_MAC_ENA_CFG);
@@ -475,22 +452,10 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 	ocelot_port_writel(ocelot_port, DEV_CLOCK_CFG_LINK_SPEED(speed),
 			   DEV_CLOCK_CFG);
 
-	/* Set SMAC of Pause frame (00:00:00:00:00:00) */
-	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_HIGH_CFG);
-	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_LOW_CFG);
-
 	/* No PFC */
 	ocelot_write_gix(ocelot, ANA_PFC_PFC_CFG_FC_LINK_SPEED(speed),
 			 ANA_PFC_PFC_CFG, port);
 
-	/* Set Pause WM hysteresis
-	 * 152 = 6 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
-	 * 101 = 4 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
-	 */
-	ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
-			 SYS_PAUSE_CFG_PAUSE_STOP(101) |
-			 SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
-
 	/* Core: Enable port for frame transfer */
 	ocelot_write_rix(ocelot, QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE |
 			 QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG(1) |
@@ -505,12 +470,6 @@ static void ocelot_adjust_link(struct ocelot *ocelot, int port,
 			 SYS_MAC_FC_CFG_FC_LINK_SPEED(speed),
 			 SYS_MAC_FC_CFG, port);
 	ocelot_write_rix(ocelot, 0, ANA_POL_FLOWC, port);
-
-	/* Tail dropping watermark */
-	atop_wm = (ocelot->shared_queue_sz - 9 * VLAN_ETH_FRAME_LEN) / OCELOT_BUFFER_CELL_SZ;
-	ocelot_write_rix(ocelot, ocelot_wm_enc(9 * VLAN_ETH_FRAME_LEN),
-			 SYS_ATOP, port);
-	ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
 }
 
 static void ocelot_port_adjust_link(struct net_device *dev)
@@ -2141,11 +2100,53 @@ static int ocelot_init_timestamp(struct ocelot *ocelot)
 static void ocelot_init_port(struct ocelot *ocelot, int port)
 {
 	struct ocelot_port *ocelot_port = ocelot->ports[port];
+	int atop_wm;
 
 	INIT_LIST_HEAD(&ocelot_port->skbs);
 
 	/* Basic L2 initialization */
 
+	/* Set MAC IFG Gaps
+	 * FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 0
+	 * !FDX: TX_IFG = 5, RX_IFG1 = RX_IFG2 = 5
+	 */
+	ocelot_port_writel(ocelot_port, DEV_MAC_IFG_CFG_TX_IFG(5),
+			   DEV_MAC_IFG_CFG);
+
+	/* Load seed (0) and set MAC HDX late collision  */
+	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67) |
+			   DEV_MAC_HDX_CFG_SEED_LOAD,
+			   DEV_MAC_HDX_CFG);
+	mdelay(1);
+	ocelot_port_writel(ocelot_port, DEV_MAC_HDX_CFG_LATE_COL_POS(67),
+			   DEV_MAC_HDX_CFG);
+
+	/* Set Max Length and maximum tags allowed */
+	ocelot_port_writel(ocelot_port, VLAN_ETH_FRAME_LEN,
+			   DEV_MAC_MAXLEN_CFG);
+	ocelot_port_writel(ocelot_port, DEV_MAC_TAGS_CFG_TAG_ID(ETH_P_8021AD) |
+			   DEV_MAC_TAGS_CFG_VLAN_AWR_ENA |
+			   DEV_MAC_TAGS_CFG_VLAN_LEN_AWR_ENA,
+			   DEV_MAC_TAGS_CFG);
+
+	/* Set SMAC of Pause frame (00:00:00:00:00:00) */
+	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_HIGH_CFG);
+	ocelot_port_writel(ocelot_port, 0, DEV_MAC_FC_MAC_LOW_CFG);
+
+	/* Set Pause WM hysteresis
+	 * 152 = 6 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
+	 * 101 = 4 * VLAN_ETH_FRAME_LEN / OCELOT_BUFFER_CELL_SZ
+	 */
+	ocelot_write_rix(ocelot, SYS_PAUSE_CFG_PAUSE_ENA |
+			 SYS_PAUSE_CFG_PAUSE_STOP(101) |
+			 SYS_PAUSE_CFG_PAUSE_START(152), SYS_PAUSE_CFG, port);
+
+	/* Tail dropping watermark */
+	atop_wm = (ocelot->shared_queue_sz - 9 * VLAN_ETH_FRAME_LEN) / OCELOT_BUFFER_CELL_SZ;
+	ocelot_write_rix(ocelot, ocelot_wm_enc(9 * VLAN_ETH_FRAME_LEN),
+			 SYS_ATOP, port);
+	ocelot_write(ocelot, ocelot_wm_enc(atop_wm), SYS_ATOP_TOT_CFG);
+
 	/* Drop frames with multicast source address */
 	ocelot_rmw_gix(ocelot, ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,
 		       ANA_PORT_DROP_CFG_DROP_MC_SMAC_ENA,
Signature · 1 line
2.17.1
author maintainer
#8 lore raw

Re: [PATCH net-next 03/12] net: mscc: ocelot: move invariant configs out of adjust_link

Quoted 11 lines · Andrew Lunn
Quoted 8 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

It doesn't make sense to rewrite all these registers every time the PHY library notifies us about a link state change.

In a future patch we will customize the MTU for the CPU port, and since the MTU was previously configured from adjust_link, if we don't make this change, its value would have got overridden.

Quoted 6 lines

This is also a good change in preparation of PHYLINK. When you do that conversion, ocelot_adjust_link() is likely to become ocelot_mac_config(). It should only change hardware state when there actually is a change in link state. This is something drivers often get wrong.

Yes. We'll need PHYLINK because the CPU port is 2.5G fixed-link, which is something PHYLIB can't describe. One at a time, though.

Quoted 7 lines
Quoted 1 line

Andrew

[snip]

maintainer
#11 lore raw

Re: [PATCH net-next 04/12] net: mscc: ocelot: create a helper for changing the port MTU

In reply to Vladimir Oltean
Quoted 3 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

Since in an NPI/DSA setup, not all ports will have the same MTU

By this, do you mean that the CPU port needs a bigger MTU because of the extra header?

Andrew

author maintainer
#36 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Alexandre Belloni
Quoted 29 lines · Alexandre Belloni

Hi,

Quoted 7 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The vitesse/ folder will contain drivers for switching chips derived from legacy Vitesse IPs (VSC family), including those produced by Microsemi and Microchip (acquirers of Vitesse).

Quoted 17 lines
---
 drivers/net/dsa/Kconfig                       | 31 +------------------
 drivers/net/dsa/Makefile                      |  4 +--
 drivers/net/dsa/vitesse/Kconfig               | 31 +++++++++++++++++++
 drivers/net/dsa/vitesse/Makefile              |  3 ++
 .../vsc73xx-core.c}                           |  2 +-
 .../vsc73xx-platform.c}                       |  2 +-
 .../vsc73xx-spi.c}                            |  2 +-
 .../{vitesse-vsc73xx.h => vitesse/vsc73xx.h}  |  0
 8 files changed, 39 insertions(+), 36 deletions(-)
 create mode 100644 drivers/net/dsa/vitesse/Kconfig
 create mode 100644 drivers/net/dsa/vitesse/Makefile
 rename drivers/net/dsa/{vitesse-vsc73xx-core.c => vitesse/vsc73xx-core.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-platform.c => vitesse/vsc73xx-platform.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-spi.c => vitesse/vsc73xx-spi.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx.h => vitesse/vsc73xx.h} (100%)
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

Quoted 4 lines

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

author maintainer
#12 lore raw

Re: [PATCH net-next 04/12] net: mscc: ocelot: create a helper for changing the port MTU

In reply to Andrew Lunn
Quoted 8 lines · Andrew Lunn
Quoted 3 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

Since in an NPI/DSA setup, not all ports will have the same MTU

By this, do you mean that the CPU port needs a bigger MTU because of the extra header?

Yes, see the next patch.

Quoted 2 lines

Andrew

maintainer Reviewed-by on v1 5/12
#15 lore raw

Re: [PATCH net-next 05/12] net: mscc: ocelot: export a constant for the tag length in bytes

In reply to Vladimir Oltean

On Tue, Nov 12, 2019 at 02:44:13PM +0200, Vladimir Oltean wrote:
65;5800;1c> From: Vladimir Oltean <[email protected]>

Quoted 3 lines

This constant will be used in a future patch to increase the MTU on NPI ports, and will also be used in the tagger driver for Felix.

Another example of the next patch explaining the previous patch :-)

Maybe this indicates the 'why' is missing from the commit messages?

Andrew

maintainer Reviewed-by on v1 6/12
#18 lore raw

Re: [PATCH net-next 06/12] net: mscc: ocelot: adjust MTU on the CPU port in NPI mode

In reply to Vladimir Oltean
Quoted 6 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

When using the NPI port, the DSA tag is passed through Ethernet, so the switch's MAC needs to accept it as it comes from the DSA master. Increase the MTU on the external CPU port to account for the length of the injection header.

I think this is the only DSA driver which needs to do this. Generally, the port knows it is adding/removing the extra header, and so magically accepts bigger frames.

Where i have seen issues is the other end, the host interface. It sometimes drops 'full MTU' frames because the DSA header makes the frame too big.

Andrew

author maintainer
#19 lore raw

Re: [PATCH net-next 06/12] net: mscc: ocelot: adjust MTU on the CPU port in NPI mode

Quoted 9 lines · Andrew Lunn
Quoted 6 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

When using the NPI port, the DSA tag is passed through Ethernet, so the switch's MAC needs to accept it as it comes from the DSA master. Increase the MTU on the external CPU port to account for the length of the injection header.

Quoted 8 lines

I think this is the only DSA driver which needs to do this. Generally, the port knows it is adding/removing the extra header, and so magically accepts bigger frames.

Where i have seen issues is the other end, the host interface. It sometimes drops 'full MTU' frames because the DSA header makes the frame too big.

No, that worked out of the box because DSA adjusts the MTU of the master interface by the amount of bytes specified in the overhead of the tagger.

Quoted 3 lines

Andrew

maintainer Reviewed-by on v1 7/12
#23 lore raw

Re: [PATCH net-next 07/12] net: mscc: ocelot: separate the implementation of switch reset

In reply to Vladimir Oltean
Quoted 5 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The Felix switch has a different reset procedure, so a function pointer needs to be created and added to the ocelot_ops structure.

Quoted 7 lines

The reset procedure has been moved into ocelot_init.

---
 drivers/net/ethernet/mscc/ocelot.c       |  3 ++
 drivers/net/ethernet/mscc/ocelot.h       |  1 +
 drivers/net/ethernet/mscc/ocelot_board.c | 37 +++++++++++++++---------

I'm wondering about the name board. So far, the code you have moved into ocelot_board has nothing to do with the board as such. This is not a GPIO used to reset the switch, it is not a regulator, etc. It is all internal to the device, but just differs per family. Maybe you can think of a better name?

Andrew

maintainer
#20 lore raw

Re: [PATCH net-next 06/12] net: mscc: ocelot: adjust MTU on the CPU port in NPI mode

In reply to Vladimir Oltean
Quoted 14 lines · Vladimir Oltean
Quoted 13 lines · Andrew Lunn
Quoted 6 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

When using the NPI port, the DSA tag is passed through Ethernet, so the switch's MAC needs to accept it as it comes from the DSA master. Increase the MTU on the external CPU port to account for the length of the injection header.

I think this is the only DSA driver which needs to do this. Generally, the port knows it is adding/removing the extra header, and so magically accepts bigger frames.

Quoted 8 lines
Quoted 4 lines

Where i have seen issues is the other end, the host interface. It sometimes drops 'full MTU' frames because the DSA header makes the frame too big.

No, that worked out of the box because DSA adjusts the MTU of the master interface by the amount of bytes specified in the overhead of the tagger.

Yes, i added that code, after having to modify too many MAC drivers!

Andrew

author maintainer
#24 lore raw

Re: [PATCH net-next 07/12] net: mscc: ocelot: separate the implementation of switch reset

In reply to Andrew Lunn
Quoted 15 lines · Andrew Lunn
Quoted 5 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The Felix switch has a different reset procedure, so a function pointer needs to be created and added to the ocelot_ops structure.

Quoted 7 lines

The reset procedure has been moved into ocelot_init.

---
 drivers/net/ethernet/mscc/ocelot.c       |  3 ++
 drivers/net/ethernet/mscc/ocelot.h       |  1 +
 drivers/net/ethernet/mscc/ocelot_board.c | 37 +++++++++++++++---------
Quoted 6 lines

I'm wondering about the name board. So far, the code you have moved into ocelot_board has nothing to do with the board as such. This is not a GPIO used to reset the switch, it is not a regulator, etc. It is all internal to the device, but just differs per family. Maybe you can think of a better name?

Alexandre, what do you think? I agree "ocelot_board" is a bit strange.

Quoted 3 lines

Andrew

#37 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Vladimir Oltean
Quoted 39 lines · Vladimir Oltean

External E-Mail

Quoted 29 lines · Alexandre Belloni

Hi,

Quoted 7 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The vitesse/ folder will contain drivers for switching chips derived from legacy Vitesse IPs (VSC family), including those produced by Microsemi and Microchip (acquirers of Vitesse).

Quoted 17 lines
---
 drivers/net/dsa/Kconfig                       | 31 +------------------
 drivers/net/dsa/Makefile                      |  4 +--
 drivers/net/dsa/vitesse/Kconfig               | 31 +++++++++++++++++++
 drivers/net/dsa/vitesse/Makefile              |  3 ++
 .../vsc73xx-core.c}                           |  2 +-
 .../vsc73xx-platform.c}                       |  2 +-
 .../vsc73xx-spi.c}                            |  2 +-
 .../{vitesse-vsc73xx.h => vitesse/vsc73xx.h}  |  0
 8 files changed, 39 insertions(+), 36 deletions(-)
 create mode 100644 drivers/net/dsa/vitesse/Kconfig
 create mode 100644 drivers/net/dsa/vitesse/Makefile
 rename drivers/net/dsa/{vitesse-vsc73xx-core.c => vitesse/vsc73xx-core.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-platform.c => vitesse/vsc73xx-platform.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx-spi.c => vitesse/vsc73xx-spi.c} (99%)
 rename drivers/net/dsa/{vitesse-vsc73xx.h => vitesse/vsc73xx.h} (100%)
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

Quoted 5 lines

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

/Allan

maintainer
#28 lore raw

Re: [PATCH net-next 08/12] net: mscc: ocelot: publish structure definitions to include/soc/mscc/ocelot.h

In reply to Vladimir Oltean
Quoted 1 line
include/soc/mscc/ocelot.h +0 -0

..

include/soc/mscc/ocelot.h line 547

Quoted 7 lines
include/soc/mscc/ocelot.h +7 -0
+#else
+
+/* I/O */
+u32 ocelot_port_readl(struct ocelot_port *port, u32 reg)
+{
+	return 0;
+}

These stubs are for when the core is missing? I don't think that makes sense. What use is a DSA or switchdev driver without the core? I would put in a hard dependency in the Kconfig, so the DSA driver can only be built when the core is available, and skip these stubs.

Andrew

maintainer
#38 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Allan W. Nielsen
Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Quoted 2 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

Andrew

#39 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

Quoted 18 lines · Andrew Lunn

External E-Mail

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Quoted 7 lines
Quoted 2 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

Ahh, my bad.

In that case I do not have any strong feelings on this either.

I should say that we are discussing to add support for a Ocelot VSC7511 as a DSA driver. This one does not have an internal MIPS CPU.

The vsc73xx, felix and the drivers in dsa/microchip does not share any functionallity. Not in SW and not in HW.

Maybe felix should just go directly into drivers/net/dsa/, and then if we add support for VSC7511 then they can both live in drivers/net/dsa/ocelot/

/Allan

author maintainer
#40 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

Quoted 34 lines · Allan W. Nielsen
Quoted 18 lines · Andrew Lunn

External E-Mail

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Quoted 7 lines
Quoted 2 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

Ahh, my bad.

In that case I do not have any strong feelings on this either.

I should say that we are discussing to add support for a Ocelot VSC7511 as a DSA driver. This one does not have an internal MIPS CPU.

Quoted 7 lines

The vsc73xx, felix and the drivers in dsa/microchip does not share any functionallity. Not in SW and not in HW.

Maybe felix should just go directly into drivers/net/dsa/, and then if we add support for VSC7511 then they can both live in drivers/net/dsa/ocelot/

/Allan

When the felix driver is going to support the vsc7511 ocelot switch through the ocelot core, it will be naming chaos. Maybe we need to clarify what "felix" means (at the moment it means VSC9959). What if we just make it mean "DSA driver for Ocelot", and it supports both the VSC751x (Ocelot) and the VSC9959 (Felix) families? Is anybody else instantiating the VSC9959 core, or close derivatives, except NXP LS1028A? If the answer is yes, are those other instantiations PCI devices, or something else? I would appreciate if you could take a look through the probing part of patch 11/12 (the "felix_instance_tbl" part and felix-regs.c) and see if there are any naming changes I can make that would make it easier for you to fit in one more device. Of course, I don't expect to make radical changes, you'd still need to do some refactoring if you decide to add your vsc7511, I just care that the refactoring doesn't change any current semantics.

Regards,
-Vladimir

author maintainer
#29 lore raw

Re: [PATCH net-next 08/12] net: mscc: ocelot: publish structure definitions to include/soc/mscc/ocelot.h

In reply to Andrew Lunn
Quoted 18 lines · Andrew Lunn
Quoted 2 lines
include/soc/mscc/ocelot.h +0 -0

..

include/soc/mscc/ocelot.h line 547

Quoted 7 lines
include/soc/mscc/ocelot.h +7 -0
+#else
+
+/* I/O */
+u32 ocelot_port_readl(struct ocelot_port *port, u32 reg)
+{
+     return 0;
+}

These stubs are for when the core is missing? I don't think that makes sense. What use is a DSA or switchdev driver without the core? I would put in a hard dependency in the Kconfig, so the DSA driver can only be built when the core is available, and skip these stubs.

Quoted 1 line

Andrew

Yes it doesn't make too much sense, I was on the fence about adding it and then just decided to play on the safe side. I'll remove it.

#41 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Vladimir Oltean
Quoted 44 lines · Vladimir Oltean

External E-Mail

Quoted 39 lines · Allan W. Nielsen
Quoted 18 lines · Andrew Lunn

External E-Mail

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Quoted 7 lines
Quoted 2 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

Ahh, my bad.

In that case I do not have any strong feelings on this either.

I should say that we are discussing to add support for a Ocelot VSC7511 as a DSA driver. This one does not have an internal MIPS CPU.

The vsc73xx, felix and the drivers in dsa/microchip does not share any functionallity. Not in SW and not in HW.

Maybe felix should just go directly into drivers/net/dsa/, and then if we add support for VSC7511 then they can both live in drivers/net/dsa/ocelot/

A bit of background such that people outside NXP/MCHP has a better change to follow and add to the discussion.

Ocelot is a family name covering 4 VSC parts (VSC7511-14), and a IP used by NXP (VSC9959).

VSC7511-14 are all register compatible, it uses the same serdes etc.

VSC7511/12 are "unmanaged" meaning that they do not have an embedded CPU.

VSC7513/14 has an embedded MIPS CPU.

VSC9959 not the same core as VSC7511-14, it is a newer generation with more features, it is not register compatible, but all the basic functionallity is very similar VSC7511-14 which is why it can call into the drivers/net/ethernet/mscc/ocelot.c file.

It is likely that NXP want to add more features in felix/VSC9959 which does not exists in VSC7511-14.

Quoted 2 lines

When the felix driver is going to support the vsc7511 ocelot switch through the ocelot core, it will be naming chaos.

I do not think a VSC7511 will be based on Felix, but it will relay on the refacturing/restructuring you have done in Ocelot.

VSC7511 will use the same PCS and serdes settings as Ocelot (VSC7513/VSC7514)

Quoted 1 line

Maybe we need to clarify what "felix" means (at the moment it means VSC9959).

Yes.

Quoted 2 lines

What if we just make it mean "DSA driver for Ocelot", and it supports both the VSC751x (Ocelot) and the VSC9959 (Felix) families?

I'm not too keen on using the felix name for that.

Here is my suggestion:

Drop the felix name and put it in drivers/net/dsa/ocelot_vsc9959* (this would be my preference)

Or if you want the felix name put it in drivers/net/dsa/ocelot_felix*

Or if we want folders put it in drivers/net/dsa/ocelot/vsc9959*

When we get to it, we can add vsc7511/12 in drivers/net/dsa/ocelot_vsc7512*

To be consisten and clean up (my) earlier mistake we should rename the drivers/net/ethernet/mscc/ocelot_board.c to drivers/net/ethernet/mscc/ocelot_vsc7514.c (as it is really not board stuff, but ocelot internal cpu stuff).

Andrew also pointed out that the stuff put into this file did not seem very board related.

Quoted 3 lines

Is anybody else instantiating the VSC9959 core, or close derivatives, except NXP LS1028A? If the answer is yes, are those other instantiations PCI devices, or something else?

Not what I'm aware of.

Quoted 4 lines

I would appreciate if you could take a
look through the probing part of patch 11/12 (the "felix_instance_tbl" part and felix-regs.c) and see if there are any naming changes I can make that would make it easier for you to fit in one more device.

Will do.

Quoted 3 lines

Of course, I don't expect to make radical changes, you'd still need to do some refactoring if you decide to add your vsc7511, I just care that the refactoring doesn't change any current semantics.

The majority of the needed changes to add vsc7511 has been done by now ;-)

/Allan

author maintainer
#42 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

Quoted 78 lines · Allan W. Nielsen
Quoted 44 lines · Vladimir Oltean

External E-Mail

Quoted 39 lines · Allan W. Nielsen
Quoted 18 lines · Andrew Lunn

External E-Mail

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Quoted 7 lines
Quoted 2 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

Ahh, my bad.

In that case I do not have any strong feelings on this either.

I should say that we are discussing to add support for a Ocelot VSC7511 as a DSA driver. This one does not have an internal MIPS CPU.

The vsc73xx, felix and the drivers in dsa/microchip does not share any functionallity. Not in SW and not in HW.

Maybe felix should just go directly into drivers/net/dsa/, and then if we add support for VSC7511 then they can both live in drivers/net/dsa/ocelot/

A bit of background such that people outside NXP/MCHP has a better change to follow and add to the discussion.

Ocelot is a family name covering 4 VSC parts (VSC7511-14), and a IP used by NXP (VSC9959).

VSC7511-14 are all register compatible, it uses the same serdes etc.

VSC7511/12 are "unmanaged" meaning that they do not have an embedded CPU.

VSC7513/14 has an embedded MIPS CPU.

VSC9959 not the same core as VSC7511-14, it is a newer generation with more features, it is not register compatible, but all the basic functionallity is very similar VSC7511-14 which is why it can call into the drivers/net/ethernet/mscc/ocelot.c file.

It is likely that NXP want to add more features in felix/VSC9959 which does not exists in VSC7511-14.

Quoted 2 lines

When the felix driver is going to support the vsc7511 ocelot switch through the ocelot core, it will be naming chaos.

I do not think a VSC7511 will be based on Felix, but it will relay on the refacturing/restructuring you have done in Ocelot.

VSC7511 will use the same PCS and serdes settings as Ocelot (VSC7513/VSC7514)

Quoted 1 line

Maybe we need to clarify what "felix" means (at the moment it means VSC9959).

Yes.

Quoted 9 lines
Quoted 2 lines

What if we just make it mean "DSA driver for Ocelot", and it supports both the VSC751x (Ocelot) and the VSC9959 (Felix) families?

I'm not too keen on using the felix name for that.

Here is my suggestion:

Drop the felix name and put it in drivers/net/dsa/ocelot_vsc9959* (this would be my preference)

This has one big issue: the name is very long! I can't see myself prefixing all function and structure names with ocelot_vsc9959_*. Felix is just 5 letters. And I can't use "ocelot" either, since that is taken :)
So the DSA driver needs its own (short) name.

Quoted 4 lines

Or if you want the felix name put it in drivers/net/dsa/ocelot_felix*

Or if we want folders put it in drivers/net/dsa/ocelot/vsc9959*

The way I see an Ocelot DSA driver, it would be done a la mv88e6xxx, aka a single struct dsa_switch_ops registered for the entire family, and function pointers where the implementation differs. You're not proposing that here, but rather that each switch driver works in parallel with each other, and they all call into the Ocelot core. That would produce a lot more boilerplate, I think.
And if the DSA driver for Ocelot ends up supporting more than 1 device, its name should better not contain "vsc9959" since that's rather specific.

Quoted 7 lines

When we get to it, we can add vsc7511/12 in drivers/net/dsa/ocelot_vsc7512*

To be consisten and clean up (my) earlier mistake we should rename the drivers/net/ethernet/mscc/ocelot_board.c to drivers/net/ethernet/mscc/ocelot_vsc7514.c (as it is really not board stuff, but ocelot internal cpu stuff).

Quoted 8 lines

Andrew also pointed out that the stuff put into this file did not seem very board related.

Quoted 3 lines

Is anybody else instantiating the VSC9959 core, or close derivatives, except NXP LS1028A? If the answer is yes, are those other instantiations PCI devices, or something else?

Not what I'm aware of.

Ok, this is good to know.

Quoted 13 lines
Quoted 4 lines

I would appreciate if you could take a
look through the probing part of patch 11/12 (the "felix_instance_tbl" part and felix-regs.c) and see if there are any naming changes I can make that would make it easier for you to fit in one more device.

Will do.

Quoted 3 lines

Of course, I don't expect to make radical changes, you'd still need to do some refactoring if you decide to add your vsc7511, I just care that the refactoring doesn't change any current semantics.

The majority of the needed changes to add vsc7511 has been done by now ;-)

/Allan

#43 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

Quoted 93 lines · Vladimir Oltean

External E-Mail

Quoted 78 lines · Allan W. Nielsen
Quoted 44 lines · Vladimir Oltean

External E-Mail

Quoted 39 lines · Allan W. Nielsen
Quoted 18 lines · Andrew Lunn

External E-Mail

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Quoted 7 lines
Quoted 2 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

Ahh, my bad.

In that case I do not have any strong feelings on this either.

I should say that we are discussing to add support for a Ocelot VSC7511 as a DSA driver. This one does not have an internal MIPS CPU.

The vsc73xx, felix and the drivers in dsa/microchip does not share any functionallity. Not in SW and not in HW.

Maybe felix should just go directly into drivers/net/dsa/, and then if we add support for VSC7511 then they can both live in drivers/net/dsa/ocelot/

A bit of background such that people outside NXP/MCHP has a better change to follow and add to the discussion.

Ocelot is a family name covering 4 VSC parts (VSC7511-14), and a IP used by NXP (VSC9959).

VSC7511-14 are all register compatible, it uses the same serdes etc.

VSC7511/12 are "unmanaged" meaning that they do not have an embedded CPU.

VSC7513/14 has an embedded MIPS CPU.

VSC9959 not the same core as VSC7511-14, it is a newer generation with more features, it is not register compatible, but all the basic functionallity is very similar VSC7511-14 which is why it can call into the drivers/net/ethernet/mscc/ocelot.c file.

It is likely that NXP want to add more features in felix/VSC9959 which does not exists in VSC7511-14.

Quoted 2 lines

When the felix driver is going to support the vsc7511 ocelot switch through the ocelot core, it will be naming chaos.

I do not think a VSC7511 will be based on Felix, but it will relay on the refacturing/restructuring you have done in Ocelot.

VSC7511 will use the same PCS and serdes settings as Ocelot (VSC7513/VSC7514)

Quoted 1 line

Maybe we need to clarify what "felix" means (at the moment it means VSC9959).

Yes.

Quoted 9 lines
Quoted 2 lines

What if we just make it mean "DSA driver for Ocelot", and it supports both the VSC751x (Ocelot) and the VSC9959 (Felix) families?

I'm not too keen on using the felix name for that.

Here is my suggestion:

Drop the felix name and put it in drivers/net/dsa/ocelot_vsc9959* (this would be my preference)

Quoted 5 lines

This has one big issue: the name is very long! I can't see myself prefixing all function and structure names with ocelot_vsc9959_*. Felix is just 5 letters. And I can't use "ocelot" either, since that is taken :)
So the DSA driver needs its own (short) name.

I certainly agree that ocelot_vsc9959_* is too long a prefix.

If you put it in drivers/net/dsa/ocelot_felix* or drivers/net/dsa/ocelot/felix* then you can prefix with 'felix_'.

If you put it in drivers/net/dsa/ocelot_vsc9959* or drivers/net/dsa/ocelot/vsc9959* then you can prefix with 'vsc9959_'.

The one thing all of this parts has in common is that they are all based on the Ocelot family, which is why I suggest to include this into the path. It will provide more information than putting it in the vitesse/microchip folders.

Quoted 5 lines
Quoted 4 lines

Or if you want the felix name put it in drivers/net/dsa/ocelot_felix*

Or if we want folders put it in drivers/net/dsa/ocelot/vsc9959*

Quoted 9 lines

The way I see an Ocelot DSA driver, it would be done a la mv88e6xxx, aka a single struct dsa_switch_ops registered for the entire family, and function pointers where the implementation differs. You're not proposing that here, but rather that each switch driver works in parallel with each other, and they all call into the Ocelot core. That would produce a lot more boilerplate, I think.
And if the DSA driver for Ocelot ends up supporting more than 1 device, its name should better not contain "vsc9959" since that's rather specific.

A vsc7511/12 will not share code with felix/vsc9959. I do not expect any other IP/chip will be register compatible with vsc9959.

A vsc7511/12 will use the ocelot DSA tagger, but other from that it will call into the ocelot driver (I think).

But to be honest, I do not think we should spend too much energy on vsc7511/12 now. When/if it comes, we will see how it fit best.

/Allan

author maintainer
#44 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

Quoted 126 lines · Allan W. Nielsen
Quoted 93 lines · Vladimir Oltean

External E-Mail

Quoted 78 lines · Allan W. Nielsen
Quoted 44 lines · Vladimir Oltean

External E-Mail

Quoted 39 lines · Allan W. Nielsen
Quoted 18 lines · Andrew Lunn

External E-Mail

Quoted 11 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Quoted 7 lines
Quoted 2 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

Ahh, my bad.

In that case I do not have any strong feelings on this either.

I should say that we are discussing to add support for a Ocelot VSC7511 as a DSA driver. This one does not have an internal MIPS CPU.

The vsc73xx, felix and the drivers in dsa/microchip does not share any functionallity. Not in SW and not in HW.

Maybe felix should just go directly into drivers/net/dsa/, and then if we add support for VSC7511 then they can both live in drivers/net/dsa/ocelot/

A bit of background such that people outside NXP/MCHP has a better change to follow and add to the discussion.

Ocelot is a family name covering 4 VSC parts (VSC7511-14), and a IP used by NXP (VSC9959).

VSC7511-14 are all register compatible, it uses the same serdes etc.

VSC7511/12 are "unmanaged" meaning that they do not have an embedded CPU.

VSC7513/14 has an embedded MIPS CPU.

VSC9959 not the same core as VSC7511-14, it is a newer generation with more features, it is not register compatible, but all the basic functionallity is very similar VSC7511-14 which is why it can call into the drivers/net/ethernet/mscc/ocelot.c file.

It is likely that NXP want to add more features in felix/VSC9959 which does not exists in VSC7511-14.

Quoted 2 lines

When the felix driver is going to support the vsc7511 ocelot switch through the ocelot core, it will be naming chaos.

I do not think a VSC7511 will be based on Felix, but it will relay on the refacturing/restructuring you have done in Ocelot.

VSC7511 will use the same PCS and serdes settings as Ocelot (VSC7513/VSC7514)

Quoted 1 line

Maybe we need to clarify what "felix" means (at the moment it means VSC9959).

Yes.

Quoted 9 lines
Quoted 2 lines

What if we just make it mean "DSA driver for Ocelot", and it supports both the VSC751x (Ocelot) and the VSC9959 (Felix) families?

I'm not too keen on using the felix name for that.

Here is my suggestion:

Drop the felix name and put it in drivers/net/dsa/ocelot_vsc9959* (this would be my preference)

Quoted 5 lines

This has one big issue: the name is very long! I can't see myself prefixing all function and structure names with ocelot_vsc9959_*. Felix is just 5 letters. And I can't use "ocelot" either, since that is taken :)
So the DSA driver needs its own (short) name.

I certainly agree that ocelot_vsc9959_* is too long a prefix.

If you put it in drivers/net/dsa/ocelot_felix* or drivers/net/dsa/ocelot/felix* then you can prefix with 'felix_'.

If you put it in drivers/net/dsa/ocelot_vsc9959* or drivers/net/dsa/ocelot/vsc9959* then you can prefix with 'vsc9959_'.

The one thing all of this parts has in common is that they are all based on the Ocelot family, which is why I suggest to include this into the path. It will provide more information than putting it in the vitesse/microchip folders.

Quoted 5 lines
Quoted 4 lines

Or if you want the felix name put it in drivers/net/dsa/ocelot_felix*

Or if we want folders put it in drivers/net/dsa/ocelot/vsc9959*

Quoted 9 lines

The way I see an Ocelot DSA driver, it would be done a la mv88e6xxx, aka a single struct dsa_switch_ops registered for the entire family, and function pointers where the implementation differs. You're not proposing that here, but rather that each switch driver works in parallel with each other, and they all call into the Ocelot core. That would produce a lot more boilerplate, I think.
And if the DSA driver for Ocelot ends up supporting more than 1 device, its name should better not contain "vsc9959" since that's rather specific.

Quoted 3 lines

A vsc7511/12 will not share code with felix/vsc9959. I do not expect any other IP/chip will be register compatible with vsc9959.

I don't exactly understand this comment. Register-incompatible in a logical sense, or in a layout sense? Judging from the attachment in chapter 6 of the VSC7511 datasheet [1], at least the basic functionality appears to be almost the same. And for the rest, there's regmap magic.

Quoted 7 lines

A vsc7511/12 will use the ocelot DSA tagger, but other from that it will call into the ocelot driver (I think).

But to be honest, I do not think we should spend too much energy on vsc7511/12 now. When/if it comes, we will see how it fit best.

/Allan

Ok. So the driver will still be called "felix", it will instantiate a struct felix_info_vsc9959 instead of the current felix_info_ls1028a, but will live in the root drivers/net/dsa folder. Then, when/if you add support for vsc7511, you'll move both into an "ocelot" folder and figure out how much of the driver minus the tagger is worth reusing (aka instantiate a struct felix_info_vsc7511). Agree?

[1]: http://ww1.microchip.com/downloads/en/DeviceDoc/VMDS-10488.pdf

-Vladimir

Reviewed-by on v1 2/12
#4 lore raw

Re: [PATCH net-next 02/12] net: mscc: ocelot: filter out ocelot SoC specific PCS config from common path

In reply to Vladimir Oltean
Quoted 10 lines · Vladimir Oltean

From: Claudiu Manoil <[email protected]>

The adjust_link routine should be generic enough to be (re)used by any SoC that integrates a switch core compatible with the Ocelot core switch driver. Currently all configurations are generic except for the PCS settings that are SoC specific. Move these out to the Ocelot SoC/board instance.

Signature · 1 line
Florian
Reviewed-by on v1 3/12
#9 lore raw

Re: [PATCH net-next 03/12] net: mscc: ocelot: move invariant configs out of adjust_link

In reply to Vladimir Oltean
Quoted 10 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

It doesn't make sense to rewrite all these registers every time the PHY library notifies us about a link state change.

In a future patch we will customize the MTU for the CPU port, and since the MTU was previously configured from adjust_link, if we don't make this change, its value would have got overridden.

Signature · 1 line
Florian
Reviewed-by on v1 4/12
#13 lore raw

Re: [PATCH net-next 04/12] net: mscc: ocelot: create a helper for changing the port MTU

In reply to Vladimir Oltean
Quoted 7 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

Since in an NPI/DSA setup, not all ports will have the same MTU, we need to make sure the watermarks for pause frames and/or tail dropping logic that existed in the driver is still coherent for the new MTU values.

Signature · 1 line
Florian
Reviewed-by on v1 5/12
#16 lore raw

Re: [PATCH net-next 05/12] net: mscc: ocelot: export a constant for the tag length in bytes

In reply to Vladimir Oltean
Quoted 6 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

This constant will be used in a future patch to increase the MTU on NPI ports, and will also be used in the tagger driver for Felix.

Signature · 1 line
Florian
Reviewed-by on v1 6/12
#21 lore raw

Re: [PATCH net-next 06/12] net: mscc: ocelot: adjust MTU on the CPU port in NPI mode

In reply to Vladimir Oltean
Quoted 8 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

When using the NPI port, the DSA tag is passed through Ethernet, so the switch's MAC needs to accept it as it comes from the DSA master. Increase the MTU on the external CPU port to account for the length of the injection header.

Signature · 1 line
Florian
#26 lore raw

Re: [PATCH net-next 07/12] net: mscc: ocelot: separate the implementation of switch reset

In reply to Vladimir Oltean
Quoted 19 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The Felix switch has a different reset procedure, so a function pointer needs to be created and added to the ocelot_ops structure.

The reset procedure has been moved into ocelot_init.

---
 drivers/net/ethernet/mscc/ocelot.c       |  3 ++
 drivers/net/ethernet/mscc/ocelot.h       |  1 +
 drivers/net/ethernet/mscc/ocelot_board.c | 37 +++++++++++++++---------
 3 files changed, 28 insertions(+), 13 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +0 -0
index 42da193a8240..0fe928026e61 100644

drivers/net/ethernet/mscc/ocelot.c int ocelot_init(struct ocelot *ocelot) · line 2298

Quoted 5 lines
drivers/net/ethernet/mscc/ocelot.c +2 -0
@@ -2294,6 +2294,9 @@ int ocelot_init(struct ocelot *ocelot)
 	ocelot_vlan_init(ocelot);
 	ocelot_ace_init(ocelot);
 
+	if (ocelot->ops->reset)
+		ocelot->ops->reset(ocelot);

We were not checking doing any error code checking, but arguably we know should, any reason not to propagate the error code?

Signature · 1 line
Florian
Reviewed-by on v1 8/12
#30 lore raw

Re: [PATCH net-next 08/12] net: mscc: ocelot: publish structure definitions to include/soc/mscc/ocelot.h

In reply to Vladimir Oltean
Quoted 10 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

We will be registering another switch driver based on ocelot, which lives under drivers/net/dsa.

Make sure the Felix DSA front-end has the necessary abstractions to implement a new Ocelot driver instantiation. This includes the function prototypes for implementing DSA callbacks.

Signature · 1 line
Florian
#33 lore raw

Re: [PATCH net-next 09/12] net: mscc: ocelot: publish ocelot_sys.h to include/soc/mscc

In reply to Vladimir Oltean
Quoted 11 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The Felix DSA driver needs to write to SYS_RAM_INIT_RAM_INIT for its own chip initialization process.

---
 drivers/net/ethernet/mscc/ocelot.h                      | 2 +-
 {drivers/net/ethernet => include/soc}/mscc/ocelot_sys.h | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename {drivers/net/ethernet => include/soc}/mscc/ocelot_sys.h (100%)

This was not done before for include/soc/mscc/ocelot_hsio.h but you need an update to the MAINTAINERS file to catch that file now:

$ ./scripts/get_maintainer.pl -f include/soc/mscc/ocelot_hsio.h
[email protected] (open list)

expected:

Alexandre Belloni <[email protected]> (supporter:MICROSEMI ETHERNET SWITCH DRIVER)
Microchip Linux Driver Support <[email protected]> (supporter:MICROSEMI ETHERNET SWITCH DRIVER)
"David S. Miller" <[email protected]> (odd fixer:NETWORKING DRIVERS) [email protected] (open list:MICROSEMI ETHERNET SWITCH DRIVER)

Quoted 24 lines
drivers/net/ethernet/mscc/ocelot.h +1 -1
index 325afea3e846..32fef4f495aa 100644
@@ -18,12 +18,12 @@
 #include <linux/ptp_clock_kernel.h>
 #include <linux/regmap.h>
 
+#include <soc/mscc/ocelot_sys.h>
 #include <soc/mscc/ocelot.h>
 #include "ocelot_ana.h"
 #include "ocelot_dev.h"
 #include "ocelot_qsys.h"
 #include "ocelot_rew.h"
-#include "ocelot_sys.h"
 #include "ocelot_qs.h"
 #include "ocelot_tc.h"
 #include "ocelot_ptp.h"
include/soc/mscc/ocelot_sys.h renamed from drivers/net/ethernet/mscc/ocelot_sys.h +0 -0
similarity index 100%
rename from drivers/net/ethernet/mscc/ocelot_sys.h
rename to include/soc/mscc/ocelot_sys.h
Signature · 1 line
Florian
Reviewed-by on v1 12/12
#50 lore raw

Re: [PATCH net-next 12/12] net: dsa: vitesse: add tagger for Ocelot/Felix switches

In reply to Vladimir Oltean
Quoted 24 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

While it is entirely possible that this tagger format is in fact more generic than just these 2 switch families, I don't have that knowledge. The Seville switch in NXP T1040 has a similar frame format, but there are enough differences (e.g. DEST field starts at bit 57 instead of 56) that calling this file tag_vitesse.c is a bit of a stretch at the moment. The frame format has been listed in a comment so that people who add support for further Vitesse switches can rework this tagger while keeping compatibility with Felix.

The "ocelot" name was chosen instead of "felix" because even the Ocelot switch can act as a DSA device when it is used in NPI mode, and the Felix tagger format is almost identical. Currently it is only used for the Felix switch embedded in the NXP LS1028A chip.

The ABI for this tagger should be considered "not stable" at the moment. The DSA tag is always placed before the Ethernet header and therefore, we are using the long prefix for RX tags to avoid putting the DSA master port in promiscuous mode. Once there will be an API in DSA for drivers to request DSA masters to be in promiscuous mode unconditionally, we will switch to the "no prefix" extraction frame header, which will save 16 padding bytes for each RX frame.

Quoted 1 line
Signature · 1 line
Florian
#47 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Andrew Lunn
Quoted 10 lines · Andrew Lunn
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines

As there are no commonalities between the vsc73xx and felix drivers, shouldn't you simply leave that one out and have felix in the existing microchip folder?

I don't have a strong preference, although where I come from, all new NXP networking drivers are still labeled as "freescale" even though there is no code reuse. There are even less commonalities with Microchip (ex-Micrel, if I am not mistaken) KSZ switches than with the old vsc73xx. I'll let the ex-Vitesse people decide.

Quoted 4 lines
Quoted 1 line

I'm on the same page as Alexandre here.

Leaving them where they are makes maintenance easier. Fixes are easier to backport if things don't move around.

Agree

Quoted 8 lines
Quoted 3 lines

I think we should leave vsc73xx where it is already, and put the felix driver in the drivers/net/ethernet/mscc/ folder where ocelot is already.

Currently, all DSA drivers are in drivers/net/dsa. We do occasionally make changes over all DSA drivers at once, so it is nice they are all together. So i would prefer the DSA part of Felix is also there. But the core can be in drivers/net/ethernet/mscc/.

And agree here as well.

Signature · 1 line
Florian
maintainer
#51 lore raw

Re: [PATCH net-next 12/12] net: dsa: vitesse: add tagger for Ocelot/Felix switches

In reply to Vladimir Oltean

drivers/net/dsa/vitesse/felix.c line 16

Quoted 9 lines
drivers/net/dsa/vitesse/felix.c +1 -1
@@ -12,7 +12,7 @@
 static enum dsa_tag_protocol felix_get_tag_protocol(struct dsa_switch *ds,
 						    int port)
 {
-	return DSA_TAG_PROTO_NONE;
+	return DSA_TAG_PROTO_OCELOT;
 }

I would swap the order of these and the previous patch so you can avoid this.

Quoted 6 lines
net/dsa/Kconfig +0 -0
@@ -67,6 +67,13 @@ config NET_DSA_TAG_EDSA
 	  Say Y or M if you want to enable support for tagging frames for the
 	  Marvell switches which use EtherType DSA headers.
 

net/dsa/Kconfig config NET_DSA_TAG_EDSA · line 79

Quoted 10 lines
net/dsa/Kconfig +7 -0
+config NET_DSA_TAG_OCELOT
+	tristate "Tag driver for Vitesse Ocelot/Felix switch"
+	select PACKING
+	help
+	  Say Y or M if you want to enable support for tagging frames with the
+	  Vitesse Ocelot (VSC7514) and Felix (VSC9959) switching cores.
+
 config NET_DSA_TAG_MTK
 	tristate "Tag driver for Mediatek switches"
 	help

This file is sorted so that the tristate strings appear in alphabetic order when you do make menuconfig. This mean this entry to too early, and NXP SJA1105 so too late. :-(

Andrew

#45 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

In reply to Vladimir Oltean
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

The way I see an Ocelot DSA driver, it would be done a la mv88e6xxx, aka a single struct dsa_switch_ops registered for the entire family, and function pointers where the implementation differs. You're not proposing that here, but rather that each switch driver works in parallel with each other, and they all call into the Ocelot core. That would produce a lot more boilerplate, I think.
And if the DSA driver for Ocelot ends up supporting more than 1 device, its name should better not contain "vsc9959" since that's rather specific.

Quoted 7 lines
Quoted 2 lines

A vsc7511/12 will not share code with felix/vsc9959. I do not expect any other IP/chip will be register compatible with vsc9959.

I don't exactly understand this comment. Register-incompatible in a logical sense, or in a layout sense? Judging from the attachment in chapter 6 of the VSC7511 datasheet [1], at least the basic functionality appears to be almost the same. And for the rest, there's regmap magic.

My point is that vsc7511 has more in commen with vsc7514 than it has with felix/vsc9959.

vsc7511 will use the same regmaps as those in vsc7514 (with different helper functions as it will be accessing the reguster via SPI).

As far as I recall, felix/vsc9959 has slightly different (in-compatible) PTP functionallity than vsc7511-14, which needs to be handled in the felix/vsc9959 driver. The same apply if you want to add support for TAS/taprio as this featurte are not to be found in vsc7511-14.

Quoted 6 lines
Quoted 5 lines

A vsc7511/12 will use the ocelot DSA tagger, but other from that it will call into the ocelot driver (I think).

But to be honest, I do not think we should spend too much energy on vsc7511/12 now. When/if it comes, we will see how it fit best.

Quoted 6 lines

Ok. So the driver will still be called "felix", it will instantiate a struct felix_info_vsc9959 instead of the current felix_info_ls1028a, but will live in the root drivers/net/dsa folder. Then, when/if you add support for vsc7511, you'll move both into an "ocelot" folder and figure out how much of the driver minus the tagger is worth reusing (aka instantiate a struct felix_info_vsc7511). Agree?

Agree.

/Allan

#46 lore raw

Re: [PATCH net-next 10/12] net: dsa: vitesse: move vsc73xx driver to a separate folder

Quoted 16 lines · Allan W. Nielsen
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

The way I see an Ocelot DSA driver, it would be done a la mv88e6xxx, aka a single struct dsa_switch_ops registered for the entire family, and function pointers where the implementation differs. You're not proposing that here, but rather that each switch driver works in parallel with each other, and they all call into the Ocelot core. That would produce a lot more boilerplate, I think.
And if the DSA driver for Ocelot ends up supporting more than 1 device, its name should better not contain "vsc9959" since that's rather specific.

Quoted 7 lines
Quoted 2 lines

A vsc7511/12 will not share code with felix/vsc9959. I do not expect any other IP/chip will be register compatible with vsc9959.

I don't exactly understand this comment. Register-incompatible in a logical sense, or in a layout sense? Judging from the attachment in chapter 6 of the VSC7511 datasheet [1], at least the basic functionality appears to be almost the same. And for the rest, there's regmap magic.

Quoted 6 lines

My point is that vsc7511 has more in commen with vsc7514 than it has with felix/vsc9959.

vsc7511 will use the same regmaps as those in vsc7514 (with different helper functions as it will be accessing the reguster via SPI).

regmap will properly abstract the underlying bus, this was the whole point of using it.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#25 lore raw

Re: [PATCH net-next 07/12] net: mscc: ocelot: separate the implementation of switch reset

In reply to Vladimir Oltean
Quoted 16 lines · Vladimir Oltean
Quoted 15 lines · Andrew Lunn
Quoted 12 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The Felix switch has a different reset procedure, so a function pointer needs to be created and added to the ocelot_ops structure.

The reset procedure has been moved into ocelot_init.

---
 drivers/net/ethernet/mscc/ocelot.c       |  3 ++
 drivers/net/ethernet/mscc/ocelot.h       |  1 +
 drivers/net/ethernet/mscc/ocelot_board.c | 37 +++++++++++++++---------
Quoted 9 lines
Quoted 6 lines

I'm wondering about the name board. So far, the code you have moved into ocelot_board has nothing to do with the board as such. This is not a GPIO used to reset the switch, it is not a regulator, etc. It is all internal to the device, but just differs per family. Maybe you can think of a better name?

Alexandre, what do you think? I agree "ocelot_board" is a bit strange.

The name was coming from mscc, Allan agreed to rename it to ocelot_vsc7514.c which would make sense.

Signature · 3 lines
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

Re: [PATCH net-next 02/12] net: mscc: ocelot: filter out ocelot SoC specific PCS config from common path

In reply to Vladimir Oltean
I love your patch! Yet something to improve:

Hi Vladimir,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[cannot apply to v5.4-rc7 next-20191111]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Vladimir-Oltean/DSA-driver-for-Vitesse-Felix-switch/20191113-100022
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git e0580b50d9d4b61d6c56085acdc2bb01c040aca9
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

>> ERROR: "ocelot_chip_init" [drivers/net/ethernet/mscc/ocelot_board.ko] undefined!

ERROR: "ia64_delay_loop" [drivers/net/phy/mdio-cavium.ko] undefined!
ERROR: "ia64_delay_loop" [drivers/spi/spi-thunderx.ko] undefined!

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#31 lore raw

Re: [PATCH net-next 08/12] net: mscc: ocelot: publish structure definitions to include/soc/mscc/ocelot.h

In reply to Vladimir Oltean
I love your patch! Yet something to improve:

Hi Vladimir,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[cannot apply to v5.4-rc7 next-20191111]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Vladimir-Oltean/DSA-driver-for-Vitesse-Felix-switch/20191113-100022
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git e0580b50d9d4b61d6c56085acdc2bb01c040aca9
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.4.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

>> ERROR: "ocelot_probe_port" [drivers/net/ethernet/mscc/ocelot_board.ko] undefined!

ERROR: "ocelot_chip_init" [drivers/net/ethernet/mscc/ocelot_board.ko] undefined!
ERROR: "ia64_delay_loop" [drivers/net/phy/mdio-cavium.ko] undefined!
ERROR: "ia64_delay_loop" [drivers/spi/spi-thunderx.ko] undefined!

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation