Revert "usb: msm_otg: Migrate to clock apis for XO voting"
This reverts commit 7dd2266ae3d3f1d2cb93d1d3bb40aecf23821e76.
It was a mistake to move the usb driver to the clock apis for XO
buffer voting. Due to an RPM design CXO and D0 are the same but
we would like to hide that from the users of the buffers.
Therefore the msm_xo driver itself remaps the D0 buffer request
to the cxo clock until the RPM is fixed.
Change-Id: I230de55d30a49fa5bcf0d07f40453f1e09c4a9b1
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 1a071e0..06eddf1 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -4902,7 +4902,6 @@
static struct clk_lookup msm_clocks_8064[] = {
CLK_LOOKUP("xo", cxo_a_clk.c, ""),
CLK_LOOKUP("xo", pxo_a_clk.c, ""),
- CLK_LOOKUP("xo", cxo_clk.c, "msm_otg"),
CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
@@ -5188,7 +5187,6 @@
static struct clk_lookup msm_clocks_8960[] = {
CLK_LOOKUP("xo", cxo_a_clk.c, ""),
CLK_LOOKUP("xo", pxo_a_clk.c, ""),
- CLK_LOOKUP("xo", cxo_clk.c, "msm_otg"),
CLK_LOOKUP("cxo", cxo_clk.c, "wcnss_wlan.0"),
CLK_LOOKUP("cxo", cxo_clk.c, "pil_riva"),
CLK_LOOKUP("xo", pxo_clk.c, "pil_qdsp6v4.0"),
diff --git a/arch/arm/mach-msm/clock-9615.c b/arch/arm/mach-msm/clock-9615.c
index 6f02b75..cc71c0b 100644
--- a/arch/arm/mach-msm/clock-9615.c
+++ b/arch/arm/mach-msm/clock-9615.c
@@ -1600,7 +1600,6 @@
static struct clk_lookup msm_clocks_9615[] = {
CLK_LOOKUP("xo", cxo_a_clk.c, ""),
- CLK_LOOKUP("xo", cxo_clk.c, "msm_otg"),
CLK_LOOKUP("xo", cxo_clk.c, "BAM_RMNT"),
CLK_LOOKUP("xo", cxo_clk.c, "msm_xo"),
CLK_LOOKUP("pll0", pll0_clk.c, NULL),
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 9cc4274..037f834 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -767,6 +767,7 @@
int cnt = 0;
bool host_bus_suspend, dcp;
u32 phy_ctrl_val = 0, cmd_val;
+ unsigned ret;
u32 portsc;
if (atomic_read(&motg->in_lpm))
@@ -868,7 +869,10 @@
clk_disable_unprepare(motg->core_clk);
/* usb phy no more require TCXO clock, hence vote for TCXO disable */
- clk_disable_unprepare(motg->xo_handle);
+ ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_OFF);
+ if (ret)
+ dev_err(otg->dev, "%s failed to devote for "
+ "TCXO D0 buffer%d\n", __func__, ret);
if (motg->caps & ALLOW_PHY_POWER_COLLAPSE &&
!host_bus_suspend && !dcp) {
@@ -913,7 +917,7 @@
wake_lock(&motg->wlock);
/* Vote for TCXO when waking up the phy */
- ret = clk_prepare_enable(motg->xo_handle);
+ ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_ON);
if (ret)
dev_err(otg->dev, "%s failed to vote for "
"TCXO D0 buffer%d\n", __func__, ret);
@@ -3253,7 +3257,7 @@
goto free_regs;
}
- motg->xo_handle = clk_get(&pdev->dev, "xo");
+ motg->xo_handle = msm_xo_get(MSM_XO_TCXO_D0, "usb");
if (IS_ERR(motg->xo_handle)) {
dev_err(&pdev->dev, "%s not able to get the handle "
"to vote for TCXO D0 buffer\n", __func__);
@@ -3261,7 +3265,7 @@
goto free_regs;
}
- ret = clk_prepare_enable(motg->xo_handle);
+ ret = msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_ON);
if (ret) {
dev_err(&pdev->dev, "%s failed to vote for TCXO "
"D0 buffer%d\n", __func__, ret);
@@ -3413,9 +3417,9 @@
msm_hsusb_init_vddcx(motg, 0);
devote_xo_handle:
clk_disable_unprepare(motg->pclk);
- clk_disable_unprepare(motg->xo_handle);
+ msm_xo_mode_vote(motg->xo_handle, MSM_XO_MODE_OFF);
free_xo_handle:
- clk_put(motg->xo_handle);
+ msm_xo_put(motg->xo_handle);
free_regs:
iounmap(motg->regs);
put_pclk:
@@ -3481,7 +3485,7 @@
clk_disable_unprepare(motg->pclk);
clk_disable_unprepare(motg->core_clk);
- clk_put(motg->xo_handle);
+ msm_xo_put(motg->xo_handle);
msm_hsusb_ldo_enable(motg, 0);
msm_hsusb_ldo_init(motg, 0);
msm_hsusb_init_vddcx(motg, 0);
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 5845cb6..bb6a01d 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -295,7 +295,7 @@
unsigned mA_port;
struct timer_list id_timer;
unsigned long caps;
- struct clk *xo_handle;
+ struct msm_xo_voter *xo_handle;
uint32_t bus_perf_client;
/*
* Allowing PHY power collpase turns off the HSUSB 3.3v and 1.8v