platform: msm_shared: Update QUSB phy sequence

Update the qusb programming based on the new recommended
initilization sequence.

Change-Id: I1cb71e324d16f97c0f533c71f78e0379cbba9a93
diff --git a/platform/msm_shared/include/qusb2_phy.h b/platform/msm_shared/include/qusb2_phy.h
index 764a5dc..1d5199a 100644
--- a/platform/msm_shared/include/qusb2_phy.h
+++ b/platform/msm_shared/include/qusb2_phy.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-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
@@ -32,4 +32,16 @@
 
 void qusb2_phy_reset(void);
 
+#define QUSB2PHY_PORT_POWERDOWN     (QUSB2_PHY_BASE + 0x000000B4)
+#define QUSB2PHY_PORT_UTMI_CTRL2    (QUSB2_PHY_BASE + 0x000000C4)
+#define QUSB2PHY_PLL_TUNE           (QUSB2_PHY_BASE + 0x00000008)
+#define QUSB2PHY_PLL_USER_CTL1      (QUSB2_PHY_BASE + 0x0000000C)
+#define QUSB2PHY_PLL_USER_CTL2      (QUSB2_PHY_BASE + 0x00000010)
+#define QUSB2PHY_PORT_TUNE1         (QUSB2_PHY_BASE + 0x00000080)
+#define QUSB2PHY_PORT_TUNE2         (QUSB2_PHY_BASE + 0x00000084)
+#define QUSB2PHY_PORT_TUNE3         (QUSB2_PHY_BASE + 0x00000088)
+#define QUSB2PHY_PORT_TUNE4         (QUSB2_PHY_BASE + 0x0000008C)
+#define QUSB2PHY_PORT_TEST2         (QUSB2_PHY_BASE + 0x0000009C)
+
+
 #endif
diff --git a/platform/msm_shared/qusb2_phy.c b/platform/msm_shared/qusb2_phy.c
index 4f2ad47..dfa4776 100644
--- a/platform/msm_shared/qusb2_phy.c
+++ b/platform/msm_shared/qusb2_phy.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-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
@@ -27,6 +27,7 @@
  */
 
 #include <platform/iomap.h>
+#include <qusb2_phy.h>
 #include <reg.h>
 #include <bits.h>
 #include <debug.h>
@@ -37,6 +38,11 @@
 	return 0;
 }
 
+__WEAK int platform_is_msm8996()
+{
+	return 0;
+}
+
 void qusb2_phy_reset(void)
 {
 	uint32_t val;
@@ -50,17 +56,32 @@
 	/* set CLAMP_N_EN and stay with disabled USB PHY */
 	writel(0x23, QUSB2PHY_PORT_POWERDOWN);
 
-	/* Set HS impedance to 42ohms */
-	writel(0xA0, QUSB2PHY_PORT_TUNE1);
+	if (platform_is_msm8996())
+	{
+		writel(0xF8, QUSB2PHY_PORT_TUNE1);
+		writel(0x83, QUSB2PHY_PORT_TUNE2);
+		writel(0x93, QUSB2PHY_PORT_TUNE3);
+		writel(0xC0, QUSB2PHY_PORT_TUNE4);
+		writel(0x30, QUSB2PHY_PLL_TUNE);
+		writel(0x79, QUSB2PHY_PLL_USER_CTL1);
+		writel(0x21, QUSB2PHY_PLL_USER_CTL2);
+		writel(0x14, QUSB2PHY_PORT_TEST2);
+	}
+	else
+	{
+		/* Set HS impedance to 42ohms */
+		writel(0xA0, QUSB2PHY_PORT_TUNE1);
 
-	/* Set TX current to 19mA, TX SR and TX bias current to 1, 1 */
-	writel(0xA5, QUSB2PHY_PORT_TUNE2);
+		/* Set TX current to 19mA, TX SR and TX bias current to 1, 1 */
+		writel(0xA5, QUSB2PHY_PORT_TUNE2);
 
-	/* Increase autocalibration bias circuit settling time
-	 * and enable utocalibration  */
-	writel(0x81, QUSB2PHY_PORT_TUNE3);
+		/* Increase autocalibration bias circuit settling time
+		 * and enable utocalibration  */
+		writel(0x81, QUSB2PHY_PORT_TUNE3);
 
-	writel(0x85, QUSB2PHY_PORT_TUNE4);
+		writel(0x85, QUSB2PHY_PORT_TUNE4);
+	}
+
 	/* Wait for tuning params to take effect right before re-enabling power*/
 	udelay(10);