Skip to contentSkip to conversation

Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING

RFC PATCH New Simon Glass 5 participants 34 messages Mar 1, 2015 – Mar 4, 2015

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/13 Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING

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

---

 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(-)
include/config_distro_defaults.h +2 -2
index 1ecc0bb..faf564f 100644
@@ -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
 
include/configs/ls2085a_common.h +1 -1
index 6fe032c..69de475 100644
@@ -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
include/configs/vexpress_aemv8a.h +1 -1
index 7fb28a5..d4ba4e9 100644
@@ -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
include/configs/vexpress_ca15_tc2.h +1 -1
index b43afa2..3c9777f 100644
@@ -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
include/configs/vexpress_ca5x2.h +1 -1
index 7719d59..6c160a5 100644
@@ -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 */
include/configs/vexpress_ca9x4.h +1 -1
index 38ac4ed..564521e 100644
@@ -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 */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

RFC PATCH 2/13 net: Fix eth_get_dev_by_name() warning

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

---

 net/eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/eth.c +1 -1
index 3b3cd84..4d7f9a2 100644
@@ -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);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#2 lore raw

RFC PATCH 2/13 net: Fix eth_get_dev_by_name() warning

Hi Simon,

Quoted 14 lines · Simon Glass

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

---

 net/eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/eth.c +0 -0
index 3b3cd84..4d7f9a2 100644

net/eth.c void eth_set_current(void) · line 917

Quoted 5 lines
net/eth.c +1 -1
@@ -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.

Quoted 5 lines
net/eth.c +0 -1
                if (ethprime)
                        dev = eth_get_dev_by_name(ethprime);
--

2.2.0.rc0.207.ga3a616c

#3 lore raw

RFC PATCH 3/13 sunxi: Replace the pcDuino3 config with FDT version

In reply to Simon Glass

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

---

 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
configs/Linksprite_pcDuino3_defconfig +9 -0
index 45d88f3..cf9e090 100644
@@ -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
configs/Linksprite_pcDuino3_fdt_defconfig deleted +0 -18
deleted file mode 100644
index cf9e090..0000000
@@ -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
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#4 lore raw

RFC PATCH 3/13 sunxi: Replace the pcDuino3 config with FDT version

Quoted 4 lines · Simon Glass

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

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:

Ian.

#5 lore raw

RFC PATCH 3/13 sunxi: Replace the pcDuino3 config with FDT version

Hi,

Quoted 7 lines · Ian Campbell
Quoted 4 lines · Simon Glass

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

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.

Quoted 8 lines

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:

And also:

Regards,

Hans

#6 lore raw

RFC PATCH 3/13 sunxi: Replace the pcDuino3 config with FDT version

Hi,

Quoted 10 lines · Hans de Goede

Hi,

Quoted 7 lines · Ian Campbell
Quoted 5 lines · Simon Glass

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

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

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.

Quoted 5 lines
Quoted 5 lines

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.

Quoted 9 lines
Quoted 4 lines

_If_ I'm mistaken and this change at this point in the series is "no functional change" then:

And also:

Regards,
Simon

#7 lore raw

RFC PATCH 4/13 Kconfig: Move CONFIG_DESIGNWARE_ETH to Kconfig

In reply to Simon Glass

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.

---

 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(-)
arch/arm/cpu/arm926ejs/spear/cpu.c +1 -1
index 697e094..1ce9db7 100644
@@ -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)
arch/arm/cpu/armv7/socfpga/misc.c +1 -1
index 7873c38..0f8b4d0 100644
@@ -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
board/bf609-ezkit/bf609-ezkit.c +1 -1
index 43a4330..86da028 100644
@@ -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;
board/spear/spear300/spear300.c +1 -1
index 6b6bd9f..396b5bd 100644
@@ -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++;
board/spear/spear310/spear310.c +1 -1
index a4c6a8e..6f39ef1 100644
@@ -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++;
board/spear/spear320/spear320.c +1 -1
index ab732a7..52196af 100644
@@ -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++;
board/spear/spear600/spear600.c +1 -1
index 8472002..fc0918f 100644
@@ -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;
board/st/stv0991/stv0991.c +1 -1
index f465699..38f6e1d 100644
@@ -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++;
configs/A20-OLinuXino-Lime2_defconfig +3 -0
index ff94e77..516597e 100644
@@ -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
configs/A20-OLinuXino-Lime_defconfig +3 -0
index 5442f64..c86eda5 100644
@@ -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
configs/A20-OLinuXino_MICRO_defconfig +3 -0
index 97a21ee..00d93e8 100644
@@ -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
configs/Bananapi_defconfig +3 -0
index 5aba938..78431db 100644
@@ -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
configs/Bananapro_defconfig +3 -0
index e501b5c..696daa6 100644
@@ -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
configs/CSQ_CS908_defconfig +3 -0
index 4040bee..5d42272 100644
@@ -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
configs/Colombus_defconfig +3 -0
index 33edcc4..af823e1 100644
@@ -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
configs/Cubieboard2_defconfig +3 -0
index 7704a0e..fcc9423 100644
@@ -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
configs/Cubietruck_defconfig +3 -0
index b64f84f..d267128 100644
@@ -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
configs/Hummingbird_A31_defconfig +3 -0
index 0275463..ac0ab05 100644
@@ -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
configs/Linksprite_pcDuino3_Nano_defconfig +3 -0
index 4baba14..f8d9659 100644
@@ -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
configs/Linksprite_pcDuino3_defconfig +3 -0
index cf9e090..b5ff120 100644
@@ -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
configs/Mele_M3_defconfig +3 -0
index 723a72a..4331368 100644
@@ -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
configs/Mele_M5_defconfig +3 -0
index 2e1f80d..2712508 100644
@@ -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
configs/Mele_M9_defconfig +3 -0
index eaf9a7e..2ed2274 100644
@@ -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
configs/axs101_defconfig +4 -1
index 34ed963..9ef04df 100644
@@ -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
configs/axs103_defconfig +3 -0
index c63dd4a..3f7b21f 100644
@@ -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
configs/bf609-ezkit_defconfig +3 -0
index 2bfb6a5..96f746e 100644
@@ -1,2 +1,5 @@
 CONFIG_BLACKFIN=y
 CONFIG_TARGET_BF609_EZKIT=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_NETDEVICES=y
+CONFIG_NET=y
configs/i12-tvbox_defconfig +3 -0
index 41192fc..a95a5a5 100644
@@ -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
configs/socfpga_cyclone5_defconfig +3 -0
index 4b2ede4..1f9a58e 100644
@@ -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
configs/socfpga_socrates_defconfig +3 -0
index f2ddc31..7490e21 100644
@@ -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
configs/spear300_defconfig +3 -0
index 25a08df..df0b190 100644
@@ -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
configs/spear300_nand_defconfig +3 -0
index a4b70e8..a49492c 100644
@@ -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
configs/spear300_usbtty_defconfig +3 -0
index d750cf4..3d60d7f 100644
@@ -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
configs/spear300_usbtty_nand_defconfig +3 -0
index 8bafdb5..ffe4f59 100644
@@ -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
configs/spear310_defconfig +3 -0
index 8a9ec85..16a6bc3 100644
@@ -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
configs/spear310_nand_defconfig +3 -0
index 1439ac5..05e3c96 100644
@@ -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
configs/spear310_pnor_defconfig +3 -0
index 19604b3..384cb54 100644
@@ -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
configs/spear310_usbtty_defconfig +3 -0
index 6342a56..0115f2c 100644
@@ -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
configs/spear310_usbtty_nand_defconfig +3 -0
index 5b9f1f6..2d82b66 100644
@@ -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
configs/spear310_usbtty_pnor_defconfig +3 -0
index 0567936..579df36 100644
@@ -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
configs/spear320_defconfig +3 -0
index 3d91bb1..7bd51a8 100644
@@ -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
configs/spear320_nand_defconfig +3 -0
index fd0f908..d7c995c 100644
@@ -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
configs/spear320_pnor_defconfig +3 -0
index 6cce316..a56a4e0 100644
@@ -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
configs/spear320_usbtty_defconfig +3 -0
index 7ad3d84..c2fb481 100644
@@ -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
configs/spear320_usbtty_nand_defconfig +3 -0
index a5ad90b..98368ed 100644
@@ -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
configs/spear320_usbtty_pnor_defconfig +3 -0
index 6b110ef..e428d25 100644
@@ -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
configs/spear600_defconfig +3 -0
index f1cb0aa..dae0d59 100644
@@ -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
configs/spear600_nand_defconfig +3 -0
index 172c187..cdd98fc 100644
@@ -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
configs/spear600_usbtty_defconfig +3 -0
index cf8b0ec..1e28edf 100644
@@ -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
configs/spear600_usbtty_nand_defconfig +3 -0
index 8bd2f07..2f8fd5e 100644
@@ -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
configs/stv0991_defconfig +3 -0
index 1c9ba88..7e1fd37 100644
@@ -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
configs/tb100_defconfig +3 -0
index b0e8c9f..a6351fa 100644
@@ -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
configs/x600_defconfig +3 -0
index cb66890..48790ef 100644
@@ -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
drivers/net/Kconfig +7 -0
index dcbfa8a..94e35d6 100644
@@ -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
drivers/net/Makefile +1 -1
index 6c3abf1..e7de1c4 100644
@@ -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
include/configs/axs101.h +0 -1
index 5fb8aca..ed63048 100644
@@ -110,7 +110,6 @@
 /*
  * Ethernet configuration
  */
-#define CONFIG_DESIGNWARE_ETH
 #define CONFIG_DW_AUTONEG
 #define CONFIG_NET_MULTI
 
include/configs/bf609-ezkit.h +0 -1
index 878009f..7507d57 100644
@@ -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
include/configs/socfpga_common.h +0 -1
index ee227fe..e263980 100644
@@ -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
include/configs/spear-common.h +0 -1
index a11f4ed..3d7ccbe 100644
@@ -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 */
include/configs/stv0991.h +0 -1
index 156e0fa..ab1e61c 100644
@@ -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
 
include/configs/sunxi-common.h +0 -1
index bd7d049..3dd4bd6 100644
@@ -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
include/configs/tb100.h +0 -1
index 46df406..bc69f1d 100644
@@ -66,7 +66,6 @@
 /*
  * Ethernet configuration
  */
-#define CONFIG_DESIGNWARE_ETH
 #define ETH0_BASE_ADDRESS		0xFE100000
 #define ETH1_BASE_ADDRESS		0xFE110000
 
include/configs/x600.h +0 -1
index 04187c0..44a8e8f 100644
@@ -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 */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#9 lore raw

RFC PATCH 5/13 dts: sunxi: Bring in Ethernet device tree bindings

In reply to Simon Glass

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

---

 .../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
doc/device-tree-bindings/net/allwinner,sun4i-emac.txt new file +19 -0
new file mode 100644
index 0000000..10640b1
@@ -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>;
+};
doc/device-tree-bindings/net/allwinner,sun4i-mdio.txt new file +27 -0
new file mode 100644
index 0000000..4ec5641
@@ -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>;
+	};
+};
doc/device-tree-bindings/net/allwinner,sun7i-a20-gmac.txt new file +27 -0
new file mode 100644
index 0000000..ea4d752
@@ -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";
+	};
doc/device-tree-bindings/net/ethernet.txt new file +25 -0
new file mode 100644
index 0000000..3fc3605
@@ -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.
doc/device-tree-bindings/net/stmmac.txt new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.2.0.rc0.207.ga3a616c
#11 lore raw

RFC PATCH 5/13 dts: sunxi: Bring in Ethernet device tree bindings

Hi Ian,

Quoted 11 lines · Ian Campbell
Quoted 4 lines · Simon Glass

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

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

#12 lore raw

RFC PATCH 5/13 dts: sunxi: Bring in Ethernet device tree bindings

Quoted 9 lines · Simon Glass

Hi Ian,

Quoted 6 lines · Ian Campbell
Quoted 4 lines · Simon Glass

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

Quoted 7 lines
Quoted 5 lines

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.

#13 lore raw

RFC PATCH 6/13 dm: core: Support allocating driver-private data for DMA

In reply to Simon Glass

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.

---

 drivers/core/device.c | 11 ++++++++++-
 include/dm/device.h   |  3 +++
 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/core/device.c +10 -1
index 37dc882..b7a5654 100644
@@ -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;
include/dm/device.h +3 -0
index 7a48eb8..7f810ed 100644
@@ -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
  *
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#14 lore raw

RFC PATCH 7/13 dm: net: Use existing Ethernet init for driver model

In reply to Simon Glass

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.

---

 net/eth.c | 78 ++++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 42 insertions(+), 36 deletions(-)
net/eth.c +42 -36
index 4d7f9a2..cfb2c3d 100644
@@ -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");
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#15 lore raw

RFC PATCH 7/13 dm: net: Use existing Ethernet init for driver model

Hi Simon,

Quoted 3 lines · Simon Glass

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

Quoted 1 line

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.

Quoted 2 lines

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()

Quoted 3 lines

functions.

#16 lore raw

RFC PATCH 8/13 Avoid calling print_eths() with driver model

In reply to Simon Glass

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.

---

 common/cmd_bdinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_bdinfo.c +1 -1
index b4cce25..f16d5c7 100644
@@ -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);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#17 lore raw

RFC PATCH 8/13 Avoid calling print_eths() with driver model

Hi Simon,

Quoted 2 lines · Simon Glass

This function is not supported with driver model.

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

Quoted 1 line

Note: There is really no reason for this as far as I can see. At some

point

Quoted 1 line

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.

Quoted 1 line
#18 lore raw

RFC PATCH 9/13 dm: net: Adjust PHY interface to work with CONFIG_DM_ETH

In reply to Simon Glass

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.

---

 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(-)
common/miiphyutil.c +1 -0
index 74812e6..c88c28a 100644
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <miiphy.h>
 #include <phy.h>
 
drivers/net/phy/phy.c +22 -0
index df7e945..9d88afe 100644
@@ -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;
+}
include/net.h +2 -0
index e9cb4a3..b146700 100644
@@ -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;
 };
 
 /**
include/phy.h +22 -1
index d117fc1..384dc23 100644
@@ -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
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#19 lore raw

RFC PATCH 9/13 dm: net: Adjust PHY interface to work with CONFIG_DM_ETH

Hi Simon,

Quoted 2 lines · Simon Glass

When driver model is used for Ethernet a few functions are passed a

udevice

Quoted 2 lines

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.

Quoted 4 lines

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

#20 lore raw

RFC PATCH 10/13 dm: net: Tidy up designware driver ready for driver model

In reply to Simon Glass

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.

---

 drivers/net/designware.c | 87 +++++++++++++++++++++++++++++-------------------
 1 file changed, 53 insertions(+), 34 deletions(-)
drivers/net/designware.c +53 -34
index c03e935..834bff2 100644
@@ -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);
 }
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#21 lore raw

RFC PATCH 10/13 dm: net: Tidy up designware driver ready for driver model

Hi Simon,

Quoted 9 lines · Simon Glass

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.

Quoted 1 line
#22 lore raw

RFC PATCH 11/13 dm: net: Adjust designware driver to support driver model

In reply to Simon Glass

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

---

 drivers/net/designware.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/designware.h |   3 +-
 2 files changed, 109 insertions(+), 1 deletion(-)
drivers/net/designware.c +107 -0
index 834bff2..2d47609 100644
@@ -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
drivers/net/designware.h +2 -1
index ce51102..bdaf38f 100644
@@ -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;
 };
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#24 lore raw

RFC PATCH 12/13 dm: sunxi: Support driver model for Ethernet

In reply to Simon Glass

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.

---

 board/sunxi/gmac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
board/sunxi/gmac.c +8 -3
index 8849132..ce7831d 100644
@@ -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
 }
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#25 lore raw

RFC PATCH 12/13 dm: sunxi: Support driver model for Ethernet

Hi Simon,

Quoted 17 lines · Simon Glass

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.

---

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

board/sunxi/gmac.c int sunxi_gmac_initialize(bd_t *bis) · line 84

Quoted 6 lines
board/sunxi/gmac.c +2 -1
@@ -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?

board/sunxi/gmac.c int sunxi_gmac_initialize(bd_t *bis)

Quoted 4 lines
board/sunxi/gmac.c +3 -0
+       return 0;
+#else
+# ifdef CONFIG_RGMII
        return designware_initialize(SUNXI_GMAC_BASE,

PHY_INTERFACE_MODE_RGMII);

board/sunxi/gmac.c int sunxi_gmac_initialize(bd_t *bis)

Quoted 3 lines
board/sunxi/gmac.c +1 -1
-#elif defined CONFIG_GMII
+# elif defined CONFIG_GMII
        return designware_initialize(SUNXI_GMAC_BASE,

PHY_INTERFACE_MODE_GMII);

board/sunxi/gmac.c int sunxi_gmac_initialize(bd_t *bis)

Quoted 3 lines
board/sunxi/gmac.c +1 -1
-#else
+# else
        return designware_initialize(SUNXI_GMAC_BASE,

PHY_INTERFACE_MODE_MII);

Quoted 6 lines
board/sunxi/gmac.c +1 -1
+# endif
 #endif
 }
--

2.2.0.rc0.207.ga3a616c

#26 lore raw

RFC PATCH 12/13 dm: sunxi: Support driver model for Ethernet

In reply to Simon Glass
Quoted 4 lines · Simon Glass

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...)

Quoted 31 lines

---

 board/sunxi/gmac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
board/sunxi/gmac.c +8 -3
index 8849132..ce7831d 100644
@@ -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
 }
#27 lore raw

RFC PATCH 12/13 dm: sunxi: Support driver model for Ethernet

Hi Ian,

Quoted 8 lines · Ian Campbell
Quoted 4 lines · Simon Glass

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.

Quoted 5 lines

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

Quoted 2 lines

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

Yes

Quoted 5 lines

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.

Quoted 15 lines
Quoted 15 lines

---

 board/sunxi/gmac.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
board/sunxi/gmac.c +0 -0
index 8849132..ce7831d 100644
@@ -80,11 +80,16 @@ int sunxi_gmac_initialize(bd_t *bis)
              sunxi_gpio_set_cfgpin(pin, SUN6I_GPA0_GMAC);
 #endif
 
Quoted 18 lines
Quoted 6 lines
board/sunxi/gmac.c +5 -1
-#ifdef CONFIG_RGMII
+#ifdef CONFIG_DM_ETH
+     printf("eth init\n");
+     return 0;
+#else
+# ifdef CONFIG_RGMII

board/sunxi/gmac.c int sunxi_gmac_initialize(bd_t *bis) · line 95

Quoted 10 lines
board/sunxi/gmac.c +3 -2
      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

#28 lore raw

RFC PATCH 13/13 dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3

In reply to Simon Glass

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

---

 configs/Linksprite_pcDuino3_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/Linksprite_pcDuino3_defconfig +1 -0
index b5ff120..776588d 100644
@@ -19,3 +19,4 @@ CONFIG_SYS_MALLOC_F_LEN=0x400
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_NETDEVICES=y
 CONFIG_NET=y
+CONFIG_DM_ETH=y
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#29 lore raw

RFC PATCH 13/13 dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3

Quoted 7 lines · Simon Glass

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?

Quoted 12 lines

---

 configs/Linksprite_pcDuino3_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/Linksprite_pcDuino3_defconfig +0 -0
index b5ff120..776588d 100644

configs/Linksprite_pcDuino3_defconfig CONFIG_SYS_MALLOC_F_LEN=0x400 · line 22

Quoted 4 lines
configs/Linksprite_pcDuino3_defconfig +1 -0
@@ -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.

#30 lore raw

RFC PATCH 13/13 dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3

Hi Ian,

Quoted 11 lines · Ian Campbell
Quoted 7 lines · Simon Glass

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.

Quoted 7 lines
Quoted 7 lines

---

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

configs/Linksprite_pcDuino3_defconfig CONFIG_SYS_MALLOC_F_LEN=0x400 · line 22

Quoted 9 lines
configs/Linksprite_pcDuino3_defconfig +1 -0
index b5ff120..776588d 100644
@@ -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

#31 lore raw

RFC PATCH 13/13 dm: sunxi: Use driver model for Ethernet on Linksprite pcDuino3

Quoted 7 lines · Simon Glass
Quoted 3 lines
Quoted 1 line

+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.

#32 lore raw

RFC PATCH 1/13 Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING

In reply to Simon Glass
Quoted 3 lines · Simon Glass

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

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.

Signature · 8 lines
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>
#33 lore raw

RFC PATCH 1/13 Use 'U-Boot' instead of 'U-boot' in CONFIG_BOOTP_VCI_STRING

Hi Tom,

Quoted 6 lines · Tom Rini
Quoted 3 lines · Simon Glass

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

Quoted 8 lines

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