Skip to contentSkip to conversation

AM335x: Add USB support in u-boot.

PATCH Superseded Harman Sohanpal 2 participants 5 messages Jun 22, 2012

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover AM335x: Add USB support in u-boot.

These patches add usb support in u-boot for AM335x. I have tested this code on AM335x evm and beaglebone in the host mode using mass storage class.

Gene Zarkhin (1):
AM335x : Add USB support for AM335x in u-boot

Harman Sohanpal (2):
AM335x : Configs to add USB host support.
musb_udc : Fix compile warning.

 drivers/usb/musb/Makefile    |    1 +
 drivers/usb/musb/am335x.c    |  121 ++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/am335x.h    |  113 +++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/musb_core.h |    2 +
 drivers/usb/musb/musb_hcd.h  |    3 -
 include/configs/am335x_evm.h |   41 ++++++++++++++
 include/usb.h                |    3 +-
 7 files changed, 280 insertions(+), 4 deletions(-)
 create mode 100644 drivers/usb/musb/am335x.c
 create mode 100644 drivers/usb/musb/am335x.h
#1 lore raw

PATCH 1/3 AM335x : Add USB support for AM335x in u-boot

From: Gene Zarkhin <[email protected]>

This patch adds USB support in uboot for AM335x. By default the USB 1 module is enabled.
The support for USB 0 can be enabled by changing the USB base address and the phy control register address in the header file am335x.h.

---
 drivers/usb/musb/Makefile |    1 +
 drivers/usb/musb/am335x.c |  121 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/musb/am335x.h |  113 ++++++++++++++++++++++++++++++++++++++++++
 include/usb.h             |    3 +-
 4 files changed, 237 insertions(+), 1 deletions(-)
 create mode 100644 drivers/usb/musb/am335x.c
 create mode 100644 drivers/usb/musb/am335x.h
drivers/usb/musb/Makefile +1 -0
index 20b5503..d00ec40 100644
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_USB_DAVINCI) += davinci.o
 COBJS-$(CONFIG_USB_OMAP3) += omap3.o
 COBJS-$(CONFIG_USB_DA8XX) += da8xx.o
 COBJS-$(CONFIG_USB_AM35X) += am35x.o
+COBJS-$(CONFIG_USB_AM335X) += am335x.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/usb/musb/am335x.c new file +121 -0

121 lines not on this page · raw message

drivers/usb/musb/am335x.h new file +113 -0

113 lines not on this page · raw message

include/usb.h +2 -1
index 6da91e7..13f5434 100644
@@ -141,7 +141,8 @@ struct usb_device {
 	defined(CONFIG_USB_SL811HS) || defined(CONFIG_USB_ISP116X_HCD) || \
 	defined(CONFIG_USB_R8A66597_HCD) || defined(CONFIG_USB_DAVINCI) || \
 	defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
-	defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X)
+	defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) || \
+	defined(CONFIG_USB_AM335X)
 
 int usb_lowlevel_init(void);
 int usb_lowlevel_stop(void);
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/3 AM335x : Configs to add USB host support.

In reply to Harman Sohanpal

This patch adds required configs in config file for am335x_evm to add support for usb host mode. To enable USB device mode, add CONFIG_MUSB_UDC in place of CONFIG_MUSB_HCD

---
 include/configs/am335x_evm.h |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)
include/configs/am335x_evm.h +41 -0
index d0fbc88..d19f914 100644
@@ -165,6 +165,47 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #endif
 
+
+/*
+ * USB configuration
+ * Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard
+ * Enable CONFIG_MUSB_UDC for Device functionalities.
+ */
+#define CONFIG_USB_AM335X                1
+#define CONFIG_MUSB_HCD                 1
+
+#ifdef CONFIG_USB_AM335X
+
+#ifdef CONFIG_MUSB_HCD
+#define CONFIG_CMD_USB
+
+#define CONFIG_USB_STORAGE
+#define CONGIG_CMD_STORAGE
+#define CONFIG_CMD_FAT
+
+#ifdef CONFIG_USB_KEYBOARD
+#define CONFIG_SYS_USB_EVENT_POLL
+#define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+/* USB device configuration */
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_USB_DEVICE               1
+#define CONFIG_USB_TTY                  1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV    1
+#endif	/* CONFIG_SPL_BUILD */
+/* Change these to suit your needs */
+#define CONFIG_USBD_VENDORID            0x0451
+#define CONFIG_USBD_PRODUCTID           0x5678
+#define CONFIG_USBD_MANUFACTURER        "Texas Instruments"
+#define CONFIG_USBD_PRODUCT_NAME        "AM335xEVM"
+#endif /* CONFIG_MUSB_UDC */
+
+#endif /* CONFIG_USB_AM335X */
+
 /* Unsupported features */
 #undef CONFIG_USE_IRQ
 
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 2/3 AM335x : Configs to add USB host support.

Quoted 17 lines · On Friday 22 June 2012 08:17:15 Harman Sohanpal wrote:

This patch adds required configs in config file for am335x_evm to add support for usb host mode. To enable USB device mode, add CONFIG_MUSB_UDC in place of CONFIG_MUSB_HCD

---
 include/configs/am335x_evm.h |   41

+++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+), 0 deletions(-)

include/configs/am335x_evm.h +0 -0
index d0fbc88..d19f914 100644
@@ -165,6 +165,47 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT

include/configs/am335x_evm.h line 175

Quoted 10 lines
include/configs/am335x_evm.h +8 -0
 #endif
 
+
+/*
+ * USB configuration
+ * Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard
+ * Enable CONFIG_MUSB_UDC for Device functionalities.
+ */
+#define CONFIG_USB_AM335X                1
+#define CONFIG_MUSB_HCD                 1

Please don't add the "1" to the defines. Simply define the value, thats enough.

Quoted 13 lines
include/configs/am335x_evm.h +13 -0
+
+#ifdef CONFIG_USB_AM335X
+
+#ifdef CONFIG_MUSB_HCD
+#define CONFIG_CMD_USB
+
+#define CONFIG_USB_STORAGE
+#define CONGIG_CMD_STORAGE
+#define CONFIG_CMD_FAT
+
+#ifdef CONFIG_USB_KEYBOARD
+#define CONFIG_SYS_USB_EVENT_POLL
+#define CONFIG_PREBOOT "usb start"

include/configs/am335x_evm.h line 198

Quoted 10 lines
include/configs/am335x_evm.h +10 -0
+#endif /* CONFIG_USB_KEYBOARD */
+
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+/* USB device configuration */
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_USB_DEVICE               1
+#define CONFIG_USB_TTY                  1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV    1

Here again. No "1" please.

Thanks,
Stefan

#4 lore raw

PATCH 3/3 musb_udc : Fix compile warning.

In reply to Harman Sohanpal

This patch fix the compile warning :
implicit declaration of musb_platform_init
when CONFIG_MUSB_UDC is defined.
The extern musb_platform_init was declared in musb_hcd.h but no such extern function was declared for musb_udc. So a common function has been declared in musb_core.h which can be used for both host mode and device mode.

---
 drivers/usb/musb/musb_core.h |    2 ++
 drivers/usb/musb/musb_hcd.h  |    3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_core.h +2 -0
index a8adcce..14253f0 100644
@@ -360,6 +360,8 @@ extern void musb_start(void);
 extern void musb_configure_ep(const struct musb_epinfo *epinfo, u8 cnt);
 extern void write_fifo(u8 ep, u32 length, void *fifo_data);
 extern void read_fifo(u8 ep, u32 length, void *fifo_data);
+extern int musb_platform_init(void);
+extern void musb_platform_deinit(void);
 
 #if defined(CONFIG_USB_BLACKFIN)
 /* Every USB register is accessed as a 16-bit even if the value itself
drivers/usb/musb/musb_hcd.h +0 -3
index dde7d37..5621f7e 100644
@@ -105,8 +105,5 @@ extern unsigned char new[];
 #define RH_REQ_ERR		   -1
 #define RH_NACK			   0x00
 
-/* extern functions */
-extern int musb_platform_init(void);
-extern void musb_platform_deinit(void);
 
 #endif	/* __MUSB_HCD_H__ */
Signature · 1 line
1.7.0.4