summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJohan Palsson <johan.palsson@stericsson.com>2011-10-24 11:37:11 +0200
committerJonas ABERG <jonas.aberg@stericsson.com>2011-10-25 08:54:11 +0200
commita4898f396561e41410cfed2bac5fcb593d2efc77 (patch)
treea6a85a1f3e01dfe297c52ff8077bb13da11be8a0 /arch
parent04f3f28ef6c36d1682f8dc020597d2096b55c2f8 (diff)
mach-ux500: Save dbx500 registers on crash
Reads specific DBx500 register in case of kernel crash and saves it in kernel system memory. ST-Ericsson ID: 367366 ST-Ericsson FOSS-OUT ID: Trivial ST-Ericsson Linux next: N/A Change-Id: Ib8da2ab5eaad57b780c00aad495c5d689b081460 Signed-off-by: Johan Bjornstedt <johan.palsson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34368 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-ux500/Kconfig8
-rw-r--r--arch/arm/mach-ux500/Makefile1
-rw-r--r--arch/arm/mach-ux500/dbx500_dump.c135
3 files changed, 144 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 1f19ebe9aa2..27ff6c55bc1 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -149,6 +149,14 @@ config UX500_L2X0_PREFETCH_CTRL
Adds interface to control instruction and data prefetch.
Communication with Trustzone is done through TEE driver.
+config UX500_DB_DUMP
+ bool "DBx500 register dump on crash"
+ depends on (UX500_SOC_DB8500 || UX500_SOC_DB5500)
+ default y
+ help
+ Reads specific DBx500 register in case of kernel crash
+ and saves it.
+
source "arch/arm/mach-ux500/Kconfig-arch"
source "arch/arm/mach-ux500/pm/Kconfig"
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 07988f6f823..8e8fafae775 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_HWMEM) += hwmem-int.o
obj-$(CONFIG_UX500_L2X0_PREFETCH_CTRL) += l2x0-prefetch.o
obj-$(CONFIG_AB5500_BM) += board-u5500-bm.o
obj-$(CONFIG_DBX500_PRCMU_DEBUG) += prcmu-debug.o
+obj-$(CONFIG_UX500_DB_DUMP) += dbx500_dump.o
ifeq ($(CONFIG_UX500_SOC_DB8500), y)
obj-$(CONFIG_STM_TRACE) += board-mop500-stm.o
endif
diff --git a/arch/arm/mach-ux500/dbx500_dump.c b/arch/arm/mach-ux500/dbx500_dump.c
new file mode 100644
index 00000000000..ca2691d204b
--- /dev/null
+++ b/arch/arm/mach-ux500/dbx500_dump.c
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2011
+ *
+ * License Terms: GNU General Public License v2
+ * Author: Johan Bjornstedt <johan.bjornstedt@stericsson.com>
+ *
+ * Save DBx500 registers in case of kernel crash
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/kdebug.h>
+
+#include <mach/hardware.h>
+#include <mach/db8500-regs.h>
+
+struct dbx500_dump_info {
+ char *name;
+ int *data;
+ int *io_addr;
+ int phy_addr;
+ int size;
+};
+
+static struct dbx500_dump_info db8500_dump[] = {
+ {
+ .name = "prcmu_tcdm",
+ .phy_addr = U8500_PRCMU_TCDM_BASE,
+ .size = 0x1000,
+ },
+ {
+ .name = "prcmu_non_sec_1",
+ .phy_addr = U8500_PRCMU_BASE,
+ .size = 0x340,
+ },
+ {
+ .name = "prcmu_pmb",
+ .phy_addr = (U8500_PRCMU_BASE + 0x344),
+ .size = 0xC,
+ },
+ {
+ .name = "prcmu_thermal",
+ .phy_addr = (U8500_PRCMU_BASE + 0x3C0),
+ .size = 0x40,
+ },
+ {
+ .name = "prcmu_non_sec_2",
+ .phy_addr = (U8500_PRCMU_BASE + 0x404),
+ .size = 0x1FC,
+ },
+ {
+ .name = "prcmu_icn_pmu",
+ .phy_addr = (U8500_PRCMU_BASE + 0xE00),
+ .size = 0x118,
+ },
+};
+
+static struct dbx500_dump_info db5500_dump[] = {
+ {},
+};
+
+static struct dbx500_dump_info *dbx500_dump;
+static int dbx500_dump_size;
+
+static int crash_notifier(struct notifier_block *nb, unsigned long val,
+ void *data)
+{
+ int i;
+
+ pr_info("dbx500_dump notified of crash\n");
+
+ for (i = 0; i < dbx500_dump_size; i++) {
+ memcpy_fromio(dbx500_dump[i].data, dbx500_dump[i].io_addr,
+ dbx500_dump[i].size);
+ }
+
+ return 0;
+}
+
+static void __init init_io_addresses(void)
+{
+ int i;
+
+ for (i = 0; i < dbx500_dump_size; i++)
+ dbx500_dump[i].io_addr = __io_address(dbx500_dump[i].phy_addr);
+}
+
+static struct notifier_block die_notifier = {
+ .notifier_call = crash_notifier,
+ .priority = 0,
+};
+
+int __init dbx500_dump_init(void)
+{
+ int err, i;
+
+ if (cpu_is_u5500()) {
+ dbx500_dump = db5500_dump;
+ dbx500_dump_size = ARRAY_SIZE(db5500_dump);
+ } else if (cpu_is_u8500()) {
+ dbx500_dump = db8500_dump;
+ dbx500_dump_size = ARRAY_SIZE(db8500_dump);
+ } else {
+ ux500_unknown_soc();
+ }
+
+ for (i = 0; i < dbx500_dump_size; i++) {
+ dbx500_dump[i].data = kmalloc(dbx500_dump[i].size, GFP_KERNEL);
+ if (!dbx500_dump[i].data) {
+ pr_err("dbx500_dump: Could not allocate memory for "
+ "%s\n", dbx500_dump[i].name);
+ err = -ENOMEM;
+ goto free_mem;
+ }
+ }
+
+ init_io_addresses();
+
+ err = register_die_notifier(&die_notifier);
+ if (err != 0) {
+ pr_err("dbx500_dump: Unable to register a die notifier %d\n",
+ err);
+ goto free_mem;
+ }
+ pr_info("dbx500_dump: driver initialized\n");
+ return err;
+
+free_mem:
+ for (i = i - 1; i >= 0; i--)
+ kfree(dbx500_dump[i].data);
+
+ return err;
+}
+arch_initcall(dbx500_dump_init);