msm_xo: Make clock users vote on CXO_CLK instead of buffers
Users of internal MSM clocks derived from CXO should vote on the
CXO_CLK RPM resource rather than just the XO buffer resource. Voting
on CXO_CLK ensures the entire clock tree from the PMIC through to the
MSM clock controller is running, whereas voting for the buffer does
not guarantee the clock will not be gated off within the MPM.
Change-Id: I18199603bcd3ed2833409cb894536fa41711b3bb
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index ed5f265..b207a72 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -5996,7 +5996,7 @@
pr_err("%s: msm_xo_get(PXO) failed.\n", __func__);
BUG();
}
- xo_cxo = msm_xo_get(MSM_XO_TCXO_D0, "clock-8960");
+ xo_cxo = msm_xo_get(MSM_XO_CXO, "clock-8960");
if (IS_ERR(xo_cxo)) {
pr_err("%s: msm_xo_get(CXO) failed.\n", __func__);
BUG();
diff --git a/arch/arm/mach-msm/clock-8x60.c b/arch/arm/mach-msm/clock-8x60.c
index 45094d9..9201330 100644
--- a/arch/arm/mach-msm/clock-8x60.c
+++ b/arch/arm/mach-msm/clock-8x60.c
@@ -3903,7 +3903,7 @@
pr_err("%s: msm_xo_get(PXO) failed.\n", __func__);
BUG();
}
- xo_cxo = msm_xo_get(MSM_XO_TCXO_D1, "clock-8x60");
+ xo_cxo = msm_xo_get(MSM_XO_CXO, "clock-8x60");
if (IS_ERR(xo_cxo)) {
pr_err("%s: msm_xo_get(CXO) failed.\n", __func__);
BUG();
diff --git a/arch/arm/mach-msm/clock-9615.c b/arch/arm/mach-msm/clock-9615.c
index 8c5f027..c712afc 100644
--- a/arch/arm/mach-msm/clock-9615.c
+++ b/arch/arm/mach-msm/clock-9615.c
@@ -1852,7 +1852,7 @@
/* Local clock driver initialization. */
static void __init msm9615_clock_init(void)
{
- xo_cxo = msm_xo_get(MSM_XO_TCXO_D0, "clock-9615");
+ xo_cxo = msm_xo_get(MSM_XO_CXO, "clock-9615");
if (IS_ERR(xo_cxo)) {
pr_err("%s: msm_xo_get(CXO) failed.\n", __func__);
BUG();
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index 6b268f3..c96928c 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -873,7 +873,7 @@
.strap_ahb_lower = 0x00000080,
.aclk_reg = SFAB_MSS_Q6_FW_ACLK_CTL,
.jtag_clk_reg = MSS_Q6FW_JTAG_CLK_CTL,
- .xo_id = MSM_XO_TCXO_D0,
+ .xo_id = MSM_XO_CXO,
.name = "modem_fw",
.depends = "q6",
.pas_id = PAS_MODEM_FW,
@@ -911,7 +911,7 @@
.strap_ahb_lower = 0x00000080,
.aclk_reg = SFAB_MSS_Q6_SW_ACLK_CTL,
.jtag_clk_reg = MSS_Q6SW_JTAG_CLK_CTL,
- .xo_id = MSM_XO_TCXO_D0,
+ .xo_id = MSM_XO_CXO,
.name = "modem",
.depends = "modem_fw",
.pas_id = PAS_MODEM_SW,
diff --git a/arch/arm/mach-msm/include/mach/msm_xo.h b/arch/arm/mach-msm/include/mach/msm_xo.h
index 30c3272..7760647 100644
--- a/arch/arm/mach-msm/include/mach/msm_xo.h
+++ b/arch/arm/mach-msm/include/mach/msm_xo.h
@@ -20,6 +20,7 @@
MSM_XO_TCXO_A2,
MSM_XO_CORE,
MSM_XO_PXO,
+ MSM_XO_CXO,
NUM_MSM_XO_IDS
};
diff --git a/arch/arm/mach-msm/msm_xo.c b/arch/arm/mach-msm/msm_xo.c
index 29cb1a8..802ee2a 100644
--- a/arch/arm/mach-msm/msm_xo.c
+++ b/arch/arm/mach-msm/msm_xo.c
@@ -83,6 +83,7 @@
msm_xo_dump_xo(m, &msm_xo_sources[MSM_XO_TCXO_A2], "TCXO A2");
msm_xo_dump_xo(m, &msm_xo_sources[MSM_XO_CORE], "TCXO Core");
msm_xo_dump_xo(m, &msm_xo_sources[MSM_XO_PXO], "PXO during sleep");
+ msm_xo_dump_xo(m, &msm_xo_sources[MSM_XO_CXO], "CXO");
spin_unlock_irqrestore(&msm_xo_lock, flags);
return 0;
@@ -137,6 +138,10 @@
cmd.id = MSM_RPM_ID_PXO_CLK;
cmd.value = msm_xo_sources[MSM_XO_PXO].mode ? 1 : 0;
ret = msm_rpmrs_set_noirq(MSM_RPM_CTX_SET_SLEEP, &cmd, 1);
+ } else if (xo == &msm_xo_sources[MSM_XO_CXO]) {
+ cmd.id = MSM_RPM_ID_CXO_CLK;
+ cmd.value = msm_xo_sources[MSM_XO_CXO].mode ? 1 : 0;
+ ret = msm_rpmrs_set_noirq(MSM_RPM_CTX_SET_0, &cmd, 1);
} else {
cmd.id = MSM_RPM_ID_CXO_BUFFERS;
cmd.value = (msm_xo_sources[MSM_XO_TCXO_D0].mode << 0) |
@@ -223,10 +228,10 @@
/*
* TODO: Remove early return for 8064 once RPM XO voting support
- * is available. Remove early return for 8960 TCXO_D0 once all
- * voters for it are in place.
+ * is available. Remove early return for 8960 CXO once all voters
+ * for it are in place.
*/
- if (cpu_is_apq8064() || (cpu_is_msm8960() && xo_id == MSM_XO_TCXO_D0))
+ if (cpu_is_apq8064() || (cpu_is_msm8960() && xo_id == MSM_XO_CXO))
return NULL;
if (xo_id >= NUM_MSM_XO_IDS) {