USB: EHCI: Add I2C support for SMSC hsic hub

Currently default configuration will be active
during SMSC hub enumeration. For changing the default
configuration, requires I2C support for configuring
the configurable parameters of SMSC hub like VID,PID.

Change-Id: Ie0449b166ddaae990b9a69c3a75f8059250faf0e
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8960-gpiomux.c b/arch/arm/mach-msm/board-8960-gpiomux.c
index bfb8be3..2cb923c 100644
--- a/arch/arm/mach-msm/board-8960-gpiomux.c
+++ b/arch/arm/mach-msm/board-8960-gpiomux.c
@@ -539,6 +539,9 @@
 			[GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
 		},
 	},
+};
+
+static struct msm_gpiomux_config msm8960_hsic_hub_configs[] = {
 	{
 		.gpio = 91,               /* HSIC_HUB_RESET */
 		.settings = {
@@ -706,6 +709,11 @@
 		(PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid()))
 		msm_gpiomux_install(msm8960_hsic_configs,
 			ARRAY_SIZE(msm8960_hsic_configs));
+
+	if ((SOCINFO_VERSION_MAJOR(socinfo_get_version()) != 1) &&
+			machine_is_msm8960_liquid())
+		msm_gpiomux_install(msm8960_hsic_hub_configs,
+			ARRAY_SIZE(msm8960_hsic_hub_configs));
 #endif
 
 #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
diff --git a/arch/arm/mach-msm/board-8960-regulator.c b/arch/arm/mach-msm/board-8960-regulator.c
index 64fa69f..ed47ae2 100644
--- a/arch/arm/mach-msm/board-8960-regulator.c
+++ b/arch/arm/mach-msm/board-8960-regulator.c
@@ -174,7 +174,7 @@
 	REGULATOR_SUPPLY("CDC_VDDA_TX",		"tabla2x-slim"),
 	REGULATOR_SUPPLY("CDC_VDDA_RX",		"tabla2x-slim"),
 	REGULATOR_SUPPLY("vcc_i2c",		"3-005b"),
-	REGULATOR_SUPPLY("EXT_HUB_VDDIO",	"msm_hsic_host"),
+	REGULATOR_SUPPLY("EXT_HUB_VDDIO",	"msm_smsc_hub"),
 	REGULATOR_SUPPLY("vcc_i2c",		"10-0048"),
 };
 VREG_CONSUMERS(S5) = {
diff --git a/arch/arm/mach-msm/board-8960.c b/arch/arm/mach-msm/board-8960.c
index b6f35b2..9fa7c0b 100644
--- a/arch/arm/mach-msm/board-8960.c
+++ b/arch/arm/mach-msm/board-8960.c
@@ -74,6 +74,7 @@
 #include <linux/mfd/wcd9xxx/pdata.h>
 #endif
 
+#include <linux/smsc3503.h>
 #include <linux/ion.h>
 #include <mach/ion.h>
 #include <mach/mdm2.h>
@@ -1302,10 +1303,23 @@
 	.strobe		= 150,
 	.data		= 151,
 };
+
+static struct smsc_hub_platform_data hsic_hub_pdata = {
+	.hub_reset		= HSIC_HUB_RESET_GPIO,
+};
 #else
 static struct msm_hsic_host_platform_data msm_hsic_pdata;
+static struct smsc_hub_platform_data hsic_hub_pdata;
 #endif
 
+static struct platform_device smsc_hub_device = {
+	.name	= "msm_smsc_hub",
+	.id	= -1,
+	.dev	= {
+		.platform_data = &hsic_hub_pdata,
+	},
+};
+
 #define PID_MAGIC_ID		0x71432909
 #define SERIAL_NUM_MAGIC_ID	0x61945374
 #define SERIAL_NUMBER_LENGTH	127
@@ -2651,6 +2665,17 @@
 }
 EXPORT_SYMBOL(peripheral_disconnect);
 
+static void __init msm8960_init_smsc_hub(void)
+{
+	uint32_t version = socinfo_get_version();
+
+	if (SOCINFO_VERSION_MAJOR(version) == 1)
+		return;
+
+	if (machine_is_msm8960_liquid())
+		platform_device_register(&smsc_hub_device);
+}
+
 static void __init msm8960_init_hsic(void)
 {
 #ifdef CONFIG_USB_EHCI_MSM_HSIC
@@ -2887,13 +2912,10 @@
 	}
 	msm_otg_pdata.swfi_latency =
 		msm_rpmrs_levels[0].latency_us;
-#ifdef CONFIG_USB_EHCI_MSM_HSIC
-	if (machine_is_msm8960_liquid()) {
-		if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
-			msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
-	}
-#endif
 	msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
+	if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2 &&
+					machine_is_msm8960_liquid())
+		msm_device_hsic_host.dev.parent = &smsc_hub_device.dev;
 	msm8960_init_gpiomux();
 	msm8960_device_qup_spi_gsbi1.dev.platform_data =
 				&msm8960_qup_spi_gsbi1_pdata;
@@ -2923,6 +2945,7 @@
 	platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
 	msm8960_pm8921_gpio_mpp_init();
 	platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
+	msm8960_init_smsc_hub();
 	msm8960_init_hsic();
 	msm8960_init_cam();
 	msm8960_init_mmc();
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index e0da766..c050718c 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -643,6 +643,16 @@
 	  to the fuse block. Currently this is supported only
 	  on FSM targets.
 
+config USB_HSIC_SMSC_HUB
+	tristate "Support for HSIC based MSM on-chip SMSC3503 HUB"
+	depends on USB_EHCI_MSM_HSIC
+	help
+	  Enables support for the HSIC (High Speed Inter-Chip) based
+	  SMSC3503 hub controller present on the Qualcomm chipsets.
+
+	  This adds support for connecting devices like mouse in HSIC
+	  Host mode.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index fb78f4e..a864918 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -30,6 +30,7 @@
 obj-$(CONFIG_APDS9802ALS)	+= apds9802als.o
 obj-$(CONFIG_ISL29003)		+= isl29003.o
 obj-$(CONFIG_ISL29020)		+= isl29020.o
+obj-$(CONFIG_USB_HSIC_SMSC_HUB) += smsc_hub.o
 obj-$(CONFIG_SENSORS_TSL2550)	+= tsl2550.o
 obj-$(CONFIG_EP93XX_PWM)	+= ep93xx_pwm.o
 obj-$(CONFIG_DS1682)		+= ds1682.o
diff --git a/drivers/misc/smsc_hub.c b/drivers/misc/smsc_hub.c
new file mode 100644
index 0000000..d3304eb
--- /dev/null
+++ b/drivers/misc/smsc_hub.c
@@ -0,0 +1,355 @@
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
+#include <linux/i2c.h>
+#include <linux/gpio.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/smsc3503.h>
+#include <mach/msm_xo.h>
+
+#define SMSC3503_I2C_ADDR 0x08
+#define SMSC_GSBI_I2C_BUS_ID 10
+static const unsigned short normal_i2c[] = {
+SMSC3503_I2C_ADDR, I2C_CLIENT_END };
+
+struct hsic_hub {
+	struct regulator *hsic_hub_reg;
+	struct device *dev;
+	struct i2c_client *client;
+	struct msm_xo_voter *xo_handle;
+};
+static struct hsic_hub *smsc_hub;
+
+/* APIs for setting/clearing bits and for reading/writing values */
+static inline int hsic_hub_get_u8(struct i2c_client *client, u8 reg)
+{
+	int ret;
+
+	ret = i2c_smbus_read_byte_data(client, reg);
+	if (ret < 0)
+		pr_err("%s:i2c_read8 failed\n", __func__);
+	return ret;
+}
+
+static inline int hsic_hub_get_u16(struct i2c_client *client, u8 reg)
+{
+	int ret;
+
+	ret = i2c_smbus_read_word_data(client, reg);
+	if (ret < 0)
+		pr_err("%s:i2c_read16 failed\n", __func__);
+	return ret;
+}
+
+static inline int hsic_hub_write_word_data(struct i2c_client *client, u8 reg,
+						u16 value)
+{
+	int ret;
+
+	ret = i2c_smbus_write_word_data(client, reg, value);
+	if (ret)
+		pr_err("%s:i2c_write16 failed\n", __func__);
+	return ret;
+}
+
+static inline int hsic_hub_write_byte_data(struct i2c_client *client, u8 reg,
+						u8 value)
+{
+	int ret;
+
+	ret = i2c_smbus_write_byte_data(client, reg, value);
+	if (ret)
+		pr_err("%s:i2c_write_byte_data failed\n", __func__);
+	return ret;
+}
+
+static inline int hsic_hub_set_bits(struct i2c_client *client, u8 reg,
+					u8 value)
+{
+	int ret;
+
+	ret = i2c_smbus_read_byte_data(client, reg);
+	if (ret < 0) {
+		pr_err("%s:i2c_read_byte_data failed\n", __func__);
+		return ret;
+	}
+	return i2c_smbus_write_byte_data(client, reg, (ret | value));
+}
+
+static inline int hsic_hub_clear_bits(struct i2c_client *client, u8 reg,
+					u8 value)
+{
+	int ret;
+
+	ret = i2c_smbus_read_byte_data(client, reg);
+	if (ret < 0) {
+		pr_err("%s:i2c_read_byte_data failed\n", __func__);
+		return ret;
+	}
+	return i2c_smbus_write_byte_data(client, reg, (ret & ~value));
+}
+
+static int i2c_hsic_hub_probe(struct i2c_client *client,
+				const struct i2c_device_id *id)
+{
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+				     I2C_FUNC_SMBUS_WORD_DATA))
+		return -EIO;
+
+	return 0;
+}
+
+static int i2c_hsic_hub_remove(struct i2c_client *client)
+{
+	return 0;
+}
+
+static const struct i2c_device_id hsic_hub_id[] = {
+	{"i2c_hsic_hub", 0},
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, hsichub_id);
+
+static struct i2c_driver hsic_hub_driver = {
+	.driver = {
+		.name = "i2c_hsic_hub",
+	},
+	.probe    = i2c_hsic_hub_probe,
+	.remove   = i2c_hsic_hub_remove,
+	.id_table = hsic_hub_id,
+};
+
+#define HSIC_HUB_VDD_VOL_MIN	1650000 /* uV */
+#define HSIC_HUB_VDD_VOL_MAX	1950000 /* uV */
+#define HSIC_HUB_VDD_LOAD	36000	/* uA */
+static int __devinit smsc_hub_probe(struct platform_device *pdev)
+{
+	int ret = 0;
+	const struct smsc_hub_platform_data *pdata;
+	struct i2c_adapter *i2c_adap;
+	struct i2c_board_info i2c_info;
+
+	if (!pdev->dev.platform_data) {
+		dev_err(&pdev->dev, "No platform data\n");
+		return -ENODEV;
+	}
+
+	pdata = pdev->dev.platform_data;
+	if (!pdata->hub_reset)
+		return -EINVAL;
+
+	smsc_hub = kzalloc(sizeof(*smsc_hub), GFP_KERNEL);
+	if (!smsc_hub)
+		return -ENOMEM;
+
+	smsc_hub->hsic_hub_reg = regulator_get(&pdev->dev, "EXT_HUB_VDDIO");
+	if (IS_ERR(smsc_hub->hsic_hub_reg)) {
+		dev_err(&pdev->dev, "unable to get ext hub vddcx\n");
+		ret = PTR_ERR(smsc_hub->hsic_hub_reg);
+		goto free_mem;
+	}
+
+	ret = gpio_request(pdata->hub_reset, "HSIC_HUB_RESET_GPIO");
+	if (ret < 0) {
+		dev_err(&pdev->dev, "gpio request failed for GPIO%d\n",
+							pdata->hub_reset);
+		goto gpio_req_fail;
+	}
+
+	ret = regulator_set_voltage(smsc_hub->hsic_hub_reg,
+			HSIC_HUB_VDD_VOL_MIN,
+			HSIC_HUB_VDD_VOL_MAX);
+	if (ret) {
+		dev_err(&pdev->dev, "unable to set the voltage"
+				"for hsic hub reg\n");
+		goto reg_set_voltage_fail;
+	}
+
+	ret = regulator_set_optimum_mode(smsc_hub->hsic_hub_reg,
+				HSIC_HUB_VDD_LOAD);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Unable to set optimum mode of regulator:"
+							"VDDCX\n");
+		goto reg_optimum_mode_fail;
+	}
+
+	ret = regulator_enable(smsc_hub->hsic_hub_reg);
+	if (ret) {
+		dev_err(&pdev->dev, "unable to enable ext hub vddcx\n");
+		goto reg_enable_fail;
+	}
+
+	smsc_hub->xo_handle = msm_xo_get(MSM_XO_TCXO_D1, "hsic_hub");
+	if (IS_ERR(smsc_hub->xo_handle)) {
+		dev_err(&pdev->dev, "not able to get the handle"
+					 "for TCXO D1 buffer\n");
+			goto disable_regulator;
+	}
+
+	ret = msm_xo_mode_vote(smsc_hub->xo_handle, MSM_XO_MODE_ON);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to vote for TCXO"
+			"D1 buffer\n");
+		goto xo_vote_fail;
+	}
+
+	gpio_direction_output(pdata->hub_reset, 0);
+	/* Hub reset should be asserted for minimum 2microsec
+	 * before deasserting.
+	 */
+	udelay(5);
+	gpio_direction_output(pdata->hub_reset, 1);
+
+	ret = i2c_add_driver(&hsic_hub_driver);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to add I2C hsic_hub_driver\n");
+		goto i2c_add_fail;
+	}
+	usleep_range(10000, 12000);
+	i2c_adap = i2c_get_adapter(SMSC_GSBI_I2C_BUS_ID);
+
+	if (!i2c_adap) {
+		dev_err(&pdev->dev, "failed to get i2c adapter\n");
+		i2c_del_driver(&hsic_hub_driver);
+		goto i2c_add_fail;
+	}
+
+	memset(&i2c_info, 0, sizeof(struct i2c_board_info));
+	strlcpy(i2c_info.type, "i2c_hsic_hub", I2C_NAME_SIZE);
+
+	smsc_hub->client = i2c_new_probed_device(i2c_adap, &i2c_info,
+						   normal_i2c, NULL);
+	i2c_put_adapter(i2c_adap);
+	if (!smsc_hub->client)
+		dev_err(&pdev->dev, "failed to connect to smsc_hub"
+			 "through I2C\n");
+
+i2c_add_fail:
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
+	return 0;
+
+xo_vote_fail:
+	msm_xo_put(smsc_hub->xo_handle);
+disable_regulator:
+	regulator_disable(smsc_hub->hsic_hub_reg);
+reg_enable_fail:
+	regulator_set_optimum_mode(smsc_hub->hsic_hub_reg, 0);
+reg_optimum_mode_fail:
+	regulator_set_voltage(smsc_hub->hsic_hub_reg, 0,
+				HSIC_HUB_VDD_VOL_MIN);
+reg_set_voltage_fail:
+	gpio_free(pdata->hub_reset);
+gpio_req_fail:
+	regulator_put(smsc_hub->hsic_hub_reg);
+free_mem:
+	kfree(smsc_hub);
+
+	return ret;
+}
+
+static int smsc_hub_remove(struct platform_device *pdev)
+{
+	const struct smsc_hub_platform_data *pdata;
+
+	pdata = pdev->dev.platform_data;
+	if (smsc_hub->client) {
+		i2c_unregister_device(smsc_hub->client);
+		smsc_hub->client = NULL;
+		i2c_del_driver(&hsic_hub_driver);
+	}
+	pm_runtime_disable(&pdev->dev);
+	msm_xo_put(smsc_hub->xo_handle);
+
+	regulator_disable(smsc_hub->hsic_hub_reg);
+	regulator_set_optimum_mode(smsc_hub->hsic_hub_reg, 0);
+	regulator_set_voltage(smsc_hub->hsic_hub_reg, 0,
+				HSIC_HUB_VDD_VOL_MIN);
+	gpio_free(pdata->hub_reset);
+	regulator_put(smsc_hub->hsic_hub_reg);
+	kfree(smsc_hub);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM_RUNTIME
+static int msm_smsc_runtime_idle(struct device *dev)
+{
+	dev_dbg(dev, "SMSC HUB runtime idle\n");
+
+	return 0;
+}
+
+static int smsc_hub_lpm_enter(struct device *dev)
+{
+	int ret;
+
+	ret = msm_xo_mode_vote(smsc_hub->xo_handle, MSM_XO_MODE_OFF);
+	if (ret) {
+		pr_err("%s: failed to devote for TCXO"
+			"D1 buffer%d\n", __func__, ret);
+	}
+	return ret;
+}
+
+static int smsc_hub_lpm_exit(struct device *dev)
+{
+	int ret;
+
+	ret = msm_xo_mode_vote(smsc_hub->xo_handle, MSM_XO_MODE_ON);
+	if (ret) {
+		pr_err("%s: failed to vote for TCXO"
+			"D1 buffer%d\n", __func__, ret);
+	}
+	return ret;
+}
+#endif
+
+#ifdef CONFIG_PM
+static const struct dev_pm_ops smsc_hub_dev_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(smsc_hub_lpm_enter, smsc_hub_lpm_exit)
+	SET_RUNTIME_PM_OPS(smsc_hub_lpm_enter, smsc_hub_lpm_exit,
+				msm_smsc_runtime_idle)
+};
+#endif
+
+static struct platform_driver smsc_hub_driver = {
+	.driver = {
+		.name = "msm_smsc_hub",
+		.owner = THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm = &smsc_hub_dev_pm_ops,
+#endif
+	},
+	.remove = smsc_hub_remove,
+};
+
+static int __init smsc_hub_init(void)
+{
+	return platform_driver_probe(&smsc_hub_driver, smsc_hub_probe);
+}
+
+static void __exit smsc_hub_exit(void)
+{
+	platform_driver_unregister(&smsc_hub_driver);
+}
+subsys_initcall(smsc_hub_init);
+module_exit(smsc_hub_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("SMSC HSIC HUB driver");
diff --git a/drivers/usb/host/ehci-msm-hsic.c b/drivers/usb/host/ehci-msm-hsic.c
index dbbfad4..1457ab2 100644
--- a/drivers/usb/host/ehci-msm-hsic.c
+++ b/drivers/usb/host/ehci-msm-hsic.c
@@ -53,7 +53,6 @@
 	struct regulator	*hsic_vddcx;
 	bool			async_int;
 	atomic_t                in_lpm;
-	struct msm_xo_voter	*xo_handle;
 	struct wake_lock	wlock;
 	int			peripheral_status_irq;
 	int			wakeup_irq;
@@ -156,79 +155,6 @@
 	return 0;
 }
 
-#define HSIC_HUB_VDD_VOL_MIN	1650000 /* uV */
-#define HSIC_HUB_VDD_VOL_MAX	1950000 /* uV */
-#define HSIC_HUB_VDD_LOAD	36000	/* uA */
-static int msm_hsic_config_hub(struct msm_hsic_hcd *mehci, int init)
-{
-	int ret = 0;
-	struct msm_hsic_host_platform_data *pdata;
-	static struct regulator *hsic_hub_reg;
-
-	pdata = mehci->dev->platform_data;
-	if (!pdata || !pdata->hub_reset)
-		return ret;
-
-	if (!init)
-		goto disable_reg;
-
-	hsic_hub_reg = devm_regulator_get(mehci->dev, "EXT_HUB_VDDIO");
-	if (IS_ERR(hsic_hub_reg)) {
-		dev_err(mehci->dev, "unable to get ext hub vddcx\n");
-		return PTR_ERR(hsic_hub_reg);
-	}
-
-	ret = gpio_request(pdata->hub_reset, "HSIC_HUB_RESET_GPIO");
-	if (ret < 0) {
-		dev_err(mehci->dev, "gpio request failed for GPIO%d\n",
-							pdata->hub_reset);
-		return ret;
-	}
-
-	ret = regulator_set_voltage(hsic_hub_reg,
-			HSIC_HUB_VDD_VOL_MIN,
-			HSIC_HUB_VDD_VOL_MAX);
-	if (ret) {
-		dev_err(mehci->dev, "unable to set the voltage"
-				"for hsic hub reg\n");
-		goto reg_set_voltage_fail;
-	}
-
-	ret = regulator_set_optimum_mode(hsic_hub_reg,
-				HSIC_HUB_VDD_LOAD);
-	if (ret < 0) {
-		pr_err("%s: Unable to set optimum mode of the regulator:"
-					"VDDCX\n", __func__);
-		goto reg_optimum_mode_fail;
-	}
-
-	ret = regulator_enable(hsic_hub_reg);
-	if (ret) {
-		dev_err(mehci->dev, "unable to enable ext hub vddcx\n");
-		goto reg_enable_fail;
-	}
-
-	gpio_direction_output(pdata->hub_reset, 0);
-	/* Hub reset should be asserted for minimum 2usec before deasserting */
-	udelay(5);
-	gpio_direction_output(pdata->hub_reset, 1);
-
-	return 0;
-
-disable_reg:
-	regulator_disable(hsic_hub_reg);
-reg_enable_fail:
-	regulator_set_optimum_mode(hsic_hub_reg, 0);
-reg_optimum_mode_fail:
-	regulator_set_voltage(hsic_hub_reg, 0,
-				HSIC_HUB_VDD_VOL_MIN);
-reg_set_voltage_fail:
-	gpio_free(pdata->hub_reset);
-
-	return ret;
-
-}
-
 static int msm_hsic_config_gpios(struct msm_hsic_hcd *mehci, int gpio_en)
 {
 	int rc = 0;
@@ -407,7 +333,6 @@
 	struct usb_hcd *hcd = hsic_to_hcd(mehci);
 	int cnt = 0, ret;
 	u32 val;
-	struct msm_hsic_host_platform_data *pdata;
 
 	if (atomic_read(&mehci->in_lpm)) {
 		dev_dbg(mehci->dev, "%s called in lpm\n", __func__);
@@ -455,13 +380,6 @@
 	clk_disable_unprepare(mehci->phy_clk);
 	clk_disable_unprepare(mehci->cal_clk);
 	clk_disable_unprepare(mehci->ahb_clk);
-	pdata = mehci->dev->platform_data;
-	if (pdata && pdata->hub_reset) {
-		ret = msm_xo_mode_vote(mehci->xo_handle, MSM_XO_MODE_OFF);
-		if (ret)
-			pr_err("%s failed to devote for"
-				"TCXO D1 buffer%d\n", __func__, ret);
-	}
 
 	ret = regulator_set_voltage(mehci->hsic_vddcx,
 				USB_PHY_VDD_DIG_VOL_SUSP_MIN,
@@ -491,7 +409,6 @@
 	struct usb_hcd *hcd = hsic_to_hcd(mehci);
 	int cnt = 0, ret;
 	unsigned temp;
-	struct msm_hsic_host_platform_data *pdata;
 
 	if (!atomic_read(&mehci->in_lpm)) {
 		dev_dbg(mehci->dev, "%s called in !in_lpm\n", __func__);
@@ -514,13 +431,6 @@
 	if (ret < 0)
 		dev_err(mehci->dev, "unable to set vddcx voltage: min:1v max:1.3v\n");
 
-	pdata = mehci->dev->platform_data;
-	if (pdata && pdata->hub_reset) {
-		ret = msm_xo_mode_vote(mehci->xo_handle, MSM_XO_MODE_ON);
-		if (ret)
-			pr_err("%s failed to vote for"
-				"TCXO D1 buffer%d\n", __func__, ret);
-	}
 	clk_prepare_enable(mehci->core_clk);
 	clk_prepare_enable(mehci->phy_clk);
 	clk_prepare_enable(mehci->cal_clk);
@@ -868,6 +778,14 @@
 
 	dev_dbg(&pdev->dev, "ehci_msm-hsic probe\n");
 
+	/* After parent device's probe is executed, it will be put in suspend
+	 * mode. When child device's probe is called, driver core is not
+	 * resuming parent device due to which parent will be in suspend even
+	 * though child is active. Hence resume the parent device explicitly.
+	 */
+	if (pdev->dev.parent)
+		pm_runtime_get_sync(pdev->dev.parent);
+
 	hcd = usb_create_hcd(&msm_hsic_driver, &pdev->dev,
 				dev_name(&pdev->dev));
 	if (!hcd) {
@@ -921,34 +839,10 @@
 		goto deinit_clocks;
 	}
 
-	pdata = mehci->dev->platform_data;
-	if (pdata && pdata->hub_reset) {
-		mehci->xo_handle = msm_xo_get(MSM_XO_TCXO_D1, "hsic");
-		if (IS_ERR(mehci->xo_handle)) {
-			pr_err(" %s not able to get the handle"
-				"to vote for TCXO D1 buffer\n", __func__);
-			ret = PTR_ERR(mehci->xo_handle);
-			goto deinit_vddcx;
-		}
-
-		ret = msm_xo_mode_vote(mehci->xo_handle, MSM_XO_MODE_ON);
-		if (ret) {
-			pr_err("%s failed to vote for TCXO"
-				"D1 buffer%d\n", __func__, ret);
-			goto free_xo_handle;
-		}
-	}
-
-	ret = msm_hsic_config_hub(mehci, 1);
-	if (ret) {
-		dev_err(&pdev->dev, "unable to initialize hsic hub");
-		goto free_xo_handle;
-	}
-
 	ret = msm_hsic_reset(mehci);
 	if (ret) {
 		dev_err(&pdev->dev, "unable to initialize PHY\n");
-		goto deinit_hub;
+		goto deinit_vddcx;
 	}
 
 	ret = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
@@ -994,6 +888,7 @@
 		dev_dbg(&pdev->dev, "mode debugfs file is"
 			"not available\n");
 
+	pdata = mehci->dev->platform_data;
 	if (pdata && pdata->bus_scale_table) {
 		mehci->bus_perf_client =
 		    msm_bus_scale_register_client(pdata->bus_scale_table);
@@ -1017,16 +912,17 @@
 	 */
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_enable(&pdev->dev);
+	/* Decrement the parent device's counter after probe.
+	 * As child is active, parent will not be put into
+	 * suspend mode.
+	 */
+	if (pdev->dev.parent)
+		pm_runtime_put_sync(pdev->dev.parent);
 
 	return 0;
 
 unconfig_gpio:
 	msm_hsic_config_gpios(mehci, 0);
-deinit_hub:
-	msm_hsic_config_hub(mehci, 0);
-free_xo_handle:
-	if (pdata && pdata->hub_reset)
-		msm_xo_put(mehci->xo_handle);
 deinit_vddcx:
 	msm_hsic_init_vddcx(mehci, 0);
 deinit_clocks:
@@ -1043,7 +939,6 @@
 {
 	struct usb_hcd *hcd = platform_get_drvdata(pdev);
 	struct msm_hsic_hcd *mehci = hcd_to_hsic(hcd);
-	struct msm_hsic_host_platform_data *pdata;
 
 	if (mehci->peripheral_status_irq)
 		free_irq(mehci->peripheral_status_irq, mehci);
@@ -1063,10 +958,6 @@
 
 	usb_remove_hcd(hcd);
 	msm_hsic_config_gpios(mehci, 0);
-	msm_hsic_config_hub(mehci, 0);
-	pdata = mehci->dev->platform_data;
-	if (pdata && pdata->hub_reset)
-		msm_xo_put(mehci->xo_handle);
 	msm_hsic_init_vddcx(mehci, 0);
 
 	msm_hsic_init_clocks(mehci, 0);
diff --git a/include/linux/smsc3503.h b/include/linux/smsc3503.h
new file mode 100644
index 0000000..8153da1
--- /dev/null
+++ b/include/linux/smsc3503.h
@@ -0,0 +1,21 @@
+/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_SMSC3503_H__
+#define __LINUX_SMSC3503_H__
+
+struct smsc_hub_platform_data {
+	unsigned hub_reset;
+};
+
+#endif
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 1a6df8b..02d87a8 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -330,7 +330,6 @@
 struct msm_hsic_host_platform_data {
 	unsigned strobe;
 	unsigned data;
-	unsigned hub_reset;
 	struct msm_bus_scale_pdata *bus_scale_table;
 };