msm: qdss: CP14 based save and restore of debug and trace registers

Accessing Krait debug registers from memory mapped interface requires
qdss_pclkdbg_clk and qdss_h_clk clocks apart from the ETM clock. This
means either:

1. requesting or releasing qdss clocks for every save and restore
or
2. leaving the qdss clocks on all the time
or
3. using the CP14 interface which is based on just the ETM clock and
   doesn't require the qdss clocks

We choose to use CP14 interface to avoid the pitfalls for 1. and 2. above.

Moreover, we make the save-restore autodetect the debug and trace
architecture and do the needful based on it and hence consolidate the
code for 8660 and 8960.

Change-Id: If2a383e6f755c9ed893031966fa7ef6de41a5699
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
diff --git a/arch/arm/mach-msm/idle-v7.S b/arch/arm/mach-msm/idle-v7.S
index e855357..660884c 100644
--- a/arch/arm/mach-msm/idle-v7.S
+++ b/arch/arm/mach-msm/idle-v7.S
@@ -2,7 +2,7 @@
  * Idle processing for ARMv7-based Qualcomm SoCs.
  *
  * Copyright (C) 2007 Google, Inc.
- * Copyright (c) 2007-2009, 2011 Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2007-2009, 2011-2012 Code Aurora Forum. All rights reserved.
  *
  * This software is licensed under the terms of the GNU General Public
  * License version 2, as published by the Free Software Foundation, and
@@ -82,11 +82,8 @@
 	stmia   r0!, {r1-r3}
 #endif
 
-#ifdef CONFIG_MSM_DEBUG_ACROSS_PC
-	bl      msm_save_jtag_debug
-#endif
-#ifdef CONFIG_MSM_TRACE_ACROSS_PC
-	bl      etm_save_reg_check
+#ifdef CONFIG_MSM_JTAG
+	bl      msm_jtag_save_state
 #endif
 
 	ldr	r0, =msm_pm_flush_l2_flag
@@ -128,11 +125,8 @@
 #if defined(CONFIG_MSM_FIQ_SUPPORT)
 	cpsie   f
 #endif
-#ifdef CONFIG_MSM_TRACE_ACROSS_PC
-	bl	etm_restore_reg_check
-#endif
-#ifdef CONFIG_MSM_DEBUG_ACROSS_PC
-	bl	msm_restore_jtag_debug
+#ifdef CONFIG_MSM_JTAG
+	bl	msm_jtag_restore_state
 #endif
 	ldr     r0, =saved_state        /* restore registers */
 #if (NR_CPUS >= 2)
@@ -225,11 +219,8 @@
 #endif
 	stmfd   sp!, {lr}
 	bl      v7_flush_kern_cache_all
-#ifdef CONFIG_MSM_TRACE_ACROSS_PC
-	bl      etm_restore_reg_check
-#endif
-#ifdef CONFIG_MSM_DEBUG_ACROSS_PC
-	bl      msm_restore_jtag_debug
+#ifdef CONFIG_MSM_JTAG
+	bl      msm_jtag_restore_state
 #endif
 	ldmfd   sp!, {lr}
 	mov     r0, #1