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/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index d9bf7db..c5eee63 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -2365,6 +2365,7 @@
#define MSM_ETB_PHYS_BASE (MSM_QDSS_PHYS_BASE + 0x1000)
#define MSM_TPIU_PHYS_BASE (MSM_QDSS_PHYS_BASE + 0x3000)
#define MSM_FUNNEL_PHYS_BASE (MSM_QDSS_PHYS_BASE + 0x4000)
+#define MSM_DEBUG_PHYS_BASE (MSM_QDSS_PHYS_BASE + 0x10000)
#define MSM_PTM_PHYS_BASE (MSM_QDSS_PHYS_BASE + 0x1C000)
static struct resource msm_etb_resources[] = {
@@ -2412,6 +2413,26 @@
.resource = msm_funnel_resources,
};
+static struct resource msm_debug_resources[] = {
+ {
+ .start = MSM_DEBUG_PHYS_BASE,
+ .end = MSM_DEBUG_PHYS_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MSM_DEBUG_PHYS_BASE + (SZ_4K * 2),
+ .end = MSM_DEBUG_PHYS_BASE + (SZ_4K * 2) + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+struct platform_device msm_debug_device = {
+ .name = "msm_debug",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(msm_debug_resources),
+ .resource = msm_debug_resources,
+};
+
static struct resource msm_ptm_resources[] = {
{
.start = MSM_PTM_PHYS_BASE,