From 597045de35caaef68a11b6defbb618710e1a1e52 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Fri, 12 Aug 2011 10:28:53 +0200 Subject: [PATCH] mfd: db8500-prcmu reset code retrieval This implements the reset code retrieval function so we can ipso facto get to know how the system was reset. Signed-off-by: Sebastian Rasmussen Signed-off-by: Linus Walleij Signed-off-by: Samuel Ortiz --- drivers/mfd/db8500-prcmu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index cb58e44b1e45..6fd4e2993520 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -1835,6 +1835,17 @@ void db8500_prcmu_system_reset(u16 reset_code) writel(1, PRCM_APE_SOFTRST); } +/** + * db8500_prcmu_get_reset_code - Retrieve SW reset reason code + * + * Retrieves the reset reason code stored by prcmu_system_reset() before + * last restart. + */ +u16 db8500_prcmu_get_reset_code(void) +{ + return readw(tcdm_base + PRCM_SW_RST_REASON); +} + /** * prcmu_reset_modem - ask the PRCMU to reset modem */ -- 2.39.5