msm: pm: Add power collapse debug counters support.
Add platform device for PC debug counters. These counter stores the
warmboot entry/exit counters for each core on a non-cacheable always
on IMEM memory. This is a useful feature during debug to understand if
the system has correctly warmbooted after a power collapse.
Usage for core0 debug counters:-
counters at address 0x2A03F664 represent no of times PC attempted.
counters at address 0x2A03F66C represent no of times PC failed.
counters at address 0x2A03F668 represent no of times warm boot happened.
no of PC attemps = PC failures + warm boot entries.
Change-Id: I569341f87d7bfc1b2b5698201929583de380c378
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c
index 07acac6..03a071e 100644
--- a/arch/arm/mach-msm/board-8064.c
+++ b/arch/arm/mach-msm/board-8064.c
@@ -2575,6 +2575,7 @@
#ifdef CONFIG_MSM_ROTATOR
&msm_rotator_device,
#endif
+ &msm8064_pc_cntr,
};
static struct platform_device
diff --git a/arch/arm/mach-msm/board-8930.c b/arch/arm/mach-msm/board-8930.c
index ab35948..05592c2 100644
--- a/arch/arm/mach-msm/board-8930.c
+++ b/arch/arm/mach-msm/board-8930.c
@@ -2398,6 +2398,7 @@
&msm8930_iommu_domain_device,
&msm_tsens_device,
&msm8930_cache_dump_device,
+ &msm8930_pc_cntr,
};
static struct platform_device *cdp_devices[] __initdata = {
diff --git a/arch/arm/mach-msm/board-8960.c b/arch/arm/mach-msm/board-8960.c
index 8ed9666..ebda85c 100644
--- a/arch/arm/mach-msm/board-8960.c
+++ b/arch/arm/mach-msm/board-8960.c
@@ -2744,6 +2744,7 @@
&msm8960_cache_dump_device,
&msm8960_iommu_domain_device,
&msm_tsens_device,
+ &msm8960_pc_cntr,
};
static struct platform_device *cdp_devices[] __initdata = {
diff --git a/arch/arm/mach-msm/devices-8064.c b/arch/arm/mach-msm/devices-8064.c
index e66881b..d4036d1 100644
--- a/arch/arm/mach-msm/devices-8064.c
+++ b/arch/arm/mach-msm/devices-8064.c
@@ -99,6 +99,23 @@
/* Address of PCIE20 */
#define PCIE20_PHYS 0x1b500000
#define PCIE20_SIZE SZ_4K
+#define MSM8064_PC_CNTR_PHYS (APQ8064_IMEM_PHYS + 0x664)
+#define MSM8064_PC_CNTR_SIZE 0x40
+
+static struct resource msm8064_resources_pccntr[] = {
+ {
+ .start = MSM8064_PC_CNTR_PHYS,
+ .end = MSM8064_PC_CNTR_PHYS + MSM8064_PC_CNTR_SIZE,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+struct platform_device msm8064_pc_cntr = {
+ .name = "pc-cntr",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(msm8064_resources_pccntr),
+ .resource = msm8064_resources_pccntr,
+};
static struct msm_watchdog_pdata msm_watchdog_pdata = {
.pet_time = 10000,
diff --git a/arch/arm/mach-msm/devices-8930.c b/arch/arm/mach-msm/devices-8930.c
index ad89a86..f52ee18 100644
--- a/arch/arm/mach-msm/devices-8930.c
+++ b/arch/arm/mach-msm/devices-8930.c
@@ -37,6 +37,23 @@
#ifdef CONFIG_MSM_MPM
#include <mach/mpm.h>
#endif
+#define MSM8930_PC_CNTR_PHYS (MSM8930_IMEM_PHYS + 0x664)
+#define MSM8930_PC_CNTR_SIZE 0x40
+
+static struct resource msm8930_resources_pccntr[] = {
+ {
+ .start = MSM8930_PC_CNTR_PHYS,
+ .end = MSM8930_PC_CNTR_PHYS + MSM8930_PC_CNTR_SIZE,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+struct platform_device msm8930_pc_cntr = {
+ .name = "pc-cntr",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(msm8930_resources_pccntr),
+ .resource = msm8930_resources_pccntr,
+};
struct msm_rpm_platform_data msm8930_rpm_data __initdata = {
.reg_base_addrs = {
diff --git a/arch/arm/mach-msm/devices-8960.c b/arch/arm/mach-msm/devices-8960.c
index 64b901f..251c682 100644
--- a/arch/arm/mach-msm/devices-8960.c
+++ b/arch/arm/mach-msm/devices-8960.c
@@ -103,6 +103,24 @@
#define MSM8960_HSUSB_PHYS 0x12500000
#define MSM8960_HSUSB_SIZE SZ_4K
+#define MSM8960_PC_CNTR_PHYS (MSM8960_IMEM_PHYS + 0x664)
+#define MSM8960_PC_CNTR_SIZE 0x40
+
+static struct resource msm8960_resources_pccntr[] = {
+ {
+ .start = MSM8960_PC_CNTR_PHYS,
+ .end = MSM8960_PC_CNTR_PHYS + MSM8960_PC_CNTR_SIZE,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+struct platform_device msm8960_pc_cntr = {
+ .name = "pc-cntr",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(msm8960_resources_pccntr),
+ .resource = msm8960_resources_pccntr,
+};
+
static struct resource resources_otg[] = {
{
.start = MSM8960_HSUSB_PHYS,
diff --git a/arch/arm/mach-msm/devices.h b/arch/arm/mach-msm/devices.h
index e66bf27..0506217 100644
--- a/arch/arm/mach-msm/devices.h
+++ b/arch/arm/mach-msm/devices.h
@@ -109,6 +109,10 @@
extern struct platform_device msm_device_sdc3;
extern struct platform_device msm_device_sdc4;
+extern struct platform_device msm8960_pc_cntr;
+extern struct platform_device msm8064_pc_cntr;
+extern struct platform_device msm8930_pc_cntr;
+
extern struct platform_device msm_device_gadget_peripheral;
extern struct platform_device msm_device_hsusb_host;
extern struct platform_device msm_device_hsusb_host2;