Skip to contentSkip to conversation

ARM: atmel: enable usb ethernet gadget

PATCH New Bo Shen 2 participants 13 messages Dec 3, 2014 – Jan 19, 2015

Subsystems (2)
lore
Share & tools
lore

Bo Shen

author
#0 lore raw

cover 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(-)
Signature · 1 line
2.1.0.24.g4109c28
author
#1 lore raw

PATCH 1/6 ARM: atmel: sama5d4: add usb platform data

The SAMA5D4 has the same usb platform data with SAMA5D3 SoC.

---

 arch/arm/include/asm/arch-at91/atmel_usba_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/arch-at91/atmel_usba_udc.h +1 -1
index 6f540d2..38b5012 100644
@@ -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),
Signature · 1 line
2.1.0.24.g4109c28
#2 lore raw

PATCH 1/6 ARM: atmel: sama5d4: add usb platform data

Dear Bo Shen,

Quoted 7 lines · Bo Shen

The SAMA5D4 has the same usb platform data with SAMA5D3 SoC.

---

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

author
#3 lore raw

PATCH 2/6 ARM: atmel: sama5d4: add usb device initial code

In reply to Bo Shen

---

 arch/arm/cpu/armv7/at91/sama5d4_devices.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/cpu/armv7/at91/sama5d4_devices.c +16 -0
index 2708097..7469825 100644
@@ -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
Signature · 1 line
2.1.0.24.g4109c28
#4 lore raw

PATCH 2/6 ARM: atmel: sama5d4: add usb device initial code

Dear Bo Shen,

Quoted 5 lines · Bo Shen

---

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

author
#5 lore raw

PATCH 3/6 ARM: atmel: sama5d4ek: add option for usb ethernet gadget

In reply to Bo Shen

Add the option for USB Ethernet gadget based on atmel usb device.

---

 board/atmel/sama5d4ek/sama5d4ek.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
board/atmel/sama5d4ek/sama5d4ek.c +11 -0
index f8394f5..e014e0a 100644
@@ -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;
 }
Signature · 1 line
2.1.0.24.g4109c28
#6 lore raw

PATCH 3/6 ARM: atmel: sama5d4ek: add option for usb ethernet gadget

Dear Bo Shen,

Quoted 8 lines · Bo Shen

Add the option for USB Ethernet gadget based on atmel usb device.

---

board/atmel/sama5d4ek/sama5d4ek.c | 11 +++++++++++

1 file changed, 11 insertions(+)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

author
#7 lore raw

PATCH 4/6 ARM: atmel: sama5d4ek: enable usb ethernet gadget

In reply to Bo Shen

---

 include/configs/sama5d4ek.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/configs/sama5d4ek.h +8 -0
index cbdb3a2..09ab4d7 100644
@@ -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
Signature · 1 line
2.1.0.24.g4109c28
#8 lore raw

PATCH 4/6 ARM: atmel: sama5d4ek: enable usb ethernet gadget

Dear Bo Shen,

Quoted 5 lines · Bo Shen

---

include/configs/sama5d4ek.h | 8 ++++++++

1 file changed, 8 insertions(+)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

author
#9 lore raw

PATCH 5/6 ARM: atmel: sama5d4_xplained: add option for usb ethernet gadget

In reply to Bo Shen

Add the option for USB Ethernet gadget based on atmel usb device.

---

 board/atmel/sama5d4_xplained/sama5d4_xplained.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
board/atmel/sama5d4_xplained/sama5d4_xplained.c +11 -0
index de0baad..93bebd4 100644
@@ -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;
 }
Signature · 1 line
2.1.0.24.g4109c28
#10 lore raw

PATCH 5/6 ARM: atmel: sama5d4_xplained: add option for usb ethernet gadget

Dear Bo Shen,

Quoted 8 lines · Bo Shen

Add the option for USB Ethernet gadget based on atmel usb device.

---

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

author
#11 lore raw

PATCH 6/6 ARM: atmel: sama5d4_xplained: enable usb ethernet gadget

In reply to Bo Shen

---

 include/configs/sama5d4_xplained.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/configs/sama5d4_xplained.h +8 -0
index 104edef..996973d 100644
@@ -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
Signature · 1 line
2.1.0.24.g4109c28
#12 lore raw

PATCH 6/6 ARM: atmel: sama5d4_xplained: enable usb ethernet gadget

Dear Bo Shen,

Quoted 5 lines · Bo Shen

---

include/configs/sama5d4_xplained.h | 8 ++++++++

1 file changed, 8 insertions(+)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann