All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING
@ 2015-03-01 16:33 Simon Glass
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 02/13] net: Fix eth_get_dev_by_name() warning Simon Glass
                   ` (12 more replies)
  0 siblings, 13 replies; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

This string seems wrong - U-Boot is normally written with a capital B.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/config_distro_defaults.h    | 4 ++--
 include/configs/ls2085a_common.h    | 2 +-
 include/configs/vexpress_aemv8a.h   | 2 +-
 include/configs/vexpress_ca15_tc2.h | 2 +-
 include/configs/vexpress_ca5x2.h    | 2 +-
 include/configs/vexpress_ca9x4.h    | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/config_distro_defaults.h b/include/config_distro_defaults.h
index 1ecc0bb..faf564f 100644
--- a/include/config_distro_defaults.h
+++ b/include/config_distro_defaults.h
@@ -23,9 +23,9 @@
 #if defined(__arm__)
 #define CONFIG_BOOTP_PXE_CLIENTARCH     0x100
 #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__)
-#define CONFIG_BOOTP_VCI_STRING         "U-boot.armv7"
+#define CONFIG_BOOTP_VCI_STRING         "U-Boot.armv7"
 #else
-#define CONFIG_BOOTP_VCI_STRING         "U-boot.arm"
+#define CONFIG_BOOTP_VCI_STRING         "U-Boot.arm"
 #endif
 #endif
 
diff --git a/include/configs/ls2085a_common.h b/include/configs/ls2085a_common.h
index 6fe032c..69de475 100644
--- a/include/configs/ls2085a_common.h
+++ b/include/configs/ls2085a_common.h
@@ -27,7 +27,7 @@
 #define CONFIG_BOARD_EARLY_INIT_F	1
 
 #define CONFIG_IDENT_STRING		" LS2085A-EMU"
-#define CONFIG_BOOTP_VCI_STRING		"U-boot.LS2085A-EMU"
+#define CONFIG_BOOTP_VCI_STRING		"U-Boot.LS2085A-EMU"
 
 /* Flat Device Tree Definitions */
 #define CONFIG_OF_LIBFDT
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h
index 7fb28a5..d4ba4e9 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -38,7 +38,7 @@
 #define CONFIG_SYS_ICACHE_OFF
 
 #define CONFIG_IDENT_STRING		" vexpress_aemv8a"
-#define CONFIG_BOOTP_VCI_STRING		"U-boot.armv8.vexpress_aemv8a"
+#define CONFIG_BOOTP_VCI_STRING		"U-Boot.armv8.vexpress_aemv8a"
 
 /* Link Definitions */
 #ifdef CONFIG_TARGET_VEXPRESS64_BASE_FVP
diff --git a/include/configs/vexpress_ca15_tc2.h b/include/configs/vexpress_ca15_tc2.h
index b43afa2..3c9777f 100644
--- a/include/configs/vexpress_ca15_tc2.h
+++ b/include/configs/vexpress_ca15_tc2.h
@@ -13,7 +13,7 @@
 
 #define CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP
 #include "vexpress_common.h"
-#define CONFIG_BOOTP_VCI_STRING     "U-boot.armv7.vexpress_ca15x2_tc2"
+#define CONFIG_BOOTP_VCI_STRING     "U-Boot.armv7.vexpress_ca15x2_tc2"
 
 #define CONFIG_SYSFLAGS_ADDR	0x1c010030
 #define CONFIG_SMP_PEN_ADDR	CONFIG_SYSFLAGS_ADDR
diff --git a/include/configs/vexpress_ca5x2.h b/include/configs/vexpress_ca5x2.h
index 7719d59..6c160a5 100644
--- a/include/configs/vexpress_ca5x2.h
+++ b/include/configs/vexpress_ca5x2.h
@@ -13,6 +13,6 @@
 
 #define CONFIG_VEXPRESS_EXTENDED_MEMORY_MAP
 #include "vexpress_common.h"
-#define CONFIG_BOOTP_VCI_STRING     "U-boot.armv7.vexpress_ca5x2"
+#define CONFIG_BOOTP_VCI_STRING     "U-Boot.armv7.vexpress_ca5x2"
 
 #endif /* __VEXPRESS_CA5X2_h */
diff --git a/include/configs/vexpress_ca9x4.h b/include/configs/vexpress_ca9x4.h
index 38ac4ed..564521e 100644
--- a/include/configs/vexpress_ca9x4.h
+++ b/include/configs/vexpress_ca9x4.h
@@ -13,6 +13,6 @@
 
 #define CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
 #include "vexpress_common.h"
-#define CONFIG_BOOTP_VCI_STRING     "U-boot.armv7.vexpress_ca9x4"
+#define CONFIG_BOOTP_VCI_STRING     "U-Boot.armv7.vexpress_ca9x4"
 
 #endif /* VEXPRESS_CA9X4_H */
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 02/13] net: Fix eth_get_dev_by_name() warning
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:02   ` Joe Hershberger
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version Simon Glass
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

This can return either udevice or eth_device, so deal with either.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 net/eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/eth.c b/net/eth.c
index 3b3cd84..4d7f9a2 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -914,7 +914,7 @@ void eth_set_current(void)
 
 	if (act == NULL) {
 		char *ethprime = getenv("ethprime");
-		struct udevice *dev = NULL;
+		void *dev = NULL;
 
 		if (ethprime)
 			dev = eth_get_dev_by_name(ethprime);
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 02/13] net: Fix eth_get_dev_by_name() warning Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-03  8:34   ` Ian Campbell
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 04/13] Kconfig: Move CONFIG_DESIGNWARE_ETH to Kconfig Simon Glass
                   ` (10 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

We currently have Linksprite_pcDuino3 and Linksprite_pcDuino3_fdt. Drop the
former in favour of the latter.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 configs/Linksprite_pcDuino3_defconfig     |  9 +++++++++
 configs/Linksprite_pcDuino3_fdt_defconfig | 18 ------------------
 2 files changed, 9 insertions(+), 18 deletions(-)
 delete mode 100644 configs/Linksprite_pcDuino3_fdt_defconfig

diff --git a/configs/Linksprite_pcDuino3_defconfig b/configs/Linksprite_pcDuino3_defconfig
index 45d88f3..cf9e090 100644
--- a/configs/Linksprite_pcDuino3_defconfig
+++ b/configs/Linksprite_pcDuino3_defconfig
@@ -1,9 +1,18 @@
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI"
 CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb"
+CONFIG_DM=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3"
+CONFIG_OF_CONTROL=y
+CONFIG_SPL_DISABLE_OF_CONTROL=y
+CONFIG_OF_SEPARATE=y
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
 +S:CONFIG_MACH_SUN7I=y
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=122
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_SYS_MALLOC_F=y
+CONFIG_SYS_MALLOC_F_LEN=0x400
diff --git a/configs/Linksprite_pcDuino3_fdt_defconfig b/configs/Linksprite_pcDuino3_fdt_defconfig
deleted file mode 100644
index cf9e090..0000000
--- a/configs/Linksprite_pcDuino3_fdt_defconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,AHCI,SATAPWR=SUNXI_GPH(2),USB_EHCI"
-CONFIG_FDTFILE="sun7i-a20-pcduino3.dtb"
-CONFIG_DM=y
-CONFIG_DM_GPIO=y
-CONFIG_DM_SERIAL=y
-CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-pcduino3"
-CONFIG_OF_CONTROL=y
-CONFIG_SPL_DISABLE_OF_CONTROL=y
-CONFIG_OF_SEPARATE=y
-+S:CONFIG_ARM=y
-+S:CONFIG_ARCH_SUNXI=y
-+S:CONFIG_MACH_SUN7I=y
-+S:CONFIG_DRAM_CLK=480
-+S:CONFIG_DRAM_ZQ=122
-+S:CONFIG_DRAM_EMR1=4
-CONFIG_SYS_MALLOC_F=y
-CONFIG_SYS_MALLOC_F_LEN=0x400
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 04/13] Kconfig: Move CONFIG_DESIGNWARE_ETH to Kconfig
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 02/13] net: Fix eth_get_dev_by_name() warning Simon Glass
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:08   ` Joe Hershberger
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings Simon Glass
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

Move this to Kconfig and clean up board config files that use it. Also
rename it to CONFIG_ETH_DESIGNWARE to fit with the naming that exists
in drivers/net/Kconfig.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/arm/cpu/arm926ejs/spear/cpu.c         | 2 +-
 arch/arm/cpu/armv7/socfpga/misc.c          | 2 +-
 board/bf609-ezkit/bf609-ezkit.c            | 2 +-
 board/spear/spear300/spear300.c            | 2 +-
 board/spear/spear310/spear310.c            | 2 +-
 board/spear/spear320/spear320.c            | 2 +-
 board/spear/spear600/spear600.c            | 2 +-
 board/st/stv0991/stv0991.c                 | 2 +-
 configs/A20-OLinuXino-Lime2_defconfig      | 3 +++
 configs/A20-OLinuXino-Lime_defconfig       | 3 +++
 configs/A20-OLinuXino_MICRO_defconfig      | 3 +++
 configs/Bananapi_defconfig                 | 3 +++
 configs/Bananapro_defconfig                | 3 +++
 configs/CSQ_CS908_defconfig                | 3 +++
 configs/Colombus_defconfig                 | 3 +++
 configs/Cubieboard2_defconfig              | 3 +++
 configs/Cubietruck_defconfig               | 3 +++
 configs/Hummingbird_A31_defconfig          | 3 +++
 configs/Linksprite_pcDuino3_Nano_defconfig | 3 +++
 configs/Linksprite_pcDuino3_defconfig      | 3 +++
 configs/Mele_M3_defconfig                  | 3 +++
 configs/Mele_M5_defconfig                  | 3 +++
 configs/Mele_M9_defconfig                  | 3 +++
 configs/axs101_defconfig                   | 5 ++++-
 configs/axs103_defconfig                   | 3 +++
 configs/bf609-ezkit_defconfig              | 3 +++
 configs/i12-tvbox_defconfig                | 3 +++
 configs/socfpga_cyclone5_defconfig         | 3 +++
 configs/socfpga_socrates_defconfig         | 3 +++
 configs/spear300_defconfig                 | 3 +++
 configs/spear300_nand_defconfig            | 3 +++
 configs/spear300_usbtty_defconfig          | 3 +++
 configs/spear300_usbtty_nand_defconfig     | 3 +++
 configs/spear310_defconfig                 | 3 +++
 configs/spear310_nand_defconfig            | 3 +++
 configs/spear310_pnor_defconfig            | 3 +++
 configs/spear310_usbtty_defconfig          | 3 +++
 configs/spear310_usbtty_nand_defconfig     | 3 +++
 configs/spear310_usbtty_pnor_defconfig     | 3 +++
 configs/spear320_defconfig                 | 3 +++
 configs/spear320_nand_defconfig            | 3 +++
 configs/spear320_pnor_defconfig            | 3 +++
 configs/spear320_usbtty_defconfig          | 3 +++
 configs/spear320_usbtty_nand_defconfig     | 3 +++
 configs/spear320_usbtty_pnor_defconfig     | 3 +++
 configs/spear600_defconfig                 | 3 +++
 configs/spear600_nand_defconfig            | 3 +++
 configs/spear600_usbtty_defconfig          | 3 +++
 configs/spear600_usbtty_nand_defconfig     | 3 +++
 configs/stv0991_defconfig                  | 3 +++
 configs/tb100_defconfig                    | 3 +++
 configs/x600_defconfig                     | 3 +++
 drivers/net/Kconfig                        | 7 +++++++
 drivers/net/Makefile                       | 2 +-
 include/configs/axs101.h                   | 1 -
 include/configs/bf609-ezkit.h              | 1 -
 include/configs/socfpga_common.h           | 1 -
 include/configs/spear-common.h             | 1 -
 include/configs/stv0991.h                  | 1 -
 include/configs/sunxi-common.h             | 1 -
 include/configs/tb100.h                    | 1 -
 include/configs/x600.h                     | 1 -
 62 files changed, 149 insertions(+), 18 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c b/arch/arm/cpu/arm926ejs/spear/cpu.c
index 697e094..1ce9db7 100644
--- a/arch/arm/cpu/arm926ejs/spear/cpu.c
+++ b/arch/arm/cpu/arm926ejs/spear/cpu.c
@@ -32,7 +32,7 @@ int arch_cpu_init(void)
 	periph_clk_cfg |= CONFIG_SPEAR_UART48M;
 	writel(periph_clk_cfg, &misc_p->periph_clk_cfg);
 #endif
-#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_ETH_DESIGNWARE)
 	periph1_clken |= MISC_ETHENB;
 #endif
 #if defined(CONFIG_DW_UDC)
diff --git a/arch/arm/cpu/armv7/socfpga/misc.c b/arch/arm/cpu/armv7/socfpga/misc.c
index 7873c38..0f8b4d0 100644
--- a/arch/arm/cpu/armv7/socfpga/misc.c
+++ b/arch/arm/cpu/armv7/socfpga/misc.c
@@ -49,7 +49,7 @@ void enable_caches(void)
 /*
  * DesignWare Ethernet initialization
  */
-#ifdef CONFIG_DESIGNWARE_ETH
+#ifdef CONFIG_ETH_DESIGNWARE
 int cpu_eth_init(bd_t *bis)
 {
 #if CONFIG_EMAC_BASE == SOCFPGA_EMAC0_ADDRESS
diff --git a/board/bf609-ezkit/bf609-ezkit.c b/board/bf609-ezkit/bf609-ezkit.c
index 43a4330..86da028 100644
--- a/board/bf609-ezkit/bf609-ezkit.c
+++ b/board/bf609-ezkit/bf609-ezkit.c
@@ -33,7 +33,7 @@ int board_early_init_f(void)
 	return 0;
 }
 
-#ifdef CONFIG_DESIGNWARE_ETH
+#ifdef CONFIG_ETH_DESIGNWARE
 int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c
index 6b6bd9f..396b5bd 100644
--- a/board/spear/spear300/spear300.c
+++ b/board/spear/spear300/spear300.c
@@ -51,7 +51,7 @@ int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
 
-#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_ETH_DESIGNWARE)
 	u32 interface = PHY_INTERFACE_MODE_MII;
 	if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
 		ret++;
diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c
index a4c6a8e..6f39ef1 100644
--- a/board/spear/spear310/spear310.c
+++ b/board/spear/spear310/spear310.c
@@ -52,7 +52,7 @@ int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
 
-#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_ETH_DESIGNWARE)
 	u32 interface = PHY_INTERFACE_MODE_MII;
 	if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
 		ret++;
diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c
index ab732a7..52196af 100644
--- a/board/spear/spear320/spear320.c
+++ b/board/spear/spear320/spear320.c
@@ -63,7 +63,7 @@ int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
 
-#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_ETH_DESIGNWARE)
 	u32 interface = PHY_INTERFACE_MODE_MII;
 	if (designware_initialize(CONFIG_SPEAR_ETHBASE, interface) >= 0)
 		ret++;
diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c
index 8472002..fc0918f 100644
--- a/board/spear/spear600/spear600.c
+++ b/board/spear/spear600/spear600.c
@@ -46,7 +46,7 @@ int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
 
-#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_ETH_DESIGNWARE)
 	u32 interface = PHY_INTERFACE_MODE_MII;
 #if defined(CONFIG_DW_AUTONEG)
 	interface = PHY_INTERFACE_MODE_GMII;
diff --git a/board/st/stv0991/stv0991.c b/board/st/stv0991/stv0991.c
index f465699..38f6e1d 100644
--- a/board/st/stv0991/stv0991.c
+++ b/board/st/stv0991/stv0991.c
@@ -94,7 +94,7 @@ int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
 
-#if defined(CONFIG_DESIGNWARE_ETH)
+#if defined(CONFIG_ETH_DESIGNWARE)
 	u32 interface = PHY_INTERFACE_MODE_MII;
 	if (designware_initialize(GMAC_BASE_ADDR, interface) >= 0)
 		ret++;
diff --git a/configs/A20-OLinuXino-Lime2_defconfig b/configs/A20-OLinuXino-Lime2_defconfig
index ff94e77..516597e 100644
--- a/configs/A20-OLinuXino-Lime2_defconfig
+++ b/configs/A20-OLinuXino-Lime2_defconfig
@@ -7,3 +7,6 @@ CONFIG_FDTFILE="sun7i-a20-olinuxino-lime2.dtb"
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/A20-OLinuXino-Lime_defconfig b/configs/A20-OLinuXino-Lime_defconfig
index 5442f64..c86eda5 100644
--- a/configs/A20-OLinuXino-Lime_defconfig
+++ b/configs/A20-OLinuXino-Lime_defconfig
@@ -7,3 +7,6 @@ CONFIG_FDTFILE="sun7i-a20-olinuxino-lime.dtb"
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/A20-OLinuXino_MICRO_defconfig b/configs/A20-OLinuXino_MICRO_defconfig
index 97a21ee..00d93e8 100644
--- a/configs/A20-OLinuXino_MICRO_defconfig
+++ b/configs/A20-OLinuXino_MICRO_defconfig
@@ -11,3 +11,6 @@ CONFIG_VIDEO_VGA=y
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Bananapi_defconfig b/configs/Bananapi_defconfig
index 5aba938..78431db 100644
--- a/configs/Bananapi_defconfig
+++ b/configs/Bananapi_defconfig
@@ -8,3 +8,6 @@ CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Bananapro_defconfig b/configs/Bananapro_defconfig
index e501b5c..696daa6 100644
--- a/configs/Bananapro_defconfig
+++ b/configs/Bananapro_defconfig
@@ -10,3 +10,6 @@ CONFIG_GMAC_TX_DELAY=3
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/CSQ_CS908_defconfig b/configs/CSQ_CS908_defconfig
index 4040bee..5d42272 100644
--- a/configs/CSQ_CS908_defconfig
+++ b/configs/CSQ_CS908_defconfig
@@ -13,3 +13,6 @@ CONFIG_FDTFILE="sun6i-a31s-cs908.dtb"
 # No Vbus gpio for either usb
 +S:CONFIG_USB1_VBUS_PIN=""
 +S:CONFIG_USB2_VBUS_PIN=""
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Colombus_defconfig b/configs/Colombus_defconfig
index 33edcc4..af823e1 100644
--- a/configs/Colombus_defconfig
+++ b/configs/Colombus_defconfig
@@ -10,3 +10,6 @@ CONFIG_FDTFILE="sun6i-a31-colombus.dtb"
 +S:CONFIG_AXP221_ALDO1_VOLT=3300
 # No Vbus gpio for usb1
 +S:CONFIG_USB1_VBUS_PIN=""
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Cubieboard2_defconfig b/configs/Cubieboard2_defconfig
index 7704a0e..fcc9423 100644
--- a/configs/Cubieboard2_defconfig
+++ b/configs/Cubieboard2_defconfig
@@ -7,3 +7,6 @@ CONFIG_FDTFILE="sun7i-a20-cubieboard2.dtb"
 +S:CONFIG_DRAM_CLK=480
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Cubietruck_defconfig b/configs/Cubietruck_defconfig
index b64f84f..d267128 100644
--- a/configs/Cubietruck_defconfig
+++ b/configs/Cubietruck_defconfig
@@ -8,3 +8,6 @@ CONFIG_VIDEO_VGA=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Hummingbird_A31_defconfig b/configs/Hummingbird_A31_defconfig
index 0275463..ac0ab05 100644
--- a/configs/Hummingbird_A31_defconfig
+++ b/configs/Hummingbird_A31_defconfig
@@ -14,3 +14,6 @@ CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN="PH25"
 +S:CONFIG_USB1_VBUS_PIN="PH24"
 # No Vbus gpio for usb2
 +S:CONFIG_USB2_VBUS_PIN=""
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Linksprite_pcDuino3_Nano_defconfig b/configs/Linksprite_pcDuino3_Nano_defconfig
index 4baba14..f8d9659 100644
--- a/configs/Linksprite_pcDuino3_Nano_defconfig
+++ b/configs/Linksprite_pcDuino3_Nano_defconfig
@@ -9,3 +9,6 @@ CONFIG_USB1_VBUS_PIN="PH11"
 +S:CONFIG_DRAM_CLK=408
 +S:CONFIG_DRAM_ZQ=122
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Linksprite_pcDuino3_defconfig b/configs/Linksprite_pcDuino3_defconfig
index cf9e090..b5ff120 100644
--- a/configs/Linksprite_pcDuino3_defconfig
+++ b/configs/Linksprite_pcDuino3_defconfig
@@ -16,3 +16,6 @@ CONFIG_OF_SEPARATE=y
 +S:CONFIG_DRAM_EMR1=4
 CONFIG_SYS_MALLOC_F=y
 CONFIG_SYS_MALLOC_F_LEN=0x400
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Mele_M3_defconfig b/configs/Mele_M3_defconfig
index 723a72a..4331368 100644
--- a/configs/Mele_M3_defconfig
+++ b/configs/Mele_M3_defconfig
@@ -10,3 +10,6 @@ CONFIG_VIDEO_VGA=y
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Mele_M5_defconfig b/configs/Mele_M5_defconfig
index 2e1f80d..2712508 100644
--- a/configs/Mele_M5_defconfig
+++ b/configs/Mele_M5_defconfig
@@ -11,3 +11,6 @@ CONFIG_VIDEO_HDMI=y
 +S:CONFIG_DRAM_CLK=432
 +S:CONFIG_DRAM_ZQ=122
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/Mele_M9_defconfig b/configs/Mele_M9_defconfig
index eaf9a7e..2ed2274 100644
--- a/configs/Mele_M9_defconfig
+++ b/configs/Mele_M9_defconfig
@@ -18,3 +18,6 @@ CONFIG_FDTFILE="sun6i-a31-m9.dtb"
 +S:CONFIG_USB1_VBUS_PIN="PC27"
 # No Vbus gpio for usb2
 +S:CONFIG_USB2_VBUS_PIN=""
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/axs101_defconfig b/configs/axs101_defconfig
index 34ed963..9ef04df 100644
--- a/configs/axs101_defconfig
+++ b/configs/axs101_defconfig
@@ -3,4 +3,7 @@ CONFIG_TARGET_AXS101=y
 CONFIG_SYS_CLK_FREQ=750000000
 CONFIG_ARC_CACHE_LINE_SHIFT=5
 CONFIG_SYS_DCACHE_OFF=y
-CONFIG_SYS_TEXT_BASE=0x81000000
\ No newline at end of file
+CONFIG_SYS_TEXT_BASE=0x81000000
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/axs103_defconfig b/configs/axs103_defconfig
index c63dd4a..3f7b21f 100644
--- a/configs/axs103_defconfig
+++ b/configs/axs103_defconfig
@@ -3,3 +3,6 @@ CONFIG_SYS_CLK_FREQ=50000000
 CONFIG_ARC=y
 CONFIG_ISA_ARCV2=y
 CONFIG_TARGET_AXS101=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/bf609-ezkit_defconfig b/configs/bf609-ezkit_defconfig
index 2bfb6a5..96f746e 100644
--- a/configs/bf609-ezkit_defconfig
+++ b/configs/bf609-ezkit_defconfig
@@ -1,2 +1,5 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF609_EZKIT=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/i12-tvbox_defconfig b/configs/i12-tvbox_defconfig
index 41192fc..a95a5a5 100644
--- a/configs/i12-tvbox_defconfig
+++ b/configs/i12-tvbox_defconfig
@@ -7,3 +7,6 @@ CONFIG_FDTFILE="sun7i-a20-i12-tvbox.dtb"
 +S:CONFIG_DRAM_CLK=384
 +S:CONFIG_DRAM_ZQ=127
 +S:CONFIG_DRAM_EMR1=4
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/socfpga_cyclone5_defconfig b/configs/socfpga_cyclone5_defconfig
index 4b2ede4..1f9a58e 100644
--- a/configs/socfpga_cyclone5_defconfig
+++ b/configs/socfpga_cyclone5_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SPL=y
 +S:CONFIG_ARM=y
 +S:CONFIG_TARGET_SOCFPGA_CYCLONE5=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/socfpga_socrates_defconfig b/configs/socfpga_socrates_defconfig
index f2ddc31..7490e21 100644
--- a/configs/socfpga_socrates_defconfig
+++ b/configs/socfpga_socrates_defconfig
@@ -7,3 +7,6 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_cyclone5_socrates"
 CONFIG_DM=y
 CONFIG_DM_SPI=y
 CONFIG_DM_SPI_FLASH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear300_defconfig b/configs/spear300_defconfig
index 25a08df..df0b190 100644
--- a/configs/spear300_defconfig
+++ b/configs/spear300_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear300"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR300=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear300_nand_defconfig b/configs/spear300_nand_defconfig
index a4b70e8..a49492c 100644
--- a/configs/spear300_nand_defconfig
+++ b/configs/spear300_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear300,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR300=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear300_usbtty_defconfig b/configs/spear300_usbtty_defconfig
index d750cf4..3d60d7f 100644
--- a/configs/spear300_usbtty_defconfig
+++ b/configs/spear300_usbtty_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear300,usbtty"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR300=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear300_usbtty_nand_defconfig b/configs/spear300_usbtty_nand_defconfig
index 8bafdb5..ffe4f59 100644
--- a/configs/spear300_usbtty_nand_defconfig
+++ b/configs/spear300_usbtty_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear300,usbtty,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR300=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear310_defconfig b/configs/spear310_defconfig
index 8a9ec85..16a6bc3 100644
--- a/configs/spear310_defconfig
+++ b/configs/spear310_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear310"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR310=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear310_nand_defconfig b/configs/spear310_nand_defconfig
index 1439ac5..05e3c96 100644
--- a/configs/spear310_nand_defconfig
+++ b/configs/spear310_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear310,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR310=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear310_pnor_defconfig b/configs/spear310_pnor_defconfig
index 19604b3..384cb54 100644
--- a/configs/spear310_pnor_defconfig
+++ b/configs/spear310_pnor_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear310,FLASH_PNOR"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR310=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear310_usbtty_defconfig b/configs/spear310_usbtty_defconfig
index 6342a56..0115f2c 100644
--- a/configs/spear310_usbtty_defconfig
+++ b/configs/spear310_usbtty_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear310,usbtty"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR310=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear310_usbtty_nand_defconfig b/configs/spear310_usbtty_nand_defconfig
index 5b9f1f6..2d82b66 100644
--- a/configs/spear310_usbtty_nand_defconfig
+++ b/configs/spear310_usbtty_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear310,usbtty,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR310=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear310_usbtty_pnor_defconfig b/configs/spear310_usbtty_pnor_defconfig
index 0567936..579df36 100644
--- a/configs/spear310_usbtty_pnor_defconfig
+++ b/configs/spear310_usbtty_pnor_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear310,usbtty,FLASH_PNOR"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR310=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear320_defconfig b/configs/spear320_defconfig
index 3d91bb1..7bd51a8 100644
--- a/configs/spear320_defconfig
+++ b/configs/spear320_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear320"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR320=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear320_nand_defconfig b/configs/spear320_nand_defconfig
index fd0f908..d7c995c 100644
--- a/configs/spear320_nand_defconfig
+++ b/configs/spear320_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear320,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR320=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear320_pnor_defconfig b/configs/spear320_pnor_defconfig
index 6cce316..a56a4e0 100644
--- a/configs/spear320_pnor_defconfig
+++ b/configs/spear320_pnor_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear320,FLASH_PNOR"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR320=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear320_usbtty_defconfig b/configs/spear320_usbtty_defconfig
index 7ad3d84..c2fb481 100644
--- a/configs/spear320_usbtty_defconfig
+++ b/configs/spear320_usbtty_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear320,usbtty"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR320=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear320_usbtty_nand_defconfig b/configs/spear320_usbtty_nand_defconfig
index a5ad90b..98368ed 100644
--- a/configs/spear320_usbtty_nand_defconfig
+++ b/configs/spear320_usbtty_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear320,usbtty,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR320=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear320_usbtty_pnor_defconfig b/configs/spear320_usbtty_pnor_defconfig
index 6b110ef..e428d25 100644
--- a/configs/spear320_usbtty_pnor_defconfig
+++ b/configs/spear320_usbtty_pnor_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear320,usbtty,FLASH_PNOR"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR320=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear600_defconfig b/configs/spear600_defconfig
index f1cb0aa..dae0d59 100644
--- a/configs/spear600_defconfig
+++ b/configs/spear600_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear600"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR600=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear600_nand_defconfig b/configs/spear600_nand_defconfig
index 172c187..cdd98fc 100644
--- a/configs/spear600_nand_defconfig
+++ b/configs/spear600_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear600,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR600=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear600_usbtty_defconfig b/configs/spear600_usbtty_defconfig
index cf8b0ec..1e28edf 100644
--- a/configs/spear600_usbtty_defconfig
+++ b/configs/spear600_usbtty_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear600,usbtty"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR600=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/spear600_usbtty_nand_defconfig b/configs/spear600_usbtty_nand_defconfig
index 8bd2f07..2f8fd5e 100644
--- a/configs/spear600_usbtty_nand_defconfig
+++ b/configs/spear600_usbtty_nand_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SYS_EXTRA_OPTIONS="spear600,usbtty,nand"
 CONFIG_ARM=y
 CONFIG_TARGET_SPEAR600=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/stv0991_defconfig b/configs/stv0991_defconfig
index 1c9ba88..7e1fd37 100644
--- a/configs/stv0991_defconfig
+++ b/configs/stv0991_defconfig
@@ -5,3 +5,6 @@ CONFIG_SYS_MALLOC_F=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_DM=y
 CONFIG_DM_SERIAL=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/tb100_defconfig b/configs/tb100_defconfig
index b0e8c9f..a6351fa 100644
--- a/configs/tb100_defconfig
+++ b/configs/tb100_defconfig
@@ -3,3 +3,6 @@ CONFIG_TARGET_TB100=y
 CONFIG_SYS_CLK_FREQ=500000000
 CONFIG_ARC_CACHE_LINE_SHIFT=5
 CONFIG_SYS_TEXT_BASE=0x84000000
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/configs/x600_defconfig b/configs/x600_defconfig
index cb66890..48790ef 100644
--- a/configs/x600_defconfig
+++ b/configs/x600_defconfig
@@ -1,3 +1,6 @@
 CONFIG_SPL=y
 +S:CONFIG_ARM=y
 +S:CONFIG_TARGET_X600=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index dcbfa8a..94e35d6 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -25,4 +25,11 @@ config ETH_SANDBOX_RAW
 	default y
 	bool "Sandbox: Bridge to Linux Raw Sockets"
 
+config ETH_DESIGNWARE
+	bool "Synopsys Designware Ethernet MAC"
+	help
+	  This MAC is present in SoCs from various vendors. It supports
+	  100Mbit and 1 Gbit operation. You must enable CONFIG_PHYLIB to
+	  provide the PHY (physical media interface).
+
 endif # NETDEVICES
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 6c3abf1..e7de1c4 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -16,7 +16,7 @@ obj-$(CONFIG_BFIN_MAC) += bfin_mac.o
 obj-$(CONFIG_CALXEDA_XGMAC) += calxedaxgmac.o
 obj-$(CONFIG_CS8900) += cs8900.o
 obj-$(CONFIG_TULIP) += dc2114x.o
-obj-$(CONFIG_DESIGNWARE_ETH) += designware.o
+obj-$(CONFIG_ETH_DESIGNWARE) += designware.o
 obj-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 obj-$(CONFIG_DNET) += dnet.o
 obj-$(CONFIG_E1000) += e1000.o
diff --git a/include/configs/axs101.h b/include/configs/axs101.h
index 5fb8aca..ed63048 100644
--- a/include/configs/axs101.h
+++ b/include/configs/axs101.h
@@ -110,7 +110,6 @@
 /*
  * Ethernet configuration
  */
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_DW_AUTONEG
 #define CONFIG_NET_MULTI
 
diff --git a/include/configs/bf609-ezkit.h b/include/configs/bf609-ezkit.h
index 878009f..7507d57 100644
--- a/include/configs/bf609-ezkit.h
+++ b/include/configs/bf609-ezkit.h
@@ -71,7 +71,6 @@
 #define CONFIG_NETCONSOLE
 #define CONFIG_NET_MULTI
 #define CONFIG_HOSTNAME		"bf609-ezkit"
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_PHY_ADDR		1
 #define CONFIG_DW_PORTS		1
 #define CONFIG_DW_ALTDESCRIPTOR
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index ee227fe..e263980 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -100,7 +100,6 @@
  * Ethernet on SoC (EMAC)
  */
 #if defined(CONFIG_CMD_NET) && !defined(CONFIG_SOCFPGA_VIRTUAL_TARGET)
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_NET_MULTI
 #define CONFIG_DW_ALTDESCRIPTOR
 #define CONFIG_MII
diff --git a/include/configs/spear-common.h b/include/configs/spear-common.h
index a11f4ed..3d7ccbe 100644
--- a/include/configs/spear-common.h
+++ b/include/configs/spear-common.h
@@ -16,7 +16,6 @@
 
 /* Ethernet driver configuration */
 #define CONFIG_MII
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_NET_MULTI
 #define CONFIG_PHYLIB
 #define CONFIG_PHY_RESET_DELAY			10000		/* in usec */
diff --git a/include/configs/stv0991.h b/include/configs/stv0991.h
index 156e0fa..ab1e61c 100644
--- a/include/configs/stv0991.h
+++ b/include/configs/stv0991.h
@@ -55,7 +55,6 @@
 #define CONFIG_MII
 #define CONFIG_PHYLIB
 #define CONFIG_CMD_NET
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_DW_ALTDESCRIPTOR
 #define CONFIG_PHY_MICREL
 
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index bd7d049..3dd4bd6 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -281,7 +281,6 @@ extern int soft_i2c_gpio_scl;
 #endif
 
 #ifdef CONFIG_SUNXI_GMAC
-#define CONFIG_DESIGNWARE_ETH		/* GMAC can use designware driver */
 #define CONFIG_DW_AUTONEG
 #define CONFIG_PHY_GIGE			/* GMAC can use gigabit PHY	*/
 #define CONFIG_PHY_ADDR		1
diff --git a/include/configs/tb100.h b/include/configs/tb100.h
index 46df406..bc69f1d 100644
--- a/include/configs/tb100.h
+++ b/include/configs/tb100.h
@@ -66,7 +66,6 @@
 /*
  * Ethernet configuration
  */
-#define CONFIG_DESIGNWARE_ETH
 #define ETH0_BASE_ADDRESS		0xFE100000
 #define ETH1_BASE_ADDRESS		0xFE110000
 
diff --git a/include/configs/x600.h b/include/configs/x600.h
index 04187c0..44a8e8f 100644
--- a/include/configs/x600.h
+++ b/include/configs/x600.h
@@ -73,7 +73,6 @@
 
 /* Ethernet config options */
 #define CONFIG_MII
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_NET_MULTI
 #define CONFIG_PHYLIB
 #define CONFIG_PHY_RESET_DELAY			10000		/* in usec */
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (2 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 04/13] Kconfig: Move CONFIG_DESIGNWARE_ETH to Kconfig Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-03  8:36   ` Ian Campbell
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 06/13] dm: core: Support allocating driver-private data for DMA Simon Glass
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

Since we will use these bindings on sunxi, bring them in from Linux
4.0-rc1.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 .../net/allwinner,sun4i-emac.txt                   | 19 +++++++
 .../net/allwinner,sun4i-mdio.txt                   | 27 ++++++++++
 .../net/allwinner,sun7i-a20-gmac.txt               | 27 ++++++++++
 doc/device-tree-bindings/net/ethernet.txt          | 25 +++++++++
 doc/device-tree-bindings/net/stmmac.txt            | 63 ++++++++++++++++++++++
 5 files changed, 161 insertions(+)
 create mode 100644 doc/device-tree-bindings/net/allwinner,sun4i-emac.txt
 create mode 100644 doc/device-tree-bindings/net/allwinner,sun4i-mdio.txt
 create mode 100644 doc/device-tree-bindings/net/allwinner,sun7i-a20-gmac.txt
 create mode 100644 doc/device-tree-bindings/net/ethernet.txt
 create mode 100644 doc/device-tree-bindings/net/stmmac.txt

diff --git a/doc/device-tree-bindings/net/allwinner,sun4i-emac.txt b/doc/device-tree-bindings/net/allwinner,sun4i-emac.txt
new file mode 100644
index 0000000..10640b1
--- /dev/null
+++ b/doc/device-tree-bindings/net/allwinner,sun4i-emac.txt
@@ -0,0 +1,19 @@
+* Allwinner EMAC ethernet controller
+
+Required properties:
+- compatible: should be "allwinner,sun4i-a10-emac" (Deprecated:
+              "allwinner,sun4i-emac")
+- reg: address and length of the register set for the device.
+- interrupts: interrupt for the device
+- phy: see ethernet.txt file in the same directory.
+- clocks: A phandle to the reference clock for this device
+
+Example:
+
+emac: ethernet at 01c0b000 {
+       compatible = "allwinner,sun4i-a10-emac";
+       reg = <0x01c0b000 0x1000>;
+       interrupts = <55>;
+       clocks = <&ahb_gates 17>;
+       phy = <&phy0>;
+};
diff --git a/doc/device-tree-bindings/net/allwinner,sun4i-mdio.txt b/doc/device-tree-bindings/net/allwinner,sun4i-mdio.txt
new file mode 100644
index 0000000..4ec5641
--- /dev/null
+++ b/doc/device-tree-bindings/net/allwinner,sun4i-mdio.txt
@@ -0,0 +1,27 @@
+* Allwinner A10 MDIO Ethernet Controller interface
+
+Required properties:
+- compatible: should be "allwinner,sun4i-a10-mdio"
+              (Deprecated: "allwinner,sun4i-mdio").
+- reg: address and length of the register set for the device.
+
+Optional properties:
+- phy-supply: phandle to a regulator if the PHY needs one
+
+Example at the SoC level:
+mdio at 01c0b080 {
+	compatible = "allwinner,sun4i-a10-mdio";
+	reg = <0x01c0b080 0x14>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+};
+
+And at the board level:
+
+mdio at 01c0b080 {
+	phy-supply = <&reg_emac_3v3>;
+
+	phy0: ethernet-phy at 0 {
+		reg = <0>;
+	};
+};
diff --git a/doc/device-tree-bindings/net/allwinner,sun7i-a20-gmac.txt b/doc/device-tree-bindings/net/allwinner,sun7i-a20-gmac.txt
new file mode 100644
index 0000000..ea4d752
--- /dev/null
+++ b/doc/device-tree-bindings/net/allwinner,sun7i-a20-gmac.txt
@@ -0,0 +1,27 @@
+* Allwinner GMAC ethernet controller
+
+This device is a platform glue layer for stmmac.
+Please see stmmac.txt for the other unchanged properties.
+
+Required properties:
+ - compatible:  Should be "allwinner,sun7i-a20-gmac"
+ - clocks: Should contain the GMAC main clock, and tx clock
+   The tx clock type should be "allwinner,sun7i-a20-gmac-clk"
+ - clock-names: Should contain the clock names "stmmaceth",
+   and "allwinner_gmac_tx"
+
+Optional properties:
+- phy-supply: phandle to a regulator if the PHY needs one
+
+Examples:
+
+	gmac: ethernet at 01c50000 {
+		compatible = "allwinner,sun7i-a20-gmac";
+		reg = <0x01c50000 0x10000>,
+		      <0x01c20164 0x4>;
+		interrupts = <0 85 1>;
+		interrupt-names = "macirq";
+		clocks = <&ahb_gates 49>, <&gmac_tx>;
+		clock-names = "stmmaceth", "allwinner_gmac_tx";
+		phy-mode = "mii";
+	};
diff --git a/doc/device-tree-bindings/net/ethernet.txt b/doc/device-tree-bindings/net/ethernet.txt
new file mode 100644
index 0000000..3fc3605
--- /dev/null
+++ b/doc/device-tree-bindings/net/ethernet.txt
@@ -0,0 +1,25 @@
+The following properties are common to the Ethernet controllers:
+
+- local-mac-address: array of 6 bytes, specifies the MAC address that was
+  assigned to the network device;
+- mac-address: array of 6 bytes, specifies the MAC address that was last used by
+  the boot program; should be used in cases where the MAC address assigned to
+  the device by the boot program is different from the "local-mac-address"
+  property;
+- max-speed: number, specifies maximum speed in Mbit/s supported by the device;
+- max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than
+  the maximum frame size (there's contradiction in ePAPR).
+- phy-mode: string, operation mode of the PHY interface; supported values are
+  "mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id",
+  "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto
+  standard property;
+- phy-connection-type: the same as "phy-mode" property but described in ePAPR;
+- phy-handle: phandle, specifies a reference to a node representing a PHY
+  device; this property is described in ePAPR and so preferred;
+- phy: the same as "phy-handle" property, not recommended for new bindings.
+- phy-device: the same as "phy-handle" property, not recommended for new
+  bindings.
+
+Child nodes of the Ethernet controller are typically the individual PHY devices
+connected via the MDIO bus (sometimes the MDIO bus controller is separate).
+They are described in the phy.txt file in this same directory.
diff --git a/doc/device-tree-bindings/net/stmmac.txt b/doc/device-tree-bindings/net/stmmac.txt
new file mode 100644
index 0000000..5f02517
--- /dev/null
+++ b/doc/device-tree-bindings/net/stmmac.txt
@@ -0,0 +1,63 @@
+* STMicroelectronics 10/100/1000 Ethernet driver (GMAC)
+
+Required properties:
+- compatible: Should be "snps,dwmac-<ip_version>" "snps,dwmac"
+	For backwards compatibility: "st,spear600-gmac" is also supported.
+- reg: Address and length of the register set for the device
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupts: Should contain the STMMAC interrupts
+- interrupt-names: Should contain the interrupt names "macirq"
+  "eth_wake_irq" if this interrupt is supported in the "interrupts"
+  property
+- phy-mode: See ethernet.txt file in the same directory.
+- snps,reset-gpio	gpio number for phy reset.
+- snps,reset-active-low boolean flag to indicate if phy reset is active low.
+- snps,reset-delays-us  is triplet of delays
+	The 1st cell is reset pre-delay in micro seconds.
+	The 2nd cell is reset pulse in micro seconds.
+	The 3rd cell is reset post-delay in micro seconds.
+- snps,pbl		Programmable Burst Length
+- snps,fixed-burst	Program the DMA to use the fixed burst mode
+- snps,mixed-burst	Program the DMA to use the mixed burst mode
+- snps,force_thresh_dma_mode	Force DMA to use the threshold mode for
+				both tx and rx
+- snps,force_sf_dma_mode	Force DMA to use the Store and Forward
+				mode for both tx and rx. This flag is
+				ignored if force_thresh_dma_mode is set.
+- snps,multicast-filter-bins:	Number of multicast filter hash bins
+				supported by this device instance
+- snps,perfect-filter-entries:	Number of perfect filter entries supported
+				by this device instance
+
+Optional properties:
+- resets: Should contain a phandle to the STMMAC reset signal, if any
+- reset-names: Should contain the reset signal name "stmmaceth", if a
+	reset phandle is given
+- max-frame-size: See ethernet.txt file in the same directory
+- clocks: If present, the first clock should be the GMAC main clock,
+  further clocks may be specified in derived bindings.
+- clock-names: One name for each entry in the clocks property, the
+  first one should be "stmmaceth".
+- clk_ptp_ref: this is the PTP reference clock; in case of the PTP is
+  available this clock is used for programming the Timestamp Addend Register.
+  If not passed then the system clock will be used and this is fine on some
+  platforms.
+- snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register.
+
+Examples:
+
+	gmac0: ethernet at e0800000 {
+		compatible = "st,spear600-gmac";
+		reg = <0xe0800000 0x8000>;
+		interrupt-parent = <&vic1>;
+		interrupts = <24 23>;
+		interrupt-names = "macirq", "eth_wake_irq";
+		mac-address = [000000000000]; /* Filled in by U-Boot */
+		max-frame-size = <3800>;
+		phy-mode = "gmii";
+		snps,multicast-filter-bins = <256>;
+		snps,perfect-filter-entries = <128>;
+		clocks = <&clock>;
+		clock-names = "stmmaceth";
+	};
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 06/13] dm: core: Support allocating driver-private data for DMA
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (3 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 07/13] dm: net: Use existing Ethernet init for driver model Simon Glass
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

Some driver want to put DMA buffers in their private data. Add a flag
to tell driver model to align driver-private data to a cache boundary so
that DMA will work correctly in this case.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/core/device.c | 11 ++++++++++-
 include/dm/device.h   |  3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 37dc882..b7a5654 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -190,7 +190,16 @@ int device_probe_child(struct udevice *dev, void *parent_priv)
 
 	/* Allocate private data if requested */
 	if (drv->priv_auto_alloc_size) {
-		dev->priv = calloc(1, drv->priv_auto_alloc_size);
+		if (drv->flags & DM_FLAG_ALLOC_PRIV_DMA) {
+			dev->priv = memalign(ARCH_DMA_MINALIGN,
+					     drv->priv_auto_alloc_size);
+			if (dev->priv) {
+				memset(dev->priv, '\0',
+				       drv->priv_auto_alloc_size);
+			}
+		} else {
+			dev->priv = calloc(1, drv->priv_auto_alloc_size);
+		}
 		if (!dev->priv) {
 			ret = -ENOMEM;
 			goto fail;
diff --git a/include/dm/device.h b/include/dm/device.h
index 7a48eb8..7f810ed 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -30,6 +30,9 @@ struct driver_info;
 /* DM is responsible for allocating and freeing parent_platdata */
 #define DM_FLAG_ALLOC_PARENT_PDATA	(1 << 3)
 
+/* Allocate driver private data on a DMA boundary */
+#define DM_FLAG_ALLOC_PRIV_DMA	(1 << 4)
+
 /**
  * struct udevice - An instance of a driver
  *
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 07/13] dm: net: Use existing Ethernet init for driver model
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (4 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 06/13] dm: core: Support allocating driver-private data for DMA Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:14   ` Joe Hershberger
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 08/13] Avoid calling print_eths() with " Simon Glass
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

At present even with driver model is used there is still much manual init
of related devices: PHY, environment and board init. Until these requirements
are dealt with in another way we need to keep them around.

Break out the init portion of the legacy eth_initialize() into a separate
function and call it from both the legacy and driver model eth_initialize()
functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 net/eth.c | 78 ++++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 42 insertions(+), 36 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index 4d7f9a2..cfb2c3d 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -79,6 +79,45 @@ static int eth_mac_skip(int index)
 
 static void eth_current_changed(void);
 
+/*
+ * CPU and board-specific Ethernet initializations.  Aliased function
+ * signals caller to move on
+ */
+static int __def_eth_init(bd_t *bis)
+{
+	return -1;
+}
+int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
+int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
+
+static void eth_common_init(void)
+{
+	bootstage_mark(BOOTSTAGE_ID_NET_ETH_START);
+#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
+	miiphy_init();
+#endif
+
+#ifdef CONFIG_PHYLIB
+	phy_init();
+#endif
+
+	eth_env_init();
+
+	/*
+	 * If board-specific initialization exists, call it.
+	 * If not, call a CPU-specific one
+	 */
+	if (board_eth_init != __def_eth_init) {
+		if (board_eth_init(gd->bd) < 0)
+			printf("Board Net Initialization Failed\n");
+	} else if (cpu_eth_init != __def_eth_init) {
+		if (cpu_eth_init(gd->bd) < 0)
+			printf("CPU Net Initialization Failed\n");
+	} else {
+		printf("Net Initialization Skipped\n");
+	}
+}
+
 #ifdef CONFIG_DM_ETH
 /**
  * struct eth_device_priv - private structure for each Ethernet device
@@ -327,8 +366,7 @@ int eth_initialize(void)
 	int num_devices = 0;
 	struct udevice *dev;
 
-	bootstage_mark(BOOTSTAGE_ID_NET_ETH_START);
-	eth_env_init();
+	eth_common_init();
 
 	/*
 	 * Devices need to write the hwaddr even if not started so that Linux
@@ -455,16 +493,6 @@ UCLASS_DRIVER(eth) = {
 #endif
 
 #ifndef CONFIG_DM_ETH
-/*
- * CPU and board-specific Ethernet initializations.  Aliased function
- * signals caller to move on
- */
-static int __def_eth_init(bd_t *bis)
-{
-	return -1;
-}
-int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
-int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
 
 #ifdef CONFIG_API
 static struct {
@@ -639,32 +667,10 @@ int eth_unregister(struct eth_device *dev)
 int eth_initialize(void)
 {
 	int num_devices = 0;
+
 	eth_devices = NULL;
 	eth_current = NULL;
-
-	bootstage_mark(BOOTSTAGE_ID_NET_ETH_START);
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
-	miiphy_init();
-#endif
-
-#ifdef CONFIG_PHYLIB
-	phy_init();
-#endif
-
-	eth_env_init();
-
-	/*
-	 * If board-specific initialization exists, call it.
-	 * If not, call a CPU-specific one
-	 */
-	if (board_eth_init != __def_eth_init) {
-		if (board_eth_init(gd->bd) < 0)
-			printf("Board Net Initialization Failed\n");
-	} else if (cpu_eth_init != __def_eth_init) {
-		if (cpu_eth_init(gd->bd) < 0)
-			printf("CPU Net Initialization Failed\n");
-	} else
-		printf("Net Initialization Skipped\n");
+	eth_common_init();
 
 	if (!eth_devices) {
 		puts("No ethernet found.\n");
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 08/13] Avoid calling print_eths() with driver model
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (5 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 07/13] dm: net: Use existing Ethernet init for driver model Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:23   ` Joe Hershberger
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 09/13] dm: net: Adjust PHY interface to work with CONFIG_DM_ETH Simon Glass
                   ` (5 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

This function is not supported with driver model.

Note: There is really no reason for this as far as I can see. At some point
we should bring it back.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/cmd_bdinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index b4cce25..f16d5c7 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -377,7 +377,7 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 		print_num("-> size",	bd->bi_dram[i].size);
 	}
 
-#if defined(CONFIG_CMD_NET)
+#if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH)
 	print_eths();
 #endif
 	printf("baudrate    = %u bps\n", gd->baudrate);
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 09/13] dm: net: Adjust PHY interface to work with CONFIG_DM_ETH
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (6 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 08/13] Avoid calling print_eths() with " Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:46   ` Joe Hershberger
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 10/13] dm: net: Tidy up designware driver ready for driver model Simon Glass
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

When driver model is used for Ethernet a few functions are passed a udevice
instead of an eth_device. Also add a function to find a PHY type given its
name. This will be used to decode the device tree node.

Finally, put a phy_interface field in struct eth_pdata since this is an
important part of the platform data for Ethernet.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/miiphyutil.c   |  1 +
 drivers/net/phy/phy.c | 22 ++++++++++++++++++++++
 include/net.h         |  2 ++
 include/phy.h         | 23 ++++++++++++++++++++++-
 4 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 74812e6..c88c28a 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <miiphy.h>
 #include <phy.h>
 
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index df7e945..9d88afe 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -11,6 +11,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <dm.h>
 #include <malloc.h>
 #include <net.h>
 #include <command.h>
@@ -754,7 +755,11 @@ struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask,
 	return get_phy_device_by_mask(bus, phy_mask, interface);
 }
 
+#ifdef CONFIG_DM_ETH
+void phy_connect_dev(struct phy_device *phydev, struct udevice *dev)
+#else
 void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev)
+#endif
 {
 	/* Soft Reset the PHY */
 	phy_reset(phydev);
@@ -767,8 +772,13 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev)
 	debug("%s connected to %s\n", dev->name, phydev->drv->name);
 }
 
+#ifdef CONFIG_DM_ETH
+struct phy_device *phy_connect(struct mii_dev *bus, int addr,
+		struct udevice *dev, phy_interface_t interface)
+#else
 struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 		struct eth_device *dev, phy_interface_t interface)
+#endif
 {
 	struct phy_device *phydev;
 
@@ -813,3 +823,15 @@ int phy_shutdown(struct phy_device *phydev)
 
 	return 0;
 }
+
+int phy_get_interface_by_name(const char *str)
+{
+	int i;
+
+	for (i = 0; i < PHY_INTERFACE_MODE_COUNT; i++) {
+		if (!strcmp(str, phy_interface_strings[i]))
+			return i;
+	}
+
+	return -1;
+}
diff --git a/include/net.h b/include/net.h
index e9cb4a3..b146700 100644
--- a/include/net.h
+++ b/include/net.h
@@ -84,10 +84,12 @@ enum eth_state_t {
  *
  * @iobase: The base address of the hardware registers
  * @enetaddr: The Ethernet MAC address that is loaded from EEPROM or env
+ * @phy_interface: PHY interface to use - see PHY_INTERFACE_MODE_...
  */
 struct eth_pdata {
 	phys_addr_t iobase;
 	unsigned char enetaddr[6];
+	int phy_interface;
 };
 
 /**
diff --git a/include/phy.h b/include/phy.h
index d117fc1..384dc23 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -51,7 +51,9 @@ typedef enum {
 	PHY_INTERFACE_MODE_RGMII_TXID,
 	PHY_INTERFACE_MODE_RTBI,
 	PHY_INTERFACE_MODE_XGMII,
-	PHY_INTERFACE_MODE_NONE	/* Must be last */
+	PHY_INTERFACE_MODE_NONE,	/* Must be last */
+
+	PHY_INTERFACE_MODE_COUNT,
 } phy_interface_t;
 
 static const char *phy_interface_strings[] = {
@@ -142,7 +144,11 @@ struct phy_device {
 	struct phy_driver *drv;
 	void *priv;
 
+#ifdef CONFIG_DM_ETH
+	struct udevice *dev;
+#else
 	struct eth_device *dev;
+#endif
 
 	/* forced speed & duplex (no autoneg)
 	 * partner speed & duplex & pause (autoneg)
@@ -205,10 +211,17 @@ int phy_init(void);
 int phy_reset(struct phy_device *phydev);
 struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask,
 		phy_interface_t interface);
+#ifdef CONFIG_DM_ETH
+void phy_connect_dev(struct phy_device *phydev, struct udevice *dev);
+struct phy_device *phy_connect(struct mii_dev *bus, int addr,
+				struct udevice *dev,
+				phy_interface_t interface);
+#else
 void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev);
 struct phy_device *phy_connect(struct mii_dev *bus, int addr,
 				struct eth_device *dev,
 				phy_interface_t interface);
+#endif
 int phy_startup(struct phy_device *phydev);
 int phy_config(struct phy_device *phydev);
 int phy_shutdown(struct phy_device *phydev);
@@ -242,6 +255,14 @@ int phy_vitesse_init(void);
 
 int board_phy_config(struct phy_device *phydev);
 
+/**
+ * phy_get_interface_by_name() - Look up a PHY interface name
+ *
+ * @str:	PHY interface name, e.g. "mii"
+ * @return PHY_INTERFACE_MODE_... value, or -1 if not found
+ */
+int phy_get_interface_by_name(const char *str);
+
 /* PHY UIDs for various PHYs that are referenced in external code */
 #define PHY_UID_CS4340  0x13e51002
 #define PHY_UID_TN2020	0x00a19410
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 10/13] dm: net: Tidy up designware driver ready for driver model
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (7 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 09/13] dm: net: Adjust PHY interface to work with CONFIG_DM_ETH Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:49   ` Joe Hershberger
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 11/13] dm: net: Adjust designware driver to support " Simon Glass
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

Adjust the error handling to use errno.h instead of returning -1. Change
leaf functions to pass in the arguments they require rather than struct
eth_device. Apart from simplifying the code it makes is easier to reuse
these functions for driver model, since mostly they actually only use
struct dw_eth_priv (which we can keep).

Create a stub for each Ethernet operation function. This will allow use to
share code with the driver model versions.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/net/designware.c | 87 +++++++++++++++++++++++++++++-------------------
 1 file changed, 53 insertions(+), 34 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index c03e935..834bff2 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -6,10 +6,11 @@
  */
 
 /*
- * Designware ethernet IP driver for u-boot
+ * Designware ethernet IP driver for U-Boot
  */
 
 #include <common.h>
+#include <errno.h>
 #include <miiphy.h>
 #include <malloc.h>
 #include <linux/compiler.h>
@@ -40,7 +41,7 @@ static int dw_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)
 		udelay(10);
 	};
 
-	return -1;
+	return -ETIMEDOUT;
 }
 
 static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
@@ -49,7 +50,7 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
 	struct eth_mac_regs *mac_p = bus->priv;
 	ulong start;
 	u16 miiaddr;
-	int ret = -1, timeout = CONFIG_MDIO_TIMEOUT;
+	int ret = -ETIMEDOUT, timeout = CONFIG_MDIO_TIMEOUT;
 
 	writel(val, &mac_p->miidata);
 	miiaddr = ((addr << MIIADDRSHIFT) & MII_ADDRMSK) |
@@ -69,27 +70,26 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
 	return ret;
 }
 
-static int dw_mdio_init(char *name, struct eth_mac_regs *mac_regs_p)
+static int dw_mdio_init(const char *name, struct eth_mac_regs *mac_regs_p)
 {
 	struct mii_dev *bus = mdio_alloc();
 
 	if (!bus) {
 		printf("Failed to allocate MDIO bus\n");
-		return -1;
+		return -ENOMEM;
 	}
 
 	bus->read = dw_mdio_read;
 	bus->write = dw_mdio_write;
-	sprintf(bus->name, name);
+	snprintf(bus->name, sizeof(bus->name), name);
 
 	bus->priv = (void *)mac_regs_p;
 
 	return mdio_register(bus);
 }
 
-static void tx_descs_init(struct eth_device *dev)
+static void tx_descs_init(struct dw_eth_dev *priv)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
 	struct dmamacdescr *desc_table_p = &priv->tx_mac_descrtable[0];
 	char *txbuffs = &priv->txbuffs[0];
@@ -128,9 +128,8 @@ static void tx_descs_init(struct eth_device *dev)
 	priv->tx_currdescnum = 0;
 }
 
-static void rx_descs_init(struct eth_device *dev)
+static void rx_descs_init(struct dw_eth_dev *priv)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
 	struct dmamacdescr *desc_table_p = &priv->rx_mac_descrtable[0];
 	char *rxbuffs = &priv->rxbuffs[0];
@@ -170,12 +169,10 @@ static void rx_descs_init(struct eth_device *dev)
 	priv->rx_currdescnum = 0;
 }
 
-static int dw_write_hwaddr(struct eth_device *dev)
+static int _dw_write_hwaddr(struct dw_eth_dev *priv, u8 *mac_id)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	struct eth_mac_regs *mac_p = priv->mac_regs_p;
 	u32 macid_lo, macid_hi;
-	u8 *mac_id = &dev->enetaddr[0];
 
 	macid_lo = mac_id[0] + (mac_id[1] << 8) + (mac_id[2] << 16) +
 		   (mac_id[3] << 24);
@@ -213,9 +210,8 @@ static void dw_adjust_link(struct eth_mac_regs *mac_p,
 	       (phydev->port == PORT_FIBRE) ? ", fiber mode" : "");
 }
 
-static void dw_eth_halt(struct eth_device *dev)
+static void _dw_eth_halt(struct dw_eth_dev *priv)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	struct eth_mac_regs *mac_p = priv->mac_regs_p;
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
 
@@ -225,12 +221,12 @@ static void dw_eth_halt(struct eth_device *dev)
 	phy_shutdown(priv->phydev);
 }
 
-static int dw_eth_init(struct eth_device *dev, bd_t *bis)
+static int _dw_eth_init(struct dw_eth_dev *priv, u8 *enetaddr)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	struct eth_mac_regs *mac_p = priv->mac_regs_p;
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
 	unsigned int start;
+	int ret;
 
 	writel(readl(&dma_p->busmode) | DMAMAC_SRST, &dma_p->busmode);
 
@@ -238,7 +234,7 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
 	while (readl(&dma_p->busmode) & DMAMAC_SRST) {
 		if (get_timer(start) >= CONFIG_MACRESET_TIMEOUT) {
 			printf("DMA reset timeout\n");
-			return -1;
+			return -ETIMEDOUT;
 		}
 
 		mdelay(100);
@@ -246,10 +242,10 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
 
 	/* Soft reset above clears HW address registers.
 	 * So we have to set it here once again */
-	dw_write_hwaddr(dev);
+	_dw_write_hwaddr(priv, enetaddr);
 
-	rx_descs_init(dev);
-	tx_descs_init(dev);
+	rx_descs_init(priv);
+	tx_descs_init(priv);
 
 	writel(FIXEDBURST | PRIORXTX_41 | DMA_PBL, &dma_p->busmode);
 
@@ -259,25 +255,25 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
 	writel(readl(&dma_p->opmode) | RXSTART | TXSTART, &dma_p->opmode);
 
 	/* Start up the PHY */
-	if (phy_startup(priv->phydev)) {
+	ret = phy_startup(priv->phydev);
+	if (ret) {
 		printf("Could not initialize PHY %s\n",
 		       priv->phydev->dev->name);
-		return -1;
+		return ret;
 	}
 
 	dw_adjust_link(mac_p, priv->phydev);
 
 	if (!priv->phydev->link)
-		return -1;
+		return -EIO;
 
 	writel(readl(&mac_p->conf) | RXENABLE | TXENABLE, &mac_p->conf);
 
 	return 0;
 }
 
-static int dw_eth_send(struct eth_device *dev, void *packet, int length)
+static int _dw_eth_send(struct dw_eth_dev *priv, void *packet, int length)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	struct eth_dma_regs *dma_p = priv->dma_regs_p;
 	u32 desc_num = priv->tx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->tx_mac_descrtable[desc_num];
@@ -300,7 +296,7 @@ static int dw_eth_send(struct eth_device *dev, void *packet, int length)
 	/* Check if the descriptor is owned by CPU */
 	if (desc_p->txrx_status & DESC_TXSTS_OWNBYDMA) {
 		printf("CPU not owner of tx frame\n");
-		return -1;
+		return -EPERM;
 	}
 
 	memcpy(desc_p->dmamac_addr, packet, length);
@@ -338,9 +334,8 @@ static int dw_eth_send(struct eth_device *dev, void *packet, int length)
 	return 0;
 }
 
-static int dw_eth_recv(struct eth_device *dev)
+static int _dw_eth_recv(struct dw_eth_dev *priv)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	u32 status, desc_num = priv->rx_currdescnum;
 	struct dmamacdescr *desc_p = &priv->rx_mac_descrtable[desc_num];
 	int length = 0;
@@ -386,9 +381,8 @@ static int dw_eth_recv(struct eth_device *dev)
 	return length;
 }
 
-static int dw_phy_init(struct eth_device *dev)
+static int dw_phy_init(struct dw_eth_dev *priv, void *dev)
 {
-	struct dw_eth_dev *priv = dev->priv;
 	struct phy_device *phydev;
 	int mask = 0xffffffff;
 
@@ -398,7 +392,7 @@ static int dw_phy_init(struct eth_device *dev)
 
 	phydev = phy_find_by_mask(priv->bus, mask, priv->interface);
 	if (!phydev)
-		return -1;
+		return -ENODEV;
 
 	phy_connect_dev(phydev, dev);
 
@@ -408,7 +402,32 @@ static int dw_phy_init(struct eth_device *dev)
 	priv->phydev = phydev;
 	phy_config(phydev);
 
-	return 1;
+	return 0;
+}
+
+static int dw_eth_init(struct eth_device *dev, bd_t *bis)
+{
+	return _dw_eth_init(dev->priv, dev->enetaddr);
+}
+
+static int dw_eth_send(struct eth_device *dev, void *packet, int length)
+{
+	return _dw_eth_send(dev->priv, packet, length);
+}
+
+static int dw_eth_recv(struct eth_device *dev)
+{
+	return _dw_eth_recv(dev->priv);
+}
+
+static void dw_eth_halt(struct eth_device *dev)
+{
+	return _dw_eth_halt(dev->priv);
+}
+
+static int dw_write_hwaddr(struct eth_device *dev)
+{
+	return _dw_write_hwaddr(dev->priv, dev->enetaddr);
 }
 
 int designware_initialize(ulong base_addr, u32 interface)
@@ -456,5 +475,5 @@ int designware_initialize(ulong base_addr, u32 interface)
 	dw_mdio_init(dev->name, priv->mac_regs_p);
 	priv->bus = miiphy_get_dev_by_name(dev->name);
 
-	return dw_phy_init(dev);
+	return dw_phy_init(priv, dev);
 }
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 11/13] dm: net: Adjust designware driver to support driver model
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (8 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 10/13] dm: net: Tidy up designware driver ready for driver model Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:51   ` Joe Hershberger
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet Simon Glass
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

Add driver model support to the designware driver. This reuses most of the
existing code except for some duplication in the probe() method.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/net/designware.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/designware.h |   3 +-
 2 files changed, 109 insertions(+), 1 deletion(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 834bff2..2d47609 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <errno.h>
 #include <miiphy.h>
 #include <malloc.h>
@@ -18,6 +19,8 @@
 #include <asm/io.h>
 #include "designware.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #if !defined(CONFIG_PHYLIB)
 # error "DesignWare Ether MAC requires PHYLIB - missing CONFIG_PHYLIB"
 #endif
@@ -405,6 +408,7 @@ static int dw_phy_init(struct dw_eth_dev *priv, void *dev)
 	return 0;
 }
 
+#ifndef CONFIG_DM_ETH
 static int dw_eth_init(struct eth_device *dev, bd_t *bis)
 {
 	return _dw_eth_init(dev->priv, dev->enetaddr);
@@ -477,3 +481,106 @@ int designware_initialize(ulong base_addr, u32 interface)
 
 	return dw_phy_init(priv, dev);
 }
+#endif
+
+#ifdef CONFIG_DM_ETH
+static int designware_eth_start(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+
+	return _dw_eth_init(dev->priv, pdata->enetaddr);
+}
+
+static int designware_eth_send(struct udevice *dev, void *packet, int length)
+{
+	struct dw_eth_dev *priv = dev_get_priv(dev);
+
+	return _dw_eth_send(priv, packet, length);
+}
+
+static int designware_eth_recv(struct udevice *dev)
+{
+	struct dw_eth_dev *priv = dev_get_priv(dev);
+
+	return _dw_eth_recv(priv);
+}
+
+static void designware_eth_stop(struct udevice *dev)
+{
+	struct dw_eth_dev *priv = dev_get_priv(dev);
+
+	return _dw_eth_halt(priv);
+}
+
+static int designware_eth_write_hwaddr(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+	struct dw_eth_dev *priv = dev_get_priv(dev);
+
+	return _dw_write_hwaddr(priv, pdata->enetaddr);
+}
+
+static int designware_eth_probe(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+	struct dw_eth_dev *priv = dev_get_priv(dev);
+	int ret;
+
+	debug("%s, iobase=%lx, priv=%p\n", __func__, pdata->iobase, priv);
+	priv->mac_regs_p = (struct eth_mac_regs *)pdata->iobase;
+	priv->dma_regs_p = (struct eth_dma_regs *)(pdata->iobase +
+			DW_DMA_BASE_OFFSET);
+	priv->interface = pdata->phy_interface;
+
+	dw_mdio_init(dev->name, priv->mac_regs_p);
+	priv->bus = miiphy_get_dev_by_name(dev->name);
+
+	ret = dw_phy_init(priv, dev);
+	debug("%s, ret=%d\n", __func__, ret);
+
+	return ret;
+}
+
+static const struct eth_ops designware_eth_ops = {
+	.start			= designware_eth_start,
+	.send			= designware_eth_send,
+	.recv			= designware_eth_recv,
+	.stop			= designware_eth_stop,
+	.write_hwaddr		= designware_eth_write_hwaddr,
+};
+
+static int designware_eth_ofdata_to_platdata(struct udevice *dev)
+{
+	struct eth_pdata *pdata = dev_get_platdata(dev);
+	const char *phy_mode;
+
+	pdata->iobase = dev_get_addr(dev);
+	pdata->phy_interface = -1;
+	phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset, "phy-mode", NULL);
+	if (phy_mode)
+		pdata->phy_interface = phy_get_interface_by_name(phy_mode);
+	if (pdata->phy_interface == -1) {
+		debug("%s: Invalid PHY interface '%s'\n", __func__, phy_mode);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static const struct udevice_id designware_eth_ids[] = {
+	{ .compatible = "allwinner,sun7i-a20-gmac" },
+	{ }
+};
+
+U_BOOT_DRIVER(eth_sandbox) = {
+	.name	= "eth_designware",
+	.id	= UCLASS_ETH,
+	.of_match = designware_eth_ids,
+	.ofdata_to_platdata = designware_eth_ofdata_to_platdata,
+	.probe	= designware_eth_probe,
+	.ops	= &designware_eth_ops,
+	.priv_auto_alloc_size = sizeof(struct dw_eth_dev),
+	.platdata_auto_alloc_size = sizeof(struct eth_pdata),
+	.flags = DM_FLAG_ALLOC_PRIV_DMA,
+};
+#endif
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index ce51102..bdaf38f 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -226,8 +226,9 @@ struct dw_eth_dev {
 
 	struct eth_mac_regs *mac_regs_p;
 	struct eth_dma_regs *dma_regs_p;
-
+#ifndef CONFIG_DM_ETH
 	struct eth_device *dev;
+#endif
 	struct phy_device *phydev;
 	struct mii_dev *bus;
 };
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (9 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 11/13] dm: net: Adjust designware driver to support " Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-01 17:51   ` Joe Hershberger
  2015-03-03  8:40   ` Ian Campbell
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3 Simon Glass
  2015-03-02 13:59 ` [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Tom Rini
  12 siblings, 2 replies; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

Adjust the Ethernet initialisation code to support driver model.
It is no-longer necessary to call designware_initialize(). The device will
be probed when it is used. The PHY type and GMAC base will come from the
device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 board/sunxi/gmac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
index 8849132..ce7831d 100644
--- a/board/sunxi/gmac.c
+++ b/board/sunxi/gmac.c
@@ -80,11 +80,16 @@ int sunxi_gmac_initialize(bd_t *bis)
 		sunxi_gpio_set_cfgpin(pin, SUN6I_GPA0_GMAC);
 #endif
 
-#ifdef CONFIG_RGMII
+#ifdef CONFIG_DM_ETH
+	printf("eth init\n");
+	return 0;
+#else
+# ifdef CONFIG_RGMII
 	return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_RGMII);
-#elif defined CONFIG_GMII
+# elif defined CONFIG_GMII
 	return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_GMII);
-#else
+# else
 	return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_MII);
+# endif
 #endif
 }
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (10 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet Simon Glass
@ 2015-03-01 16:33 ` Simon Glass
  2015-03-03  8:41   ` Ian Campbell
  2015-03-02 13:59 ` [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Tom Rini
  12 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-01 16:33 UTC (permalink / raw)
  To: u-boot

Switch this board over to use driver model for Ethernet

Cover-letter
RFC: dm: net: Conversion patches for sunxi driver model Ethernet
This series is for Joe Hershberger. It is based on his RFC driver model
Ethernet implementation, and enables it for the pcDuino3.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 configs/Linksprite_pcDuino3_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/Linksprite_pcDuino3_defconfig b/configs/Linksprite_pcDuino3_defconfig
index b5ff120..776588d 100644
--- a/configs/Linksprite_pcDuino3_defconfig
+++ b/configs/Linksprite_pcDuino3_defconfig
@@ -19,3 +19,4 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_NETDEVICES=y
 CONFIG_NET=y
+CONFIG_DM_ETH=y
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 02/13] net: Fix eth_get_dev_by_name() warning
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 02/13] net: Fix eth_get_dev_by_name() warning Simon Glass
@ 2015-03-01 17:02   ` Joe Hershberger
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:02 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> This can return either udevice or eth_device, so deal with either.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  net/eth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/eth.c b/net/eth.c
> index 3b3cd84..4d7f9a2 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -914,7 +914,7 @@ void eth_set_current(void)
>
>         if (act == NULL) {
>                 char *ethprime = getenv("ethprime");
> -               struct udevice *dev = NULL;
> +               void *dev = NULL;

Whoops, sorry about that.  I caught that shortly after I posted the last
version.  It is fixed in the next version.

>                 if (ethprime)
>                         dev = eth_get_dev_by_name(ethprime);
> --
> 2.2.0.rc0.207.ga3a616c
>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 04/13] Kconfig: Move CONFIG_DESIGNWARE_ETH to Kconfig
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 04/13] Kconfig: Move CONFIG_DESIGNWARE_ETH to Kconfig Simon Glass
@ 2015-03-01 17:08   ` Joe Hershberger
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:08 UTC (permalink / raw)
  To: u-boot

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> Move this to Kconfig and clean up board config files that use it. Also
> rename it to CONFIG_ETH_DESIGNWARE to fit with the naming that exists
> in drivers/net/Kconfig.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 07/13] dm: net: Use existing Ethernet init for driver model
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 07/13] dm: net: Use existing Ethernet init for driver model Simon Glass
@ 2015-03-01 17:14   ` Joe Hershberger
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:14 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> At present even with driver model is used there is still much manual init
> of related devices: PHY, environment and board init. Until these
requirements
> are dealt with in another way we need to keep them around.

That's a good idea for dealing with this for now. I have a series I started
where I replace all of this (hence I didn't include it in the
eth_initialize() of my dm/eth series).  This will allow dm/eth to be used
on hardware with fairly low churn in the mean time.

> Break out the init portion of the legacy eth_initialize() into a separate
> function and call it from both the legacy and driver model
eth_initialize()
> functions.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 08/13] Avoid calling print_eths() with driver model
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 08/13] Avoid calling print_eths() with " Simon Glass
@ 2015-03-01 17:23   ` Joe Hershberger
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:23 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> This function is not supported with driver model.

Again, sorry about this... I hadn't yet addressed ARM with DM_ETH enabled.

> Note: There is really no reason for this as far as I can see. At some
point
> we should bring it back.

At this point I don't see much value in listing the Ethernet devices in
bdinfo. It seems like a bit of a spurious thing to display and as such I
didn't feel like rewriting it to be compatible with DM or implementing the
functions bdinfo's print_eths() uses.  Also, it is only supported on ARM
and Microblaze. The inconsistency also led to my decision to drop it.

> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 09/13] dm: net: Adjust PHY interface to work with CONFIG_DM_ETH
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 09/13] dm: net: Adjust PHY interface to work with CONFIG_DM_ETH Simon Glass
@ 2015-03-01 17:46   ` Joe Hershberger
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:46 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> When driver model is used for Ethernet a few functions are passed a
udevice
> instead of an eth_device. Also add a function to find a PHY type given its
> name. This will be used to decode the device tree node.

I'm a little surprised it was this little code to interact with phylib.
Nice.

> Finally, put a phy_interface field in struct eth_pdata since this is an
> important part of the platform data for Ethernet.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 10/13] dm: net: Tidy up designware driver ready for driver model
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 10/13] dm: net: Tidy up designware driver ready for driver model Simon Glass
@ 2015-03-01 17:49   ` Joe Hershberger
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:49 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> Adjust the error handling to use errno.h instead of returning -1. Change
> leaf functions to pass in the arguments they require rather than struct
> eth_device. Apart from simplifying the code it makes is easier to reuse
> these functions for driver model, since mostly they actually only use
> struct dw_eth_priv (which we can keep).
>
> Create a stub for each Ethernet operation function. This will allow use to
> share code with the driver model versions.

Looks simple.  I hope most other Ethernet drivers will be so easy.

> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 11/13] dm: net: Adjust designware driver to support driver model
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 11/13] dm: net: Adjust designware driver to support " Simon Glass
@ 2015-03-01 17:51   ` Joe Hershberger
  0 siblings, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:51 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> Add driver model support to the designware driver. This reuses most of the
> existing code except for some duplication in the probe() method.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet Simon Glass
@ 2015-03-01 17:51   ` Joe Hershberger
  2015-03-03  8:40   ` Ian Campbell
  1 sibling, 0 replies; 34+ messages in thread
From: Joe Hershberger @ 2015-03-01 17:51 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sun, Mar 1, 2015 at 10:33 AM, Simon Glass <sjg@chromium.org> wrote:
>
> Adjust the Ethernet initialisation code to support driver model.
> It is no-longer necessary to call designware_initialize(). The device will
> be probed when it is used. The PHY type and GMAC base will come from the
> device tree.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  board/sunxi/gmac.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
> index 8849132..ce7831d 100644
> --- a/board/sunxi/gmac.c
> +++ b/board/sunxi/gmac.c
> @@ -80,11 +80,16 @@ int sunxi_gmac_initialize(bd_t *bis)
>                 sunxi_gpio_set_cfgpin(pin, SUN6I_GPA0_GMAC);
>  #endif
>
> -#ifdef CONFIG_RGMII
> +#ifdef CONFIG_DM_ETH
> +       printf("eth init\n");

Why do we want to print here?

> +       return 0;
> +#else
> +# ifdef CONFIG_RGMII
>         return designware_initialize(SUNXI_GMAC_BASE,
PHY_INTERFACE_MODE_RGMII);
> -#elif defined CONFIG_GMII
> +# elif defined CONFIG_GMII
>         return designware_initialize(SUNXI_GMAC_BASE,
PHY_INTERFACE_MODE_GMII);
> -#else
> +# else
>         return designware_initialize(SUNXI_GMAC_BASE,
PHY_INTERFACE_MODE_MII);
> +# endif
>  #endif
>  }
> --
> 2.2.0.rc0.207.ga3a616c
>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING
  2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
                   ` (11 preceding siblings ...)
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3 Simon Glass
@ 2015-03-02 13:59 ` Tom Rini
  2015-03-02 22:14   ` Simon Glass
  12 siblings, 1 reply; 34+ messages in thread
From: Tom Rini @ 2015-03-02 13:59 UTC (permalink / raw)
  To: u-boot

On Sun, Mar 01, 2015 at 09:33:27AM -0700, Simon Glass wrote:

> This string seems wrong - U-Boot is normally written with a capital B.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

But it's in the wild and thus in various dhcpd config files such as:
...
} elsif substring (option vendor-class-identifier, 0, 17) = "AM335x U-Boot SPL" {
  filename "am335x/u-boot.img";
...

in mine for am335x.  So "U-boot" exists in other peoples file and thus
we can't really go off and change it.  NAK, sorry.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150302/804ef022/attachment.sig>

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING
  2015-03-02 13:59 ` [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Tom Rini
@ 2015-03-02 22:14   ` Simon Glass
  0 siblings, 0 replies; 34+ messages in thread
From: Simon Glass @ 2015-03-02 22:14 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On 2 March 2015 at 06:59, Tom Rini <trini@konsulko.com> wrote:
> On Sun, Mar 01, 2015 at 09:33:27AM -0700, Simon Glass wrote:
>
>> This string seems wrong - U-Boot is normally written with a capital B.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> But it's in the wild and thus in various dhcpd config files such as:
> ...
> } elsif substring (option vendor-class-identifier, 0, 17) = "AM335x U-Boot SPL" {
>   filename "am335x/u-boot.img";
> ...
>
> in mine for am335x.  So "U-boot" exists in other peoples file and thus
> we can't really go off and change it.  NAK, sorry.

OK, I wondered if someone was going to say that. It's a shame it isn't
case-insensitive!

Regards,
Simon

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version Simon Glass
@ 2015-03-03  8:34   ` Ian Campbell
  2015-03-03 13:29     ` Hans de Goede
  0 siblings, 1 reply; 34+ messages in thread
From: Ian Campbell @ 2015-03-03  8:34 UTC (permalink / raw)
  To: u-boot

On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
> We currently have Linksprite_pcDuino3 and Linksprite_pcDuino3_fdt. Drop the
> former in favour of the latter.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Is the FDT version a drop in replacement now? I didn't receive the whole
series but I see that e.g. patch #13 is switching to driver model for
Ethernet on this platform. Shouldn't this patch therefore come at the
end of the series after that groundwork has been laid?

_If_ I'm mistaken and this change at this point in the series is "no
functional change" then:
        Acked-by: Ian Campbell <ijc@hellion.org.uk>
        
Ian.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings Simon Glass
@ 2015-03-03  8:36   ` Ian Campbell
  2015-03-03 23:40     ` Simon Glass
  0 siblings, 1 reply; 34+ messages in thread
From: Ian Campbell @ 2015-03-03  8:36 UTC (permalink / raw)
  To: u-boot

On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
> Since we will use these bindings on sunxi, bring them in from Linux
> 4.0-rc1.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Ian Campbell <ijc@hellion.org.uk>

Although I do wonder if rather than importing all these bindings whether
we shouldn't just be referencing
https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-rebasing.git/ ?

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet Simon Glass
  2015-03-01 17:51   ` Joe Hershberger
@ 2015-03-03  8:40   ` Ian Campbell
  2015-03-03 23:40     ` Simon Glass
  1 sibling, 1 reply; 34+ messages in thread
From: Ian Campbell @ 2015-03-03  8:40 UTC (permalink / raw)
  To: u-boot

On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
> Adjust the Ethernet initialisation code to support driver model.
> It is no-longer necessary to call designware_initialize(). The device will
> be probed when it is used. The PHY type and GMAC base will come from the
> device tree.

I wonder if for this sort of thing designware_initialize couldn't become
a nop so we can avoid some level of ifdefs?

Anyway, that's just minor, of larger concern is all the CONFIG_RGMII and
CONFIG_GMII stuff which is just above the context here. Doesn't that
need to become DM driven for this to be useful?

In fact, doesn't the pinmux generally need to become DM driven?

Or is this just a partial stepping stone to DM Ethernet support and not
a complete transition? (I wonder if I am confusing Device Model with
Device Tree here and this is all about the former, albeit the former is
often driven from the latter...)

> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  board/sunxi/gmac.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
> index 8849132..ce7831d 100644
> --- a/board/sunxi/gmac.c
> +++ b/board/sunxi/gmac.c
> @@ -80,11 +80,16 @@ int sunxi_gmac_initialize(bd_t *bis)
>  		sunxi_gpio_set_cfgpin(pin, SUN6I_GPA0_GMAC);
>  #endif
>  
> -#ifdef CONFIG_RGMII
> +#ifdef CONFIG_DM_ETH
> +	printf("eth init\n");
> +	return 0;
> +#else
> +# ifdef CONFIG_RGMII
>  	return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_RGMII);
> -#elif defined CONFIG_GMII
> +# elif defined CONFIG_GMII
>  	return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_GMII);
> -#else
> +# else
>  	return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_MII);
> +# endif
>  #endif
>  }

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3
  2015-03-01 16:33 ` [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3 Simon Glass
@ 2015-03-03  8:41   ` Ian Campbell
  2015-03-03 23:40     ` Simon Glass
  0 siblings, 1 reply; 34+ messages in thread
From: Ian Campbell @ 2015-03-03  8:41 UTC (permalink / raw)
  To: u-boot

On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
> Switch this board over to use driver model for Ethernet
> 
> Cover-letter
> RFC: dm: net: Conversion patches for sunxi driver model Ethernet
> This series is for Joe Hershberger. It is based on his RFC driver model
> Ethernet implementation, and enables it for the pcDuino3.
> END

Did you intend to put this somewhere else?

> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  configs/Linksprite_pcDuino3_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configs/Linksprite_pcDuino3_defconfig b/configs/Linksprite_pcDuino3_defconfig
> index b5ff120..776588d 100644
> --- a/configs/Linksprite_pcDuino3_defconfig
> +++ b/configs/Linksprite_pcDuino3_defconfig
> @@ -19,3 +19,4 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
>  CONFIG_ETH_DESIGNWARE=y
>  CONFIG_NETDEVICES=y
>  CONFIG_NET=y
> +CONFIG_DM_ETH=y

Also remove SUNXI_GMAC from CONFIG_SYS_EXTRA_OPTIONS?

Ian.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version
  2015-03-03  8:34   ` Ian Campbell
@ 2015-03-03 13:29     ` Hans de Goede
  2015-03-03 14:01       ` Simon Glass
  0 siblings, 1 reply; 34+ messages in thread
From: Hans de Goede @ 2015-03-03 13:29 UTC (permalink / raw)
  To: u-boot

Hi,

On 03-03-15 09:34, Ian Campbell wrote:
> On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
>> We currently have Linksprite_pcDuino3 and Linksprite_pcDuino3_fdt. Drop the
>> former in favour of the latter.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Is the FDT version a drop in replacement now?

AFAIK yes, this change was actually proposed by me since having 2 versions
makes no sense and in the long run we want to move everything to devicetree.

> I didn't receive the whole
> series but I see that e.g. patch #13 is switching to driver model for
> Ethernet on this platform. Shouldn't this patch therefore come at the
> end of the series after that groundwork has been laid?
>
> _If_ I'm mistaken and this change at this point in the series is "no
> functional change" then:
>          Acked-by: Ian Campbell <ijc@hellion.org.uk>

And also:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version
  2015-03-03 13:29     ` Hans de Goede
@ 2015-03-03 14:01       ` Simon Glass
  0 siblings, 0 replies; 34+ messages in thread
From: Simon Glass @ 2015-03-03 14:01 UTC (permalink / raw)
  To: u-boot

Hi,

On 3 March 2015 at 06:29, Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
> On 03-03-15 09:34, Ian Campbell wrote:
>>
>> On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
>>>
>>> We currently have Linksprite_pcDuino3 and Linksprite_pcDuino3_fdt. Drop
>>> the
>>> former in favour of the latter.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>
>>
>> Is the FDT version a drop in replacement now?
>
>
> AFAIK yes, this change was actually proposed by me since having 2 versions
> makes no sense and in the long run we want to move everything to devicetree.

Yes that's the intent. I did the initial version as a separate board
to allow it to be compared.

>
>> I didn't receive the whole
>> series but I see that e.g. patch #13 is switching to driver model for
>> Ethernet on this platform. Shouldn't this patch therefore come at the
>> end of the series after that groundwork has been laid?

I could have sent that as a separate patch. It does not depend on the
Ethernet conversion though.

>>
>> _If_ I'm mistaken and this change at this point in the series is "no
>> functional change" then:
>>          Acked-by: Ian Campbell <ijc@hellion.org.uk>
>
>
> And also:
>
> Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,
Simon

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings
  2015-03-03  8:36   ` Ian Campbell
@ 2015-03-03 23:40     ` Simon Glass
  2015-03-04  8:53       ` Ian Campbell
  0 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-03 23:40 UTC (permalink / raw)
  To: u-boot

Hi Ian,

On 3 March 2015 at 01:36, Ian Campbell <ijc+uboot@hellion.org.uk> wrote:
> On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
>> Since we will use these bindings on sunxi, bring them in from Linux
>> 4.0-rc1.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Acked-by: Ian Campbell <ijc@hellion.org.uk>
>
> Although I do wonder if rather than importing all these bindings whether
> we shouldn't just be referencing
> https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-rebasing.git/ ?

Is Linux going to drop these bindings?

Regards,
Simon

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet
  2015-03-03  8:40   ` Ian Campbell
@ 2015-03-03 23:40     ` Simon Glass
  0 siblings, 0 replies; 34+ messages in thread
From: Simon Glass @ 2015-03-03 23:40 UTC (permalink / raw)
  To: u-boot

Hi Ian,

On 3 March 2015 at 01:40, Ian Campbell <ijc+uboot@hellion.org.uk> wrote:
> On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
>> Adjust the Ethernet initialisation code to support driver model.
>> It is no-longer necessary to call designware_initialize(). The device will
>> be probed when it is used. The PHY type and GMAC base will come from the
>> device tree.
>
> I wonder if for this sort of thing designware_initialize couldn't become
> a nop so we can avoid some level of ifdefs?

I would rather not, since the intent is to delete the whole function.
Once all sunxi uses driver model for Ethernet we can drop the call in
gmac.c.

>
> Anyway, that's just minor, of larger concern is all the CONFIG_RGMII and
> CONFIG_GMII stuff which is just above the context here. Doesn't that
> need to become DM driven for this to be useful?
>

Yes

> In fact, doesn't the pinmux generally need to become DM driven?
>

Yes

> Or is this just a partial stepping stone to DM Ethernet support and not
> a complete transition? (I wonder if I am confusing Device Model with
> Device Tree here and this is all about the former, albeit the former is
> often driven from the latter...)
>

Yes this is Ethernet only. If we create a pinctl or funcmux framework
we could implement this, but it is in fact a separate issue from
Ethernet.

>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  board/sunxi/gmac.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
>> index 8849132..ce7831d 100644
>> --- a/board/sunxi/gmac.c
>> +++ b/board/sunxi/gmac.c
>> @@ -80,11 +80,16 @@ int sunxi_gmac_initialize(bd_t *bis)
>>               sunxi_gpio_set_cfgpin(pin, SUN6I_GPA0_GMAC);
>>  #endif
>>
>> -#ifdef CONFIG_RGMII
>> +#ifdef CONFIG_DM_ETH
>> +     printf("eth init\n");
>> +     return 0;
>> +#else
>> +# ifdef CONFIG_RGMII
>>       return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_RGMII);
>> -#elif defined CONFIG_GMII
>> +# elif defined CONFIG_GMII
>>       return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_GMII);
>> -#else
>> +# else
>>       return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_MII);
>> +# endif
>>  #endif
>>  }
>
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3
  2015-03-03  8:41   ` Ian Campbell
@ 2015-03-03 23:40     ` Simon Glass
  2015-03-04  8:54       ` Ian Campbell
  0 siblings, 1 reply; 34+ messages in thread
From: Simon Glass @ 2015-03-03 23:40 UTC (permalink / raw)
  To: u-boot

Hi Ian,

On 3 March 2015 at 01:41, Ian Campbell <ijc+uboot@hellion.org.uk> wrote:
> On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
>> Switch this board over to use driver model for Ethernet
>>
>> Cover-letter
>> RFC: dm: net: Conversion patches for sunxi driver model Ethernet
>> This series is for Joe Hershberger. It is based on his RFC driver model
>> Ethernet implementation, and enables it for the pcDuino3.
>> END
>
> Did you intend to put this somewhere else?
>

Yes that's an error.

>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>  configs/Linksprite_pcDuino3_defconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/configs/Linksprite_pcDuino3_defconfig b/configs/Linksprite_pcDuino3_defconfig
>> index b5ff120..776588d 100644
>> --- a/configs/Linksprite_pcDuino3_defconfig
>> +++ b/configs/Linksprite_pcDuino3_defconfig
>> @@ -19,3 +19,4 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
>>  CONFIG_ETH_DESIGNWARE=y
>>  CONFIG_NETDEVICES=y
>>  CONFIG_NET=y
>> +CONFIG_DM_ETH=y
>
> Also remove SUNXI_GMAC from CONFIG_SYS_EXTRA_OPTIONS?

Do you mean move it to Kconfig? I did not do that, no. We can't just
remove it since we need the gmac for everything to work. But maybe I
am misunderstanding something.

Regards,
Simon

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings
  2015-03-03 23:40     ` Simon Glass
@ 2015-03-04  8:53       ` Ian Campbell
  0 siblings, 0 replies; 34+ messages in thread
From: Ian Campbell @ 2015-03-04  8:53 UTC (permalink / raw)
  To: u-boot

On Tue, 2015-03-03 at 16:40 -0700, Simon Glass wrote:
> Hi Ian,
> 
> On 3 March 2015 at 01:36, Ian Campbell <ijc+uboot@hellion.org.uk> wrote:
> > On Sun, 2015-03-01 at 09:33 -0700, Simon Glass wrote:
> >> Since we will use these bindings on sunxi, bring them in from Linux
> >> 4.0-rc1.
> >>
> >> Signed-off-by: Simon Glass <sjg@chromium.org>
> >
> > Acked-by: Ian Campbell <ijc@hellion.org.uk>
> >
> > Although I do wonder if rather than importing all these bindings whether
> > we shouldn't just be referencing
> > https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-rebasing.git/ ?
> 
> Is Linux going to drop these bindings?

At one point it was the plan eventually, but it seems unlikely to
actually happen. But I'm not sure why that would matter for our
purposes?

This is an automated export of the bindings in Linux, for the benefit of
folks who don't want to clone the (enormous) linux.git tree just to get
at the bindings.

Ian.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3
  2015-03-03 23:40     ` Simon Glass
@ 2015-03-04  8:54       ` Ian Campbell
  0 siblings, 0 replies; 34+ messages in thread
From: Ian Campbell @ 2015-03-04  8:54 UTC (permalink / raw)
  To: u-boot

On Tue, 2015-03-03 at 16:40 -0700, Simon Glass wrote:

> >> +CONFIG_DM_ETH=y
> >
> > Also remove SUNXI_GMAC from CONFIG_SYS_EXTRA_OPTIONS?
> 
> Do you mean move it to Kconfig? I did not do that, no. We can't just
> remove it since we need the gmac for everything to work. But maybe I
> am misunderstanding something.

I guess I was just confused because I expected the new option to enable
the drivers etc. But I guess that doesn't make sense until we have a
single binary image.

Ian.

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2015-03-04  8:54 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-01 16:33 [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Simon Glass
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 02/13] net: Fix eth_get_dev_by_name() warning Simon Glass
2015-03-01 17:02   ` Joe Hershberger
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 03/13] sunxi: Replace the pcDuino3 config with FDT version Simon Glass
2015-03-03  8:34   ` Ian Campbell
2015-03-03 13:29     ` Hans de Goede
2015-03-03 14:01       ` Simon Glass
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 04/13] Kconfig: Move CONFIG_DESIGNWARE_ETH to Kconfig Simon Glass
2015-03-01 17:08   ` Joe Hershberger
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 05/13] dts: sunxi: Bring in Ethernet device tree bindings Simon Glass
2015-03-03  8:36   ` Ian Campbell
2015-03-03 23:40     ` Simon Glass
2015-03-04  8:53       ` Ian Campbell
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 06/13] dm: core: Support allocating driver-private data for DMA Simon Glass
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 07/13] dm: net: Use existing Ethernet init for driver model Simon Glass
2015-03-01 17:14   ` Joe Hershberger
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 08/13] Avoid calling print_eths() with " Simon Glass
2015-03-01 17:23   ` Joe Hershberger
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 09/13] dm: net: Adjust PHY interface to work with CONFIG_DM_ETH Simon Glass
2015-03-01 17:46   ` Joe Hershberger
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 10/13] dm: net: Tidy up designware driver ready for driver model Simon Glass
2015-03-01 17:49   ` Joe Hershberger
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 11/13] dm: net: Adjust designware driver to support " Simon Glass
2015-03-01 17:51   ` Joe Hershberger
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 12/13] dm: sunxi: Support driver model for Ethernet Simon Glass
2015-03-01 17:51   ` Joe Hershberger
2015-03-03  8:40   ` Ian Campbell
2015-03-03 23:40     ` Simon Glass
2015-03-01 16:33 ` [U-Boot] [RFC PATCH 13/13] dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3 Simon Glass
2015-03-03  8:41   ` Ian Campbell
2015-03-03 23:40     ` Simon Glass
2015-03-04  8:54       ` Ian Campbell
2015-03-02 13:59 ` [U-Boot] [RFC PATCH 01/13] Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING Tom Rini
2015-03-02 22:14   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.