Skip to contentSkip to conversation

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

PATCH New Alex Nemirovsky 2 participants 6 messages Jan 14, 2021 – Jan 27, 2021

Subsystems (3)

v2 of 4 New Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 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 both legacy and DM_ETH network models.

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

---

Changes in v2:
- clean up old debug code
- reference CRC functions already provided in u-boot core
- remove unused code, ex: CA_IN/CA_OUT
- refactor the design of register read/write, union -> struct
- remove platform dependent code

 MAINTAINERS              |    4 +
 drivers/net/Kconfig      |    7 +
 drivers/net/Makefile     |    1 +
 drivers/net/cortina_ni.c | 1103 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/cortina_ni.h |  401 +++++++++++++++++
 5 files changed, 1516 insertions(+)
 create mode 100644 drivers/net/cortina_ni.c
 create mode 100644 drivers/net/cortina_ni.h
MAINTAINERS +4 -0
index 52d7307..74d6232 100644
@@ -198,6 +198,8 @@ F:	drivers/mmc/ca_dw_mmc.c
 F:	drivers/spi/ca_sflash.c
 F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
+F:	drivers/net/cortina_ni.c
+F:	drivers/net/cortina_ni.h
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -806,6 +808,8 @@ F:	drivers/mmc/ca_dw_mmc.c
 F:	drivers/spi/ca_sflash.c
 F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
+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 3a5e036..7e4db73 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
+	  This 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 e3bdda3..00eb3b5 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 +1103 -0

1,103 lines not on this page · raw message

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

401 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/3 net: phy: ca_phy: Add driver for CAxxxx SoCs

From: Abbie Chang <[email protected]>

Add phy driver support for MACs embedded inside Cortina Access SoCs

CC Joe Hershberger <[email protected]>
CC Tom Rini <[email protected]>
CC Aaron Tseng <[email protected]>

Moved out PHY specific code out of Cortina NI Ethernet driver and into a Cortina Access PHY interface driver

---

Changes in v2: None

 MAINTAINERS              |   2 +
 drivers/net/phy/Kconfig  |   7 +++
 drivers/net/phy/Makefile |   1 +
 drivers/net/phy/ca_phy.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy.c    |   3 ++
 include/phy.h            |   1 +
 6 files changed, 147 insertions(+)
 create mode 100644 drivers/net/phy/ca_phy.c
MAINTAINERS +2 -0
index 74d6232..f9aab7d 100644
@@ -200,6 +200,7 @@ F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
 F:	drivers/net/cortina_ni.c
 F:	drivers/net/cortina_ni.h
+F:	drivers/net/phy/ca_phy.c
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -810,6 +811,7 @@ F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
 F:	drivers/net/cortina_ni.c
 F:	drivers/net/cortina_ni.h
+F:	drivers/net/phy/ca_phy.c
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/net/phy/Kconfig +7 -0
index 51733dd..d695030 100644
@@ -131,6 +131,13 @@ config SYS_CORTINA_FW_IN_SPIFLASH
 
 endchoice
 
+config PHY_CORTINA_ACCESS
+	bool "Cortina Access Ethernet PHYs support"
+	default y
+	depends on CORTINA_NI_ENET
+	help
+		Cortina Access Ethernet PHYs init process
+
 config PHY_DAVICOM
 	bool "Davicom Ethernet PHYs support"
 
drivers/net/phy/Makefile +1 -0
index 6e72233..e967f82 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_PHY_AQUANTIA) += aquantia.o
 obj-$(CONFIG_PHY_ATHEROS) += atheros.o
 obj-$(CONFIG_PHY_BROADCOM) += broadcom.o
 obj-$(CONFIG_PHY_CORTINA) += cortina.o
+obj-$(CONFIG_PHY_CORTINA_ACCESS) += ca_phy.o
 obj-$(CONFIG_PHY_DAVICOM) += davicom.o
 obj-$(CONFIG_PHY_ET1011C) += et1011c.o
 obj-$(CONFIG_PHY_LXT) += lxt.o
drivers/net/phy/ca_phy.c new file +133 -0

133 lines not on this page · raw message

drivers/net/phy/phy.c +3 -0
index 9587e6b..662ea2b 100644
@@ -500,6 +500,9 @@ int phy_init(void)
 #ifdef CONFIG_PHY_CORTINA
 	phy_cortina_init();
 #endif
+#ifdef CONFIG_PHY_CORTINA_ACCESS
+	phy_cortina_access_init();
+#endif
 #ifdef CONFIG_PHY_DAVICOM
 	phy_davicom_init();
 #endif
include/phy.h +1 -0
index cbdb10d..7750efd 100644
@@ -493,6 +493,7 @@ int phy_aquantia_init(void);
 int phy_atheros_init(void);
 int phy_broadcom_init(void);
 int phy_cortina_init(void);
+int phy_cortina_access_init(void);
 int phy_davicom_init(void);
 int phy_et1011c_init(void);
 int phy_lxt_init(void);
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/3 net: phy: ca_phy: Add driver for CAxxxx SoCs

Quoted 7 lines · Alex Nemirovsky

From: Abbie Chang <[email protected]>

Add phy driver support for MACs embedded inside Cortina Access SoCs

Quoted 6 lines
CC Joe Hershberger <[email protected]>
CC Tom Rini <[email protected]>
CC Aaron Tseng <[email protected]>

Moved out PHY specific code out of Cortina NI Ethernet driver and into a Cortina Access PHY interface driver

Applied to u-boot/master, 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/20210127/f40f6559/attachment.sig>
#3 lore raw

PATCH v2 3/3 board: presidio-asic: Add CAxxxx Ethernet support

In reply to Alex Nemirovsky

Add CAxxxx Ethernet support for the Cortina Access Presidio Engineering Board

---

Changes in v2:
- only support DM_ETH network models by removing
code for legacy mode support

 arch/arm/dts/ca-presidio-engboard.dts        | 31 ++++++++++++++++++++++++++++
 configs/cortina_presidio-asic-emmc_defconfig |  4 +++-
 include/configs/presidio_asic.h              | 15 +++++++++++++-
 3 files changed, 48 insertions(+), 2 deletions(-)
arch/arm/dts/ca-presidio-engboard.dts +31 -0
index eef433e..7919866 100644
@@ -95,4 +95,35 @@
 		};
 
 	};
+
+	eth: ethnet at 0xf4300000 {
+		compatible = "eth_cortina";
+		reg = <0x0 0xf4320000 0x34>,
+		      <0x0 0xf43290d8 0x04>,
+		      <0x0 0xf4304000 0x04>;
+
+		/* port0: phy address 1 - GMAC0: port 0
+		 * port1: phy address 2 - GMAC1: port 1
+		 * port2: phy address 3 - GMAC2: port 2
+		 * port3: phy address 4 - GMAC3: port 3
+		 * port4: phy address 5 - RGMII: port 4
+		 */
+		valid-port-map = <0x1f>;
+		valid-port-num = <5>;
+		valid-ports = <0x1 0x0>,
+			      <0x2 0x1>,
+			      <0x3 0x2>,
+			      <0x4 0x3>,
+			      <0x5 0x4>;
+		def-active-port = <0x3>;
+		inter-gphy-num = <6>;
+		inter-gphy-val = <0xf43380fc 0xbcd>,
+				 <0xf43380dc 0xeeee>,
+				 <0xf43380d8 0xeeee>,
+				 <0xf43380fc 0xbce>,
+				 <0xf43380c0 0x7777>,
+				 <0xf43380c4 0x7777>;
+		init-rgmii = <1>;
+		ni-xram-base = <0xF4500000>;
+	};
 };
configs/cortina_presidio-asic-emmc_defconfig +3 -1
index faffdd4..eec9584 100644
@@ -22,7 +22,6 @@ CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIVE=y
-# CONFIG_NET is not set
 CONFIG_DM=y
 CONFIG_CORTINA_GPIO=y
 CONFIG_DM_I2C=y
@@ -30,6 +29,9 @@ CONFIG_SYS_I2C_CA=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
include/configs/presidio_asic.h +14 -1
index 34235b5..c2082b4 100644
@@ -2,7 +2,7 @@
 /*
  * Copyright (C) 2020 Cortina Access Inc.
  *
- * Configuration for Cortina-Access Presidio board.
+ * Configuration for Cortina-Access Presidio board
  */
 
 #ifndef __PRESIDIO_ASIC_H
@@ -63,6 +63,19 @@
 					sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
 
+#define KSEG1_ATU_XLAT(x) (x)
+
+/* HW REG ADDR */
+#define NI_READ_POLL_COUNT                      1000
+#define CA_NI_MDIO_REG_BASE                     0xF4338
+#define NI_HV_GLB_MAC_ADDR_CFG0_OFFSET          0x010
+#define NI_HV_GLB_MAC_ADDR_CFG1_OFFSET          0x014
+#define NI_HV_PT_BASE                           0x400
+#define NI_HV_XRAM_BASE                         0x820
+#define GLOBAL_BLOCK_RESET_OFFSET               0x04
+#define GLOBAL_GLOBAL_CONFIG_OFFSET             0x20
+#define GLOBAL_IO_DRIVE_CONTROL_OFFSET          0x4c
+
 /* max command args */
 #define CONFIG_SYS_MAXARGS		64
 #define CONFIG_EXTRA_ENV_SETTINGS	"silent=y\0"
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 3/3 board: presidio-asic: Add CAxxxx Ethernet support

Quoted 5 lines · Alex Nemirovsky

Add CAxxxx Ethernet support for the Cortina Access Presidio Engineering Board

Applied to u-boot/master, 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/20210127/bb7f9bb5/attachment.sig>
#5 lore raw

PATCH v2 1/3 net: cortina_ni: Add eth support for Cortina Access CAxxxx SoCs

In reply to Alex Nemirovsky
Quoted 5 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.

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

Applied to u-boot/master, 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/20210127/454f6e22/attachment.sig>