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-8960.c b/arch/arm/mach-msm/clock-8960.c
index 044bd79..417b388 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -5996,12 +5996,8 @@
 	}
 }
 
-/* Local clock driver initialization. */
-static void __init msm8960_clock_init(void)
+static void __init msm8960_clock_pre_init(void)
 {
-	/* Keep PXO on whenever APPS cpu is active */
-	clk_prepare_enable(&pxo_a_clk.c);
-
 	if (cpu_is_apq8064()) {
 		vdd_sr2_pll.set_vdd = set_vdd_sr2_pll_8064;
 	} else if (cpu_is_msm8930() || cpu_is_msm8627()) {
@@ -6050,6 +6046,12 @@
 
 	/* Initialize clock registers. */
 	reg_init();
+}
+
+static void __init msm8960_clock_post_init(void)
+{
+	/* Keep PXO on whenever APPS cpu is active */
+	clk_prepare_enable(&pxo_a_clk.c);
 
 	/* Initialize rates for clocks that only support one. */
 	clk_set_rate(&pdm_clk.c, 27000000);
@@ -6131,20 +6133,23 @@
 struct clock_init_data msm8960_clock_init_data __initdata = {
 	.table = msm_clocks_8960,
 	.size = ARRAY_SIZE(msm_clocks_8960),
-	.init = msm8960_clock_init,
+	.pre_init = msm8960_clock_pre_init,
+	.post_init = msm8960_clock_post_init,
 	.late_init = msm8960_clock_late_init,
 };
 
 struct clock_init_data apq8064_clock_init_data __initdata = {
 	.table = msm_clocks_8064,
 	.size = ARRAY_SIZE(msm_clocks_8064),
-	.init = msm8960_clock_init,
+	.pre_init = msm8960_clock_pre_init,
+	.post_init = msm8960_clock_post_init,
 	.late_init = msm8960_clock_late_init,
 };
 
 struct clock_init_data msm8930_clock_init_data __initdata = {
 	.table = msm_clocks_8930,
 	.size = ARRAY_SIZE(msm_clocks_8930),
-	.init = msm8960_clock_init,
+	.pre_init = msm8960_clock_pre_init,
+	.post_init = msm8960_clock_post_init,
 	.late_init = msm8960_clock_late_init,
 };