[U-Boot] [PATCH 0/6] ARM: atmel: enable usb ethernet gadget

This patch set enable the usb ethernet on SAMA5D4 base boards, including sama5d4ek and sama5d4_xplained board.
Bo Shen (6): ARM: atmel: sama5d4: add usb platform data ARM: atmel: sama5d4: add usb device initial code ARM: atmel: sama5d4ek: add option for usb ethernet gadget ARM: atmel: sama5d4ek: enable usb ethernet gadget ARM: atmel: sama5d4_xplained: add option for usb ethernet gadget ARM: atmel: sama5d4_xplained: enable usb ethernet gadget
arch/arm/cpu/armv7/at91/sama5d4_devices.c | 16 ++++++++++++++++ arch/arm/include/asm/arch-at91/atmel_usba_udc.h | 2 +- board/atmel/sama5d4_xplained/sama5d4_xplained.c | 11 +++++++++++ board/atmel/sama5d4ek/sama5d4ek.c | 11 +++++++++++ include/configs/sama5d4_xplained.h | 8 ++++++++ include/configs/sama5d4ek.h | 8 ++++++++ 6 files changed, 55 insertions(+), 1 deletion(-)

The SAMA5D4 has the same usb platform data with SAMA5D3 SoC.
Signed-off-by: Bo Shen voice.shen@atmel.com ---
arch/arm/include/asm/arch-at91/atmel_usba_udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/arch-at91/atmel_usba_udc.h b/arch/arm/include/asm/arch-at91/atmel_usba_udc.h index 6f540d2..38b5012 100644 --- a/arch/arm/include/asm/arch-at91/atmel_usba_udc.h +++ b/arch/arm/include/asm/arch-at91/atmel_usba_udc.h @@ -31,7 +31,7 @@ static struct usba_ep_data usba_udc_ep[] = { EP("ep5", 5, 1024, 3, 1, 1), EP("ep6", 6, 1024, 3, 1, 1), }; -#elif defined(CONFIG_SAMA5D3) +#elif defined(CONFIG_SAMA5D3) || defined(CONFIG_SAMA5D4) static struct usba_ep_data usba_udc_ep[] = { EP("ep0", 0, 64, 1, 0, 0), EP("ep1", 1, 1024, 3, 1, 0),

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
The SAMA5D4 has the same usb platform data with SAMA5D3 SoC.
Signed-off-by: Bo Shen voice.shen@atmel.com
arch/arm/include/asm/arch-at91/atmel_usba_udc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Signed-off-by: Bo Shen voice.shen@atmel.com ---
arch/arm/cpu/armv7/at91/sama5d4_devices.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/arch/arm/cpu/armv7/at91/sama5d4_devices.c b/arch/arm/cpu/armv7/at91/sama5d4_devices.c index 2708097..7469825 100644 --- a/arch/arm/cpu/armv7/at91/sama5d4_devices.c +++ b/arch/arm/cpu/armv7/at91/sama5d4_devices.c @@ -6,6 +6,10 @@ */
#include <common.h> +#include <asm/io.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/clk.h> #include <asm/arch/sama5d4.h>
char *get_cpu_name() @@ -28,3 +32,15 @@ char *get_cpu_name() else return "Unknown CPU type"; } + +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +void at91_udp_hw_init(void) +{ + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; + + /* Enable UPLL clock */ + writel(AT91_PMC_UPLLEN | AT91_PMC_BIASEN, &pmc->uckr); + /* Enable UDPHS clock */ + at91_periph_clk_enable(ATMEL_ID_UDPHS); +} +#endif

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
Signed-off-by: Bo Shen voice.shen@atmel.com
arch/arm/cpu/armv7/at91/sama5d4_devices.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Add the option for USB Ethernet gadget based on atmel usb device.
Signed-off-by: Bo Shen voice.shen@atmel.com ---
board/atmel/sama5d4ek/sama5d4ek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/board/atmel/sama5d4ek/sama5d4ek.c b/board/atmel/sama5d4ek/sama5d4ek.c index f8394f5..e014e0a 100644 --- a/board/atmel/sama5d4ek/sama5d4ek.c +++ b/board/atmel/sama5d4ek/sama5d4ek.c @@ -10,6 +10,7 @@ #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> #include <asm/arch/at91_rstc.h> +#include <asm/arch/atmel_usba_udc.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h> #include <asm/arch/sama5d3_smc.h> @@ -294,6 +295,9 @@ int board_init(void) #ifdef CONFIG_CMD_USB sama5d4ek_usb_hw_init(); #endif +#ifdef CONFIG_USB_GADGET_ATMEL_USBA + at91_udp_hw_init(); +#endif
return 0; } @@ -313,5 +317,12 @@ int board_eth_init(bd_t *bis) rc = macb_eth_initialize(0, (void *)ATMEL_BASE_GMAC0, 0x00); #endif
+#ifdef CONFIG_USB_GADGET_ATMEL_USBA + usba_udc_probe(&pdata); +#ifdef CONFIG_USB_ETH_RNDIS + usb_eth_initialize(bis); +#endif +#endif + return rc; }

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
Add the option for USB Ethernet gadget based on atmel usb device.
Signed-off-by: Bo Shen voice.shen@atmel.com
board/atmel/sama5d4ek/sama5d4ek.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Signed-off-by: Bo Shen voice.shen@atmel.com ---
include/configs/sama5d4ek.h | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index cbdb3a2..09ab4d7 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -121,6 +121,14 @@ #define CONFIG_USB_STORAGE #endif
+/* USB device */ +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_ATMEL_USBA +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D4EK" + #if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC) #define CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
Signed-off-by: Bo Shen voice.shen@atmel.com
include/configs/sama5d4ek.h | 8 ++++++++ 1 file changed, 8 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Add the option for USB Ethernet gadget based on atmel usb device.
Signed-off-by: Bo Shen voice.shen@atmel.com ---
board/atmel/sama5d4_xplained/sama5d4_xplained.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/board/atmel/sama5d4_xplained/sama5d4_xplained.c b/board/atmel/sama5d4_xplained/sama5d4_xplained.c index de0baad..93bebd4 100644 --- a/board/atmel/sama5d4_xplained/sama5d4_xplained.c +++ b/board/atmel/sama5d4_xplained/sama5d4_xplained.c @@ -10,6 +10,7 @@ #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> #include <asm/arch/at91_rstc.h> +#include <asm/arch/atmel_usba_udc.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h> #include <asm/arch/sama5d3_smc.h> @@ -296,6 +297,9 @@ int board_init(void) #ifdef CONFIG_CMD_USB sama5d4_xplained_usb_hw_init(); #endif +#ifdef CONFIG_USB_GADGET_ATMEL_USBA + at91_udp_hw_init(); +#endif
return 0; } @@ -315,5 +319,12 @@ int board_eth_init(bd_t *bis) rc = macb_eth_initialize(0, (void *)ATMEL_BASE_GMAC0, 0x00); #endif
+#ifdef CONFIG_USB_GADGET_ATMEL_USBA + usba_udc_probe(&pdata); +#ifdef CONFIG_USB_ETH_RNDIS + usb_eth_initialize(bis); +#endif +#endif + return rc; }

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
Add the option for USB Ethernet gadget based on atmel usb device.
Signed-off-by: Bo Shen voice.shen@atmel.com
board/atmel/sama5d4_xplained/sama5d4_xplained.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Signed-off-by: Bo Shen voice.shen@atmel.com ---
include/configs/sama5d4_xplained.h | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index 104edef..996973d 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -121,6 +121,14 @@ #define CONFIG_USB_STORAGE #endif
+/* USB device */ +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_ATMEL_USBA +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D4EK" + #if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC) #define CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION

Dear Bo Shen,
Bo Shen voice.shen@atmel.com writes:
Signed-off-by: Bo Shen voice.shen@atmel.com
include/configs/sama5d4_xplained.h | 8 ++++++++ 1 file changed, 8 insertions(+)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann
participants (2)
-
Andreas Bießmann
-
Bo Shen