Merge "project: mdm9x35: Enable usb3.0 support"
diff --git a/platform/msm_shared/usb30_udc.c b/platform/msm_shared/usb30_udc.c
index ebb1da1..2eea079 100644
--- a/platform/msm_shared/usb30_udc.c
+++ b/platform/msm_shared/usb30_udc.c
@@ -113,13 +113,7 @@
return 0;
}
-static void phy_mux_configure(void)
-{
- /* configuring of hs phy mux is different for some platforms. */
- target_usb_phy_mux_configure();
-}
-
-static void phy_reset(usb_wrapper_dev_t *wrapper)
+static void phy_reset(usb_wrapper_dev_t *wrapper, struct udc_device *dev_info)
{
/* phy reset is different for some platforms. */
if (platform_is_8974() || platform_is_8974Pro())
@@ -131,16 +125,18 @@
* No need for explicit reset.
*/
}
- else if (board_platform_id() == APQ8084)
+ else
{
- target_usb_phy_reset();
+ if (dev_info->t_usb_if->phy_reset)
+ dev_info->t_usb_if->phy_reset();
/* On some CDPs PHY_COMMON reset does not set
* reset values in the phy_ctrl_common register.
* Due to this USB does not get enumerated in fastboot
* Force write the reset value
*/
- usb_wrapper_hs_phy_ctrl_force_write(wrapper);
+ if (board_platform_id() == APQ8084)
+ usb_wrapper_hs_phy_ctrl_force_write(wrapper);
}
}
@@ -164,15 +160,12 @@
/* when vbus signal is not available directly to the controller,
* simulate vbus presense.
*/
- if (board_platform_id() == APQ8084)
- {
- usb_wrapper_vbus_override(dev->wrapper_dev);
- }
+ usb_wrapper_vbus_override(dev->wrapper_dev);
}
/* Initialize usb wrapper and dwc h/w blocks. */
-static void usb30_init(void)
+static void usb30_init(struct udc_device *dev_info)
{
usb_wrapper_dev_t* wrapper;
usb_wrapper_config_t wrapper_config;
@@ -180,6 +173,10 @@
dwc_dev_t *dwc;
dwc_config_t dwc_config;
+ /* initialize usb clocks */
+ if (dev_info->t_usb_if->clock_init)
+ dev_info->t_usb_if->clock_init();
+
/* initialize the usb wrapper h/w block */
wrapper_config.qscratch_base = (void*) MSM_USB30_QSCRATCH_BASE;
@@ -225,7 +222,8 @@
/* section 4.4.2: Initialization and configuration sequences */
/* 1. UTMI Mux configuration */
- phy_mux_configure();
+ if (dev_info->t_usb_if->mux_config)
+ dev_info->t_usb_if->mux_config();
/* 2. Put controller in reset */
dwc_reset(dwc, 1);
@@ -233,7 +231,7 @@
/* Steps 3 - 7 must be done while dwc is in reset condition */
/* 3. Reset PHY */
- phy_reset(wrapper);
+ phy_reset(wrapper, dev_info);
/* 4. SS phy config */
usb_wrapper_ss_phy_configure(wrapper);
@@ -253,6 +251,10 @@
/* 9. */
usb_wrapper_ss_phy_electrical_config(wrapper);
+ /* Perform phy init */
+ if (dev_info->t_usb_if->phy_init)
+ dev_info->t_usb_if->phy_init();
+
/* 10. */
usb_wrapper_workaround_10(wrapper);
@@ -270,7 +272,8 @@
/* If the target does not support vbus detection in controller,
* simulate vbus presence.
*/
- vbus_override(udc_dev);
+ if (dev_info->t_usb_if->vbus_override)
+ vbus_override(udc_dev);
/* 15 - 20 */
dwc_device_init(dwc);
@@ -301,7 +304,7 @@
udc_dev->ept_alloc_table = EPT_TX(0) | EPT_RX(0);
udc_dev->ept_list = NULL;
- usb30_init();
+ usb30_init(dev_info);
/* register descriptors */
udc_register_language_desc(udc_dev);
diff --git a/platform/msm_shared/usb30_wrapper.c b/platform/msm_shared/usb30_wrapper.c
index 5c85b46..7a83c2e 100644
--- a/platform/msm_shared/usb30_wrapper.c
+++ b/platform/msm_shared/usb30_wrapper.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -239,12 +239,6 @@
/* save qscratch base */
wrapper->base = config->qscratch_base;
- /* initialize usb clocks */
- clock_usb30_init();
-
- /* enable ss phy clock */
- pm8x41_diff_clock_ctrl(1);
-
/* HPG: section 4.4.1 Control sequence */
usb_wrapper_dbm_mode(wrapper, DBM_MODE_BYPASS);
diff --git a/project/mdm9635.mk b/project/mdm9635.mk
index 7a246d2..076a6d8 100644
--- a/project/mdm9635.mk
+++ b/project/mdm9635.mk
@@ -18,3 +18,9 @@
#Override linker for mdm targets
LD := $(TOOLCHAIN_PREFIX)ld.bfd
+
+ENABLE_USB30_SUPPORT := 1
+
+ifeq ($(ENABLE_USB30_SUPPORT),1)
+DEFINES += USB30_SUPPORT=1
+endif