msm: clock: Split up struct clock_init_data's init() functions
clock_init_data's init() function was called at the start of
msm_clock_init(), before looping through the clocks to set up parents
and perform handoff operations. This meant that performing certain
operations (ex. clk_set_rate()) in init() could interfere with the
handoff process by modifying the clock's registers before the handoff
code had a chance to examine them. It also meant that operations
done in init() would not take into account clock parent relationships,
making it an inappropriate place to set the rates of voter clocks or
enable clocks with parents.
Address this problem by splitting the init() function into two optional
parts: a pre_init() function that executes before clock driver
initialization, and a post_init() function that executes after driver
initialization.
pre_init() is the appropriate place to perform any register or system
configuration that should be done before clock driver initializes or
handoff if performed. Clock APIs should not be called from within it.
post_init() is the appropriate place to perform any additional
configuration that requires the clock driver already be initialized.
Clock APIs can be called within it.
Change-Id: I4b6de87eeee02a86717f53fd42d22e811b10b3f7
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-8x60.c b/arch/arm/mach-msm/clock-8x60.c
index c2632ee..0fab04e 100644
--- a/arch/arm/mach-msm/clock-8x60.c
+++ b/arch/arm/mach-msm/clock-8x60.c
@@ -3751,8 +3751,10 @@
writel_relaxed(regval, reg);
}
-static void __init reg_init(void)
+static void __init msm8660_clock_pre_init(void)
{
+ vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
+
/* Setup MM_PLL2 (PLL3), but turn it off. Rate set by set_rate_tv(). */
rmwreg(0, MM_PLL2_MODE_REG, BIT(0)); /* Disable output */
/* Set ref, bypass, assert reset, disable output, disable test mode */
@@ -3836,14 +3838,10 @@
rmwreg(0x400001, MISC_CC2_REG, 0x424003);
}
-/* Local clock driver initialization. */
-static void __init msm8660_clock_init(void)
+static void __init msm8660_clock_post_init(void)
{
- vote_vdd_level(&vdd_dig, VDD_DIG_HIGH);
/* Keep PXO on whenever APPS cpu is active */
clk_prepare_enable(&pxo_a_clk.c);
- /* Initialize clock registers. */
- reg_init();
/* Initialize rates for clocks that only support one. */
clk_set_rate(&pdm_clk.c, 27000000);
@@ -3885,6 +3883,7 @@
struct clock_init_data msm8x60_clock_init_data __initdata = {
.table = msm_clocks_8x60,
.size = ARRAY_SIZE(msm_clocks_8x60),
- .init = msm8660_clock_init,
+ .pre_init = msm8660_clock_pre_init,
+ .post_init = msm8660_clock_post_init,
.late_init = msm8660_clock_late_init,
};