Skip to contentSkip to conversation

net: cortina_ni: Addd eth support for Cortina Access CAxxxx SoCs

PATCH Superseded Alex Nemirovsky 2 participants 6 messages Jun 2, 2020 – Jun 3, 2020

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 net: cortina_ni: Addd eth support for Cortina Access CAxxxx SoCs

From: Aaron Tseng <[email protected]>

Add Cortina Access Ethernet device driver for CAxxxx SoCs. This driver supports both legacy and DM_ETH network models.

CC Joe Hershberger <[email protected]>
CC Abbie Chang <[email protected]>
CC Tom Rini <[email protected]>

---

 MAINTAINERS              |    4 +
 drivers/net/Kconfig      |    7 +
 drivers/net/Makefile     |    1 +
 drivers/net/cortina_ni.c | 1955 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/cortina_ni.h |  592 ++++++++++++++
 5 files changed, 2559 insertions(+)
 create mode 100644 drivers/net/cortina_ni.c
 create mode 100644 drivers/net/cortina_ni.h
MAINTAINERS +4 -0
index 8add9d4..1b166d2 100644
@@ -181,6 +181,8 @@ F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
 F:	drivers/mmc/ca_dw_mmc.c
+F:	drivers/net/cortina_ni.c
+F:	drivers/net/cortina_ni.h
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -732,6 +734,8 @@ F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
 F:	drivers/mmc/ca_dw_mmc.c
+F:	drivers/net/cortina_ni.c
+F:	drivers/net/cortina_ni.h
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/net/Kconfig +7 -0
index f7855c9..45e0480 100644
@@ -149,6 +149,13 @@ config BCMGENET
 	help
 	  This driver supports the BCMGENET Ethernet MAC.
 
+config CORTINA_NI_ENET
+    	bool "Cortina-Access Ethernet driver"
+    	depends on DM_ETH && CORTINA_PLATFORM
+    	help
+      	  The driver supports the Cortina-Access Ethernet MAC for
+	  all supported CAxxxx SoCs
+
 config DWC_ETH_QOS
 	bool "Synopsys DWC Ethernet QOS device support"
 	depends on DM_ETH
drivers/net/Makefile +1 -0
index 383ed1c..1d6ec4f 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_DRIVER_AX88180) += ax88180.o
 obj-$(CONFIG_BCM_SF2_ETH) += bcm-sf2-eth.o
 obj-$(CONFIG_BCM_SF2_ETH_GMAC) += bcm-sf2-eth-gmac.o
 obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
+obj-$(CONFIG_CORTINA_NI_ENET) += cortina_ni.o
 obj-$(CONFIG_CS8900) += cs8900.o
 obj-$(CONFIG_TULIP) += dc2114x.o
 obj-$(CONFIG_ETH_DESIGNWARE) += designware.o
drivers/net/cortina_ni.c new file +1955 -0

1,955 lines not on this page · raw message

drivers/net/cortina_ni.h new file +592 -0

592 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 board: presidio-asic: Add CAxxxx Ethernet support

Add CAxxxx Ethernet support for the Cortina Access Presidio Engineering Board

---

 arch/arm/dts/ca-presidio-engboard.dts        |  7 +++++++
 board/cortina/presidio-asic/presidio.c       | 21 +++++++++++++++++++++
 configs/cortina_presidio-asic-emmc_defconfig |  4 +++-
 3 files changed, 31 insertions(+), 1 deletion(-)
arch/arm/dts/ca-presidio-engboard.dts +7 -0
index c03dacc..fff879d 100644
@@ -66,4 +66,11 @@
 			spi-max-frequency = <108000000>;
 		};
 	};
+
+	eth: ethnet at 0xf4300000 {
+		compatible = "eth_cortina";
+		reg = <0x0 0xf4320000 0x34>,
+		      <0x0 0xf43290d8 0x04>,
+		      <0x0 0xf4304000 0x04>;
+	};
 };
board/cortina/presidio-asic/presidio.c +21 -0
index 3c132f1..a0dbfd6 100644
@@ -105,6 +105,27 @@ int board_init(void)
 	return 0;
 }
 
+#ifndef CONFIG_DM_ETH
+/*
+ * Board specific ethernet initialization routine.
+ */
+int ca77xx_eth_initialize(bd_t *bis);
+int board_eth_init(bd_t *bis)
+{
+	int rc = 0;
+	unsigned int reg_data;
+
+	ca77xx_eth_initialize(bis);
+
+	// Power down GMAC4 TX/RX clock for EMI issue
+	reg_data = readl(0xf4304684);
+	reg_data |= (3 << 11);
+	writel(reg_data, 0xf4304684);
+
+	return rc;
+}
+#endif
+
 int dram_init(void)
 {
 	unsigned int ddr_size;
configs/cortina_presidio-asic-emmc_defconfig +3 -1
index e10008a..360ebeb 100644
@@ -21,12 +21,14 @@ CONFIG_CMD_EXT4=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="ca-presidio-engboard"
-# CONFIG_NET is not set
 CONFIG_DM=y
 CONFIG_CORTINA_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_CORTINA=y
+CONFIG_PHYLIB=y
+CONFIG_DM_ETH=y
+CONFIG_CORTINA_NI_ENET=y
 CONFIG_DM_SERIAL=y
 CONFIG_CORTINA_UART=y
 CONFIG_WDT=y
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/2 net: cortina_ni: Addd eth support for Cortina Access CAxxxx SoCs

In reply to Alex Nemirovsky
Quoted 11 lines · Alex Nemirovsky

From: Aaron Tseng <[email protected]>

Add Cortina Access Ethernet device driver for CAxxxx SoCs. This driver supports both legacy and DM_ETH network models.

CC Joe Hershberger <[email protected]>
CC Abbie Chang <[email protected]>
CC Tom Rini <[email protected]>

[snip]

drivers/net/cortina_ni.c line 30

Quoted 3 lines
drivers/net/cortina_ni.c new file +3 -0
+#define HEADER_A_SIZE	8
+#define CORTINA_NI_DBG 1
+/*define CORTINA_NI_DBG if individual rx,tx,init needs to be called */

We have pr_debug, etc, please use those and not a custom debug defiine.

drivers/net/cortina_ni.c line 37

Quoted 6 lines
drivers/net/cortina_ni.c new file +6 -0
+#ifdef CONFIG_DM_ETH
+#if CORTINA_NI_DBG
+static struct udevice	*dbg_dev;
+#endif
+static struct udevice   *curr_dev;
+#else

The deadline for drivers to convert to DM for ethernet is v2020.07. Please rework to not introduce any legacy mode support. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200602/7601f186/attachment.sig>
#3 lore raw

PATCH 1/2 net: cortina_ni: Addd eth support for Cortina Access CAxxxx SoCs

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 11 lines · Alex Nemirovsky

From: Aaron Tseng <[email protected]>

Add Cortina Access Ethernet device driver for CAxxxx SoCs. This driver supports both legacy and DM_ETH network models.

CC Joe Hershberger <[email protected]>
CC Abbie Chang <[email protected]>
CC Tom Rini <[email protected]>

[snip]

drivers/net/cortina_ni.c line 30

Quoted 3 lines
drivers/net/cortina_ni.c new file +3 -0
+#define HEADER_A_SIZE	8
+#define CORTINA_NI_DBG 1
+/*define CORTINA_NI_DBG if individual rx,tx,init needs to be called */

We have pr_debug, etc, please use those and not a custom debug defiine.

Quoted 9 lines

drivers/net/cortina_ni.c line 37

Quoted 6 lines
drivers/net/cortina_ni.c new file +6 -0
+#ifdef CONFIG_DM_ETH
+#if CORTINA_NI_DBG
+static struct udevice	*dbg_dev;
+#endif
+static struct udevice   *curr_dev;
+#else

The deadline for drivers to convert to DM for ethernet is v2020.07. Please rework to not introduce any legacy mode support. Thanks!

For clarity, we are providing BOTH DM and Legacy mode support in our driver.
Is the request to REMOVE Legacy mode support, even though DM support is already provided to meet the 2020.07 requirement?

Quoted 3 lines
Signature · 2 lines
-- 
Tom
#4 lore raw

PATCH 1/2 net: cortina_ni: Addd eth support for Cortina Access CAxxxx SoCs

Quoted 34 lines · Alex Nemirovsky

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 11 lines · Alex Nemirovsky

From: Aaron Tseng <[email protected]>

Add Cortina Access Ethernet device driver for CAxxxx SoCs. This driver supports both legacy and DM_ETH network models.

CC Joe Hershberger <[email protected]>
CC Abbie Chang <[email protected]>
CC Tom Rini <[email protected]>

[snip]

drivers/net/cortina_ni.c line 30

Quoted 3 lines
drivers/net/cortina_ni.c new file +3 -0
+#define HEADER_A_SIZE	8
+#define CORTINA_NI_DBG 1
+/*define CORTINA_NI_DBG if individual rx,tx,init needs to be called */

We have pr_debug, etc, please use those and not a custom debug defiine.

Quoted 9 lines

drivers/net/cortina_ni.c line 37

Quoted 6 lines
drivers/net/cortina_ni.c new file +6 -0
+#ifdef CONFIG_DM_ETH
+#if CORTINA_NI_DBG
+static struct udevice	*dbg_dev;
+#endif
+static struct udevice   *curr_dev;
+#else

The deadline for drivers to convert to DM for ethernet is v2020.07. Please rework to not introduce any legacy mode support. Thanks!

Quoted 2 lines

For clarity, we are providing BOTH DM and Legacy mode support in our driver.
Is the request to REMOVE Legacy mode support, even though DM support is already provided to meet the 2020.07 requirement?

Yes, remove the legacy code as there's no non-legacy users in upstream to support. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200602/980f6649/attachment.sig>
#5 lore raw

PATCH 1/2 net: cortina_ni: Addd eth support for Cortina Access CAxxxx SoCs

Abbie/Aaron,
please remove legacy mode code so that we only support DM mode per Tom?s request. Thanks
-AN

Quoted 45 lines · Tom Rini
Quoted 34 lines · Alex Nemirovsky

Hi Tom,

Quoted 22 lines · Tom Rini
Quoted 11 lines · Alex Nemirovsky

From: Aaron Tseng <[email protected]>

Add Cortina Access Ethernet device driver for CAxxxx SoCs. This driver supports both legacy and DM_ETH network models.

CC Joe Hershberger <[email protected]>
CC Abbie Chang <[email protected]>
CC Tom Rini <[email protected]>

[snip]

drivers/net/cortina_ni.c line 30

Quoted 3 lines
drivers/net/cortina_ni.c new file +3 -0
+#define HEADER_A_SIZE	8
+#define CORTINA_NI_DBG 1
+/*define CORTINA_NI_DBG if individual rx,tx,init needs to be called */

We have pr_debug, etc, please use those and not a custom debug defiine.

Quoted 9 lines

drivers/net/cortina_ni.c line 37

Quoted 6 lines
drivers/net/cortina_ni.c new file +6 -0
+#ifdef CONFIG_DM_ETH
+#if CORTINA_NI_DBG
+static struct udevice	*dbg_dev;
+#endif
+static struct udevice   *curr_dev;
+#else

The deadline for drivers to convert to DM for ethernet is v2020.07. Please rework to not introduce any legacy mode support. Thanks!

Quoted 2 lines

For clarity, we are providing BOTH DM and Legacy mode support in our driver.
Is the request to REMOVE Legacy mode support, even though DM support is already provided to meet the 2020.07 requirement?

Yes, remove the legacy code as there's no non-legacy users in upstream to support. Thanks!

Signature · 1 line
Tom