[msm7630]: Enable the clock locally for USB.
Early boot chain does not enable USB clock and apps bootloader enables it now.
Change-Id: I3fc8b8957d07eb4deac4f1a0391f374203c1ccd0
diff --git a/platform/msm_shared/hsusb.c b/platform/msm_shared/hsusb.c
index 9c7e02d..88e4eae 100644
--- a/platform/msm_shared/hsusb.c
+++ b/platform/msm_shared/hsusb.c
@@ -565,16 +565,44 @@
writel(val, USB_HS1_XVCR_FS_CLK_NS);
}
+void hsusb_7x30_clock_init(void)
+{
+ int val = 0;
+
+ /* Enable USBH_P_CLK */
+ val = 1 << 25;
+ val = val | readl(SH2_GLBL_CLK_ENA_SC);
+ writel(val, SH2_GLBL_CLK_ENA_SC);
+
+ /* Set value in MD register */
+ val = 0x5DF;
+ writel(val, SH2_USBH_MD_REG);
+
+ /* Set value in NS register */
+ val = 1 << 8;
+ val = val | readl(SH2_USBH_NS_REG);
+ writel(val, SH2_USBH_NS_REG);
+
+ val = 1 << 11;
+ val = val | readl(SH2_USBH_NS_REG);
+ writel(val, SH2_USBH_NS_REG);
+
+ val = 1 << 9;
+ val = val | readl(SH2_USBH_NS_REG);
+ writel(val, SH2_USBH_NS_REG);
+
+ val = 1 << 13;
+ val = val | readl(SH2_USBH_NS_REG);
+ writel(val, SH2_USBH_NS_REG);
+}
+
void hsusb_clock_init(void)
{
// Enable usb clocks from apps processor for 7x30.
// USB clocks already initialized for other targets
// so skipping proc comm call to enable usb clocks.
#ifdef PLATFORM_MSM7X30
- writel(0x00000100, USBH_NS_REG);
- writel(0x00000900, USBH_NS_REG);
- writel(0x00000A00, USBH_NS_REG);
- writel(0x00002A00, USBH_NS_REG);
+ hsusb_7x30_clock_init();
#elif PLATFORM_MSM8X60
hsusb_8x60_clock_init();
#endif
diff --git a/platform/msm_shared/hsusb.h b/platform/msm_shared/hsusb.h
index 0035851..791d87b 100644
--- a/platform/msm_shared/hsusb.h
+++ b/platform/msm_shared/hsusb.h
@@ -172,9 +172,10 @@
#define ULPI_ADDR(n) (((n) & 255) << 16)
#define ULPI_DATA(n) ((n) & 255)
#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
-#ifdef PLATFORM_MSM7X30
-#define USBH_NS_REG (0xAB8002C0)
-#endif
+/* For 7x30 */
+#define SH2_USBH_MD_REG (0xABA012BC)
+#define SH2_USBH_NS_REG (0xABA012C0)
+#define SH2_GLBL_CLK_ENA_SC (0xABA013BC)
/* for USB charging */
#define TRUE 1