Merge "hsusb: Add support for secondary USB port on DB8074"
diff --git a/platform/msm8974/include/platform/iomap.h b/platform/msm8974/include/platform/iomap.h
index 4d7433e..5e91af2 100644
--- a/platform/msm8974/include/platform/iomap.h
+++ b/platform/msm8974/include/platform/iomap.h
@@ -90,6 +90,7 @@
#define MSM_CE2_BAM_BASE 0xFD444000
#define MSM_CE2_BASE 0xFD45A000
+#define USB2_PHY_SEL 0xFD4AB000
#define TLMM_BASE_ADDR 0xFD510000
#define GPIO_CONFIG_ADDR(x) (TLMM_BASE_ADDR + 0x1000 + (x)*0x10)
diff --git a/target/msm8974/init.c b/target/msm8974/init.c
index 73540b4..2bbc017 100644
--- a/target/msm8974/init.c
+++ b/target/msm8974/init.c
@@ -40,6 +40,8 @@
#include <dev/keys.h>
#include <pm8x41.h>
#include <crypto5_wrapper.h>
+#include <hsusb.h>
+#include <clock.h>
extern bool target_use_signed_kernel(void);
@@ -295,6 +297,36 @@
dprintf(CRITICAL, "Rebooting failed\n");
}
+/* Do target specific usb initialization */
+void target_usb_init(void)
+{
+ /* Enable secondary USB PHY on DragonBoard8074 */
+ if (board_hardware_id() == HW_PLATFORM_DRAGON) {
+ /* Route ChipIDea to use secondary USB HS port2 */
+ writel_relaxed(1, USB2_PHY_SEL);
+
+ /* Enable access to secondary PHY by clamping the low
+ * voltage interface between DVDD of the PHY and Vddcx
+ * (set bit16 (USB2_PHY_HS2_DIG_CLAMP_N_2) = 1) */
+ writel_relaxed(readl_relaxed(USB_OTG_HS_PHY_SEC_CTRL)
+ | 0x00010000, USB_OTG_HS_PHY_SEC_CTRL);
+
+ /* Perform power-on-reset of the PHY.
+ * Delay values are arbitrary */
+ writel_relaxed(readl_relaxed(USB_OTG_HS_PHY_CTRL)|1,
+ USB_OTG_HS_PHY_CTRL);
+ thread_sleep(10);
+ writel_relaxed(readl_relaxed(USB_OTG_HS_PHY_CTRL) & 0xFFFFFFFE,
+ USB_OTG_HS_PHY_CTRL);
+ thread_sleep(10);
+
+ /* Enable HSUSB PHY port for ULPI interface,
+ * then configure related parameters within the PHY */
+ writel_relaxed(((readl_relaxed(USB_PORTSC) & 0xC0000000)
+ | 0x8c000004), USB_PORTSC);
+ }
+}
+
/* Returns 1 if target supports continuous splash screen. */
int target_cont_splash_screen()
{