msm: qdss: save and restore debug registers across PC

Debug OS lock register is on the core (Krait) power domain and
so looses its contents on a power collapse. It's power on reset
state is locked and external debugger accesses are not allowed
while the debug OS lock is set.

This prevents JTag users from setting breakpoints after the first
Krait power collapse.

Saving and restoring debug registers across power collapse helps
preserve the breakpoints as well as clear the debug OS lock as
part of this procedure while coming out of power collapse.

CRs-Fixed: 310982
Change-Id: Icfccea17e556474241bf495885d9bb575d7571bf
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 a6e8fdb..b0c075b 100644
--- a/arch/arm/mach-msm/idle-v7.S
+++ b/arch/arm/mach-msm/idle-v7.S
@@ -32,15 +32,7 @@
 #endif
 
 ENTRY(msm_arch_idle)
-#ifdef CONFIG_MSM_JTAG_V7
-	stmfd   sp!, {lr}
-	bl      msm_save_jtag_debug
-#endif
 	wfi
-#ifdef CONFIG_MSM_JTAG_V7
-	bl      msm_restore_jtag_debug
-	ldmfd   sp!, {lr}
-#endif
 	bx	lr
 
 ENTRY(msm_pm_collapse)
@@ -85,7 +77,7 @@
 	stmia   r0!, {r1-r3}
 #endif
 
-#ifdef CONFIG_MSM_JTAG_V7
+#ifdef CONFIG_MSM_DEBUG_ACROSS_PC
 	bl      msm_save_jtag_debug
 #endif
 #ifdef CONFIG_MSM_TRACE_ACROSS_PC
@@ -132,7 +124,7 @@
 #ifdef CONFIG_MSM_TRACE_ACROSS_PC
 	bl	etm_restore_reg_check
 #endif
-#ifdef CONFIG_MSM_JTAG_V7
+#ifdef CONFIG_MSM_DEBUG_ACROSS_PC
 	bl	msm_restore_jtag_debug
 #endif
 	ldr     r0, =saved_state        /* restore registers */
@@ -220,7 +212,7 @@
 #ifdef CONFIG_MSM_TRACE_ACROSS_PC
 	bl      etm_restore_reg_check
 #endif
-#ifdef CONFIG_MSM_JTAG_V7
+#ifdef CONFIG_MSM_DEBUG_ACROSS_PC
 	bl      msm_restore_jtag_debug
 #endif
 	ldmfd   sp!, {lr}