diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-02-12 14:35:28 +0000 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2013-03-07 12:27:31 +0800 |
commit | 5ff9090f3de360578a2a4f53812fcfce761bfaaa (patch) | |
tree | b0ec46c9a931bdbc8c8a620009df7c69c872ca84 /drivers/mfd | |
parent | cfc0849c66099dc62ed6d879d8128977bd087aa7 (diff) | |
download | linux-3.10-5ff9090f3de360578a2a4f53812fcfce761bfaaa.tar.gz linux-3.10-5ff9090f3de360578a2a4f53812fcfce761bfaaa.tar.bz2 linux-3.10-5ff9090f3de360578a2a4f53812fcfce761bfaaa.zip |
mfd: ab8500-debug: Function to save all ABB registers to mem
Dump function that stores all readable ABB registers to a memory
areas where they can be accessed from dump file.
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/ab8500-debugfs.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 75366b55f16..7febf171e75 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -601,6 +601,56 @@ void ab8500_dump_all_banks(struct device *dev) } } +/* Space for 500 registers. */ +#define DUMP_MAX_REGS 700 +struct ab8500_register_dump +{ + u8 bank; + u8 reg; + u8 value; + int ret; +} ab8500_complete_register_dump[DUMP_MAX_REGS]; + +extern int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); + +/* This shall only be called upon kernel panic! */ +void ab8500_dump_all_banks_to_mem(void) +{ + int i, r = 0; + u8 bank; + + pr_info("Saving all ABB registers at \"ab8500_complete_register_dump\" " + "for crash analyze.\n"); + + for (bank = 1; bank < AB8500_NUM_BANKS; bank++) { + for (i = 0; i < debug_ranges[bank].num_ranges; i++) { + u8 reg; + + for (reg = debug_ranges[bank].range[i].first; + reg <= debug_ranges[bank].range[i].last; + reg++) { + u8 value; + int err; + + err = prcmu_abb_read(bank, reg, &value, 1); + + ab8500_complete_register_dump[r].ret = err; + ab8500_complete_register_dump[r].bank = bank; + ab8500_complete_register_dump[r].reg = reg; + ab8500_complete_register_dump[r].value = value; + + r++; + + if (r >= DUMP_MAX_REGS) { + pr_err("%s: too many register to dump!\n", + __func__); + return; + } + } + } + } +} + static int ab8500_all_banks_open(struct inode *inode, struct file *file) { struct seq_file *s; |