[U-Boot] [RFC] [UBOOT] [PATCH 3/4] omap5: usb: Add usb otg clocks and enable

Dan Murphy dmurphy at ti.com
Fri Jun 21 20:27:44 CEST 2013


Add and enable the USB OTG clocks.

Signed-off-by: Dan Murphy <dmurphy at 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/clocks.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 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap5/hw_data.c b/arch/arm/cpu/armv7/omap5/hw_data.c
index 604fa42..8feceb5 100644
--- a/arch/arm/cpu/armv7/omap5/hw_data.c
+++ b/arch/arm/cpu/armv7/omap5/hw_data.c
@@ -394,6 +394,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 e9f6a32..3638095 100644
--- a/arch/arm/cpu/armv7/omap5/prcm-regs.c
+++ b/arch/arm/cpu/armv7/omap5/prcm-regs.c
@@ -708,6 +708,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,
 
 	/* l4 wkup regs */
 	.cm_abe_pll_ref_clksel = 0x4ae0610c,
diff --git a/arch/arm/include/asm/arch-omap5/clocks.h b/arch/arm/include/asm/arch-omap5/clocks.h
index 68afa76..c1eb7d9 100644
--- a/arch/arm/include/asm/arch-omap5/clocks.h
+++ b/arch/arm/include/asm/arch-omap5/clocks.h
@@ -174,6 +174,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 baeef4e..ea962d5 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;
 
 	/* cm2.l4per */
 	u32 cm_l4per_clkstctrl;
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 deb5e9f..ecb4a70 100644
--- a/include/configs/omap5_common.h
+++ b/include/configs/omap5_common.h
@@ -104,6 +104,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
 
-- 
1.7.5.4



More information about the U-Boot mailing list