Patchwork [U-Boot,RFC,v3,5/7] omap5: usb: Add usb otg clocks and enable

login
register
mail settings
Submitter Dan Murphy
Date July 2, 2013, 3:15 p.m.
Message ID <1372778113-26053-6-git-send-email-dmurphy@ti.com>
Download mbox | patch
Permalink /patch/256450/
State RFC
Delegated to: Marek Vasut
Headers show

Comments

Dan Murphy - July 2, 2013, 3:15 p.m.
Add and enable the USB OTG clocks.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 arch/arm/cpu/armv7/omap5/hw_data.c      |   14 ++++++++++++++
 arch/arm/cpu/armv7/omap5/prcm-regs.c    |    1 +
 arch/arm/include/asm/arch-omap5/clock.h |    4 ++++
 arch/arm/include/asm/omap_common.h      |    1 +
 common/cmd_usb.c                        |    6 +++++-
 include/configs/omap5_common.h          |    9 +++++++++
 6 files changed, 34 insertions(+), 1 deletion(-)

Patch

diff --git a/arch/arm/cpu/armv7/omap5/hw_data.c b/arch/arm/cpu/armv7/omap5/hw_data.c
index 56cf1f8..7b88338 100644
--- a/arch/arm/cpu/armv7/omap5/hw_data.c
+++ b/arch/arm/cpu/armv7/omap5/hw_data.c
@@ -456,6 +456,20 @@  void enable_basic_clocks(void)
 			OPTFCLKEN_SCRM_PER_MASK);
 	setbits_le32((*prcm)->cm_wkupaon_scrm_clkctrl,
 			OPTFCLKEN_SCRM_CORE_MASK);
+
+/* TODO wrap this with USB defines */
+	/* Setting OCP2SCP1 register */
+	setbits_le32((*prcm)->cm_l3init_ocp2scp1_clkctrl,
+			MODULE_CLKCTRL_MODULEMODE_HW_AUTO);
+
+	/* Select USB OTG SS clock */
+	setbits_le32((*prcm)->cm_l3init_usb_otg_ss_clkctrl,
+			(MODULE_CLKCTRL_MODULEMODE_HW_AUTO |
+			 OPTFCLKEN_USB_OTG_SS_FCLK_MASK));
+
+	/* Setting l3init register */
+	setbits_le32((*prcm)->cm_l3init_clkstctrl, OPTFCLKEN_USB_OTG_SS_FCLK_MASK);
+
 }
 
 void enable_basic_uboot_clocks(void)
diff --git a/arch/arm/cpu/armv7/omap5/prcm-regs.c b/arch/arm/cpu/armv7/omap5/prcm-regs.c
index e839ff5..f90da58 100644
--- a/arch/arm/cpu/armv7/omap5/prcm-regs.c
+++ b/arch/arm/cpu/armv7/omap5/prcm-regs.c
@@ -718,6 +718,7 @@  struct prcm_regs const omap5_es2_prcm = {
 	.cm_l3init_p1500_clkctrl = 0x4a009678,
 	.cm_l3init_fsusb_clkctrl = 0x4a0096d0,
 	.cm_l3init_ocp2scp1_clkctrl = 0x4a0096e0,
+	.cm_l3init_usb_otg_ss_clkctrl = 0x4a0096f0,
 
 	/* prm irqstatus regs */
 	.prm_irqstatus_mpu_2 = 0x4ae06014,
diff --git a/arch/arm/include/asm/arch-omap5/clock.h b/arch/arm/include/asm/arch-omap5/clock.h
index 4d2765d..24ef2bc 100644
--- a/arch/arm/include/asm/arch-omap5/clock.h
+++ b/arch/arm/include/asm/arch-omap5/clock.h
@@ -165,6 +165,10 @@ 
 /* CM_L3INIT_USBPHY_CLKCTRL */
 #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK	8
 
+/* CM_L3INIT_USB_OTG_SS_CLKCTRL */
+#define OPTFCLKEN_USB_OTG_SS_FCLK_SHIFT		8
+#define OPTFCLKEN_USB_OTG_SS_FCLK_MASK		(1 << 8)
+
 /* CM_MPU_MPU_CLKCTRL */
 #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_SHIFT	24
 #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK	(3 << 24)
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 0dbe81b..11cc870 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -241,6 +241,7 @@  struct prcm_regs {
 	u32 cm_l3init_p1500_clkctrl;
 	u32 cm_l3init_fsusb_clkctrl;
 	u32 cm_l3init_ocp2scp1_clkctrl;
+	u32 cm_l3init_usb_otg_ss_clkctrl;
 
 	u32 prm_irqstatus_mpu_2;
 
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 70e803b..816fb23 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -31,6 +31,7 @@ 
 #include <asm/unaligned.h>
 #include <part.h>
 #include <usb.h>
+#include <linux/usb/usb-compat.h>
 
 #ifdef CONFIG_USB_STORAGE
 static int usb_stor_curr_dev = -1; /* current device */
@@ -160,6 +161,7 @@  static void usb_display_string(struct usb_device *dev, int index)
 
 static void usb_display_desc(struct usb_device *dev)
 {
+#if 0
 	if (dev->descriptor.bDescriptorType == USB_DT_DEVICE) {
 		printf("%d: %s,  USB Revision %x.%x\n", dev->devnum,
 		usb_get_class_desc(dev->config.if_desc[0].desc.bInterfaceClass),
@@ -189,7 +191,7 @@  static void usb_display_desc(struct usb_device *dev)
 			(dev->descriptor.bcdDevice>>8) & 0xff,
 			dev->descriptor.bcdDevice & 0xff);
 	}
-
+#endif
 }
 
 static void usb_display_conf_desc(struct usb_config_descriptor *config,
@@ -350,10 +352,12 @@  static void usb_show_tree_graph(struct usb_device *dev, char *pre)
 	pre[index++] = ' ';
 	pre[index++] = has_child ? '|' : ' ';
 	pre[index] = 0;
+#if 0
 	printf(" %s (%s, %dmA)\n", usb_get_class_desc(
 					dev->config.if_desc[0].desc.bInterfaceClass),
 					portspeed(dev->speed),
 					dev->config.desc.bMaxPower * 2);
+#endif
 	if (strlen(dev->mf) || strlen(dev->prod) || strlen(dev->serial))
 		printf(" %s  %s %s %s\n", pre, dev->mf, dev->prod, dev->serial);
 	printf(" %s\n", pre);
diff --git a/include/configs/omap5_common.h b/include/configs/omap5_common.h
index b87ee42..1df553e 100644
--- a/include/configs/omap5_common.h
+++ b/include/configs/omap5_common.h
@@ -96,6 +96,15 @@ 
 
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 
+/* USB */
+#define CONFIG_CMD_USB
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_DWC3
+#define CONFIG_USB_DWC3_GADGET
+#define CONFIG_USB_DWC3_DUAL_ROLE
+#define CONFIG_USB_DWC3_OMAP
+#define CONFIG_USB_DWC3_HOST
+
 /* Flash */
 #define CONFIG_SYS_NO_FLASH