Merge change I02a42409

* changes:
  [msm7627]: Replace thread_sleep calls and disable keypad initialization for nandwrite
diff --git a/platform/msm7k/acpuclock.c b/platform/msm7k/acpuclock.c
index 0516a57..1c545f9 100755
--- a/platform/msm7k/acpuclock.c
+++ b/platform/msm7k/acpuclock.c
@@ -84,6 +84,9 @@
 	DIV_4 << 1 | 0,
 };
 
+void mdelay(unsigned msecs);
+
+
 void acpu_clock_init(void)
 {
 	unsigned i;
@@ -97,14 +100,11 @@
 
 	/* Increase VDD level to the final value. */
 	writel((1 << 7) | (VDD_LEVEL << 3), VDD_SVS_PLEVEL_ADDR);
+#if (!ENABLE_NANDWRITE)
 	thread_sleep(1);
-
-	/* Increase AXI bus speed. */
-	//axi_clock_init(MIN_AXI_HZ);
-
-	/* Turn on PLL1 and PLL2. */
-	//pll_request(PLL1, 1);
-	//pll_request(PLL2, 1);
+#else
+        mdelay(1);
+#endif
 
 	/* Read clock source select bit. */
 	i = readl(A11S_CLK_SEL_ADDR) & 1;
@@ -116,9 +116,10 @@
 		 * strongly ordered, so it should be fine.
 		 */
 		writel(clk_sel_reg_val[i], A11S_CLK_SEL_ADDR);
+#if (!ENABLE_NANDWRITE)
 		thread_sleep(1);
+#else
+                mdelay(1);
+#endif
 	}
-
-	/* Turn off PLL1. */
-	//pll_request(PLL1, 0);
 }
diff --git a/platform/msm_shared/timer.c b/platform/msm_shared/timer.c
index ac1f1d9..31cc6ff 100644
--- a/platform/msm_shared/timer.c
+++ b/platform/msm_shared/timer.c
@@ -140,3 +140,18 @@
 	writel(0, DGT_CLEAR);
 	wait_for_timer_op();
 }
+
+void mdelay(unsigned msecs)
+{
+  msecs *= 33;
+
+  writel(0, GPT_CLEAR);
+  writel(0, GPT_ENABLE);
+  while(readl(GPT_COUNT_VAL) != 0) ;
+
+  writel(GPT_ENABLE_EN, GPT_ENABLE);
+  while(readl(GPT_COUNT_VAL) < msecs) ;
+
+  writel(0, GPT_ENABLE);
+  writel(0, GPT_CLEAR);
+}
diff --git a/target/msm7627_ffa/init.c b/target/msm7627_ffa/init.c
index 8f5ab84..9a39779 100644
--- a/target/msm7627_ffa/init.c
+++ b/target/msm7627_ffa/init.c
@@ -87,8 +87,10 @@
 
 	dprintf(INFO, "target_init()\n");
 
+#if (!ENABLE_NANDWRITE)
 	keys_init();
 	keypad_init();
+#endif
 
 	if (target_is_emmc_boot())
 		return;
diff --git a/target/msm7627_surf/init.c b/target/msm7627_surf/init.c
index ef043c1..8a57d56 100644
--- a/target/msm7627_surf/init.c
+++ b/target/msm7627_surf/init.c
@@ -87,8 +87,10 @@
 
 	dprintf(INFO, "target_init()\n");
 
+#if (!ENABLE_NANDWRITE)
 	keys_init();
 	keypad_init();
+#endif
 
 	if (target_is_emmc_boot())
 		return;