Skip to contentSkip to conversation

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

PATCH Superseded Alex Nemirovsky 1 participant 2 messages Jun 3, 2020

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

From: Aaron Tseng <[email protected]>

Add Cortina Access Ethernet device driver for CAxxxx SoCs. This driver supports only the DM_ETH network model.

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

---

Changes in v3:
- Changed commit comment to state that only DM model is supported
- Removed blank line at end of C file

Changes in v2:
- Remove legacy mode support
- Add support for additional SoC variants
- Remove unused variables

 MAINTAINERS              |    4 +
 drivers/net/Kconfig      |    7 +
 drivers/net/Makefile     |    1 +
 drivers/net/cortina_ni.c | 1909 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/cortina_ni.h |  592 ++++++++++++++
 5 files changed, 2513 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 +1909 -0

1,909 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 v3 2/2 board: presidio-asic: Add CAxxxx Ethernet support

Add CAxxxx Ethernet support for the Cortina Access Presidio Engineering Board

---

Changes in v3: None
Changes in v2: None

 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