diff mbox series

[2/2] board: presidio-asic: Add CAxxxx Ethernet support

Message ID 1588204706-20237-2-git-send-email-alex.nemirovsky@cortina-access.com
State Superseded
Headers show
Series [1/2] net: cortina_ni: Addd eth support for Cortina Access CAxxxx SoCs | expand

Commit Message

Alex Nemirovsky April 29, 2020, 11:58 p.m. UTC
Add CAxxxx Ethernet support for the Cortina Access
Presidio Engineering Board

Signed-off-by: Alex Nemirovsky <alex.nemirovsky at cortina-access.com>
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Tom Rini <trini at konsulko.com>
---

 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(-)
diff mbox series

Patch

diff --git a/arch/arm/dts/ca-presidio-engboard.dts b/arch/arm/dts/ca-presidio-engboard.dts
index c03dacc..78eb542 100644
--- a/arch/arm/dts/ca-presidio-engboard.dts
+++ b/arch/arm/dts/ca-presidio-engboard.dts
@@ -19,6 +19,13 @@ 
 		io_drv_ctrl = <0xf432004c>;
 	};
 
+	eth: ethnet at 0xf4300000 {
+		compatible = "eth_cortina";
+		reg = <0x0 0xf4320000 0x34>,
+		      <0x0 0xf43290d8 0x04>,
+		      <0x0 0xf4304000 0x04>;
+	};
+
 	gpio0: gpio-controller at 0xf4329280  {
 		compatible = "cortina,ca-gpio";
 		reg = <0x0 0xf4329280 0x24>;
diff --git a/board/cortina/presidio-asic/presidio.c b/board/cortina/presidio-asic/presidio.c
index b4fa01f..881845d 100644
--- a/board/cortina/presidio-asic/presidio.c
+++ b/board/cortina/presidio-asic/presidio.c
@@ -103,6 +103,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;
diff --git a/configs/cortina_presidio-asic-emmc_defconfig b/configs/cortina_presidio-asic-emmc_defconfig
index e10008a..360ebeb 100644
--- a/configs/cortina_presidio-asic-emmc_defconfig
+++ b/configs/cortina_presidio-asic-emmc_defconfig
@@ -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