platform: msm_shared: Add support for HS only mode
Implement changes to configure controller to operate in HS only mode.
Change-Id: Ica51739dd01966180e0f2138acf87f7953863be0
diff --git a/platform/msm_shared/usb30_dwc_hw.c b/platform/msm_shared/usb30_dwc_hw.c
index 86a10a9..3327bca 100644
--- a/platform/msm_shared/usb30_dwc_hw.c
+++ b/platform/msm_shared/usb30_dwc_hw.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013,2015 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
@@ -512,13 +512,17 @@
void dwc_phy_digital_reset(dwc_dev_t *dev)
{
REG_WRITE_FIELDI(dev, GUSB2PHYCFG, 0, PHYSOFTRST, 1);
+#ifndef USE_HSONLY_MODE
REG_WRITE_FIELDI(dev, GUSB3PIPECTL, 0, PHYSOFTRST, 1);
+#endif
/* per HPG */
udelay(100);
REG_WRITE_FIELDI(dev, GUSB2PHYCFG, 0, PHYSOFTRST, 0);
+#ifndef USE_HSONLY_MODE
REG_WRITE_FIELDI(dev, GUSB3PIPECTL, 0, PHYSOFTRST, 0);
+#endif
/* per HPG */
udelay(100);
diff --git a/platform/msm_shared/usb30_udc.c b/platform/msm_shared/usb30_udc.c
index 1c4f71a..0e47c81 100644
--- a/platform/msm_shared/usb30_udc.c
+++ b/platform/msm_shared/usb30_udc.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2015, 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
@@ -232,13 +232,20 @@
/* 2. Put controller in reset */
dwc_reset(dwc, 1);
+ /* HS only mode support */
+#ifdef USE_HSONLY_MODE
+ usb_wrapper_hsonly_mode(wrapper);
+#endif
+
/* Steps 3 - 7 must be done while dwc is in reset condition */
/* 3. Reset PHY */
phy_reset(wrapper, dev_info);
/* 4. SS phy config */
+#ifndef USE_HSONLY_MODE
usb_wrapper_ss_phy_configure(wrapper);
+#endif
/* 5. HS phy init */
usb_wrapper_hs_phy_init(wrapper);
diff --git a/platform/msm_shared/usb30_wrapper.c b/platform/msm_shared/usb30_wrapper.c
index 7a83c2e..6cec193 100644
--- a/platform/msm_shared/usb30_wrapper.c
+++ b/platform/msm_shared/usb30_wrapper.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2015, 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
@@ -166,7 +166,9 @@
REG_WRITE_FIELD(dev, HS_PHY_CTRL, SW_SESSVLD_SEL, 0x1);
/* Indicate power present to SS phy */
+#ifndef USE_HSONLY_MODE
REG_WRITE_FIELD(dev, SS_PHY_CTRL, LANE0_PWR_PRESENT, 0x1);
+#endif
}
/* API to read SS PHY registers */
@@ -252,3 +254,13 @@
{
REG_WRITE(dev, HS_PHY_CTRL_COMMON, 0x00001CB8);
}
+
+void usb_wrapper_hsonly_mode(usb_wrapper_dev_t *dev)
+{
+ REG_WRITE_FIELD(dev, GENERAL_CFG, PIPE_UTMI_CLK_DIS, 0x1);
+ udelay(1);
+ REG_WRITE_FIELD(dev, GENERAL_CFG, PIPE_UTMI_CLK_SEL, 0x1);
+ REG_WRITE_FIELD(dev, GENERAL_CFG, PIPE3_PHYSTATUS_SW, 0x1);
+ udelay(1);
+ REG_WRITE_FIELD(dev, GENERAL_CFG, PIPE_UTMI_CLK_DIS, 0x0);
+}
diff --git a/platform/msm_shared/usb30_wrapper.h b/platform/msm_shared/usb30_wrapper.h
index 5433e6f..25a3afa 100644
--- a/platform/msm_shared/usb30_wrapper.h
+++ b/platform/msm_shared/usb30_wrapper.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013,2015 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
@@ -65,5 +65,5 @@
void usb_wrapper_workaround_11(usb_wrapper_dev_t *dev);
void usb_wrapper_workaround_13(usb_wrapper_dev_t *dev);
void usb_wrapper_hs_phy_ctrl_force_write(usb_wrapper_dev_t *dev);
-
+void usb_wrapper_hsonly_mode(usb_wrapper_dev_t *dev);
#endif
diff --git a/platform/msm_shared/usb30_wrapper_hwio.h b/platform/msm_shared/usb30_wrapper_hwio.h
index 1b5c9f7..6afab35 100644
--- a/platform/msm_shared/usb30_wrapper_hwio.h
+++ b/platform/msm_shared/usb30_wrapper_hwio.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013,2015 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
@@ -120,6 +120,12 @@
#define HWIO_GENERAL_CFG_XHCI_REV_SHFT 0x2
#define HWIO_GENERAL_CFG_DBM_EN_BMSK 0x2
#define HWIO_GENERAL_CFG_DBM_EN_SHFT 0x1
+#define HWIO_GENERAL_CFG_PIPE_UTMI_CLK_DIS_BMSK 0x100
+#define HWIO_GENERAL_CFG_PIPE_UTMI_CLK_DIS_SHFT 0x8
+#define HWIO_GENERAL_CFG_PIPE_UTMI_CLK_SEL_BMSK 0x1
+#define HWIO_GENERAL_CFG_PIPE_UTMI_CLK_SEL_SHFT 0x0
+#define HWIO_GENERAL_CFG_PIPE3_PHYSTATUS_SW_BMSK 0x8
+#define HWIO_GENERAL_CFG_PIPE3_PHYSTATUS_SW_SHFT 0x3
#define HWIO_RAM1_REG_ADDR(x) ((x) + 0x0000000c)
#define HWIO_RAM1_REG_RMSK 0x7