Skip to contentSkip to conversation

nds32: eth: Support ftmac100 DM.

PATCH New Andes 1 participant 1 message May 23, 2017 Network drivers

lore
Share & tools
lore

Andes

author
#0 lore raw

PATCH 1/1 nds32: eth: Support ftmac100 DM.

From: rick <[email protected]>

Support Andestech eth ftmac100 device tree flow on AG101P/AE3XX platform. Verification:
Boot linux kernel via dhcp and bootm ok.

NDS32 # setenv bootm_size 0x2000000;setenv fdt_high 0x1f00000; NDS32 # dhcp 0x600000 10.0.4.97:boomimage-310y-ae300-spi.bin BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
DHCP client bound to address 10.0.4.178 (4899 ms)

	Using mac at e0100000 device
	TFTP from server 10.0.4.97; our IP address is 10.0.4.178
	Filename 'boomimage-310y-ae300-spi.bin'.
	Load address: 0x600000
	Loading: #################################################################
	         #################################################################
	         #################################################################
...
...
	         ###################################
	         233.4 KiB/s
					 done
					 Bytes transferred = 13872076 (d3abcc hex)
	NDS32 # dhcp 0x2000000 10.0.4.97:ae300.dtb
	BOOTP broadcast 1
	BOOTP broadcast 2
	BOOTP broadcast 3
	BOOTP broadcast 4
	DHCP client bound to address 10.0.4.178 (4592 ms)
	Using mac at e0100000 device
	TFTP from server 10.0.4.97; our IP address is 10.0.4.178
	Filename 'ae300.dtb'.
	Load address: 0x2000000
	Loading: #
	         82 KiB/s
					 done
					 Bytes transferred = 2378 (94a hex)
	NDS32 # bootm 0x600000 - 0x2000000
	 Image Name:
	 Created:      2017-03-22   6:52:03 UTC
	 Image Type:   NDS32 Linux Kernel Image (uncompressed)
	 Data Size:    13872012 Bytes = 13.2 MiB
	 Load Address: 0000c000
	 Entry Point:  0000c000
	 Verifying Checksum ... OK
	 Booting using the fdt blob at 0x2000000
	 Loading Kernel Image ... OK
	 Loading Device Tree to 01efc000, end 01eff949 ... OK
	 Linux version 3.10.102-20375-gb0034c1-dirty (rick at app09)
	(gcc version 4.9.3 (2016-07-06_nds32le-linux-glibc-v3_experimental) )
  #293 PREEMPT Wed Mar 22 14:49:28 CST 2017
	CPU: NDS32 N13, AndesCore ID(wb), CPU_VER 0x0d11103f(id 13, rev 17, cfg 4159)

...
...

---
 arch/nds32/dts/ae3xx.dts                |    7 +
 arch/nds32/dts/ag101p.dts               |    6 +
 board/AndesTech/adp-ae3xx/adp-ae3xx.c   |    4 +-
 board/AndesTech/adp-ag101p/adp-ag101p.c |    4 +-
 configs/adp-ae3xx_defconfig             |    3 +
 configs/adp-ag101p_defconfig            |    3 +
 drivers/net/Kconfig                     |    5 +
 drivers/net/ftmac100.c                  |  270 +++++++++++++++++++++++++------
 include/configs/adp-ae3xx.h             |    5 -
 include/configs/adp-ag101p.h            |    5 -
 10 files changed, 251 insertions(+), 61 deletions(-)
arch/nds32/dts/ae3xx.dts +7 -0
index 9062760..4221e4b 100644
@@ -7,6 +7,7 @@
 
 	aliases {
 		uart0 = &serial0;
+		ethernet0 = &mac0;
 	} ;
 
 	chosen {
@@ -55,6 +56,12 @@
 		clock-frequency = <30000000>;
 	};
 
+	mac0: mac at e0100000 {
+		compatible = "andestech,atmac100";
+		reg = <0xe0100000 0x1000>;
+		interrupts = <25 4>;
+	};
+
 	nor at 0,0 {
 		compatible = "cfi-flash";
 		reg = <0x88000000 0x1000>;
arch/nds32/dts/ag101p.dts +6 -0
index 91314b5..99cde2f 100644
@@ -7,6 +7,7 @@
 
 	aliases {
 		uart0 = &serial0;
+		ethernet0 = &mac0;
 	} ;
 
 	chosen {
@@ -54,4 +55,9 @@
 		clock-frequency = <15000000>;
 	};
 
+	mac0: mac at 90900000 {
+		compatible = "andestech,atmac100";
+		reg = <0x90900000 0x1000>;
+		interrupts = <25 4>;
+	};
 };
board/AndesTech/adp-ae3xx/adp-ae3xx.c +2 -2
index ab174fa..98ed4d9 100644
@@ -7,7 +7,7 @@
  */
 
 #include <common.h>
-#if defined(CONFIG_FTMAC100)
+#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
 #endif
 #include <linux/io.h>
@@ -56,7 +56,7 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-#if defined(CONFIG_FTMAC100)
+#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 int board_eth_init(bd_t *bd)
 {
 	return ftmac100_initialize(bd);
board/AndesTech/adp-ag101p/adp-ag101p.c +2 -2
index 0fd6fb0..a462941 100644
@@ -7,7 +7,7 @@
  */
 
 #include <common.h>
-#if defined(CONFIG_FTMAC100)
+#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
 #endif
 #include <linux/io.h>
@@ -62,7 +62,7 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-#if defined(CONFIG_FTMAC100)
+#if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 int board_eth_init(bd_t *bd)
 {
 	return ftmac100_initialize(bd);
configs/adp-ae3xx_defconfig +3 -0
index 95df275..cbef412 100644
@@ -16,9 +16,12 @@ CONFIG_MMC=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_BAUDRATE=38400
 CONFIG_OF_CONTROL=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
 CONFIG_MTD=y
 CONFIG_CFI_FLASH=y
+CONFIG_DM_ETH=y
+CONFIG_FTMAC100=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_TIMER=y
configs/adp-ag101p_defconfig +3 -0
index afcfa18..22b1182 100644
@@ -16,7 +16,10 @@ CONFIG_MMC=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_BAUDRATE=38400
 CONFIG_OF_CONTROL=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_DM=y
+CONFIG_DM_ETH=y
+CONFIG_FTMAC100=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_TIMER=y
drivers/net/Kconfig +5 -0
index 9cd0d94..c5e2b16 100644
@@ -225,4 +225,9 @@ config GMAC_ROCKCHIP
 	  This driver provides Rockchip SoCs network support based on the
 	  Synopsys Designware driver.
 
+config FTMAC100
+	bool "Ftmac100 Ethernet Support"
+	help
+	  This MAC is present in Andestech SoCs.
+
 endif # NETDEVICES
drivers/net/ftmac100.c +223 -47

382 lines not on this page · raw message

include/configs/adp-ae3xx.h +0 -5
index edc742d..6bfc08e 100644
@@ -90,11 +90,6 @@
 #define CONFIG_SYS_NS16550_CLK		((18432000 * 20) / 25)	/* AG101P */
 
 /*
- * Ethernet
- */
-#define CONFIG_FTMAC100
-
-/*
  * SD (MMC) controller
  */
 #define CONFIG_FTSDC010
include/configs/adp-ag101p.h +0 -5
index bc122d3..4cef64e 100644
@@ -96,11 +96,6 @@
 #define CONFIG_SYS_NS16550_CLK		((18432000 * 20) / 25)	/* AG101P */
 
 /*
- * Ethernet
- */
-#define CONFIG_FTMAC100
-
-/*
  * SD (MMC) controller
  */
 #define CONFIG_FTSDC010
Signature · 1 line
1.7.9.5