mfd: db8500-prcmu reset code retrieval
authorSebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Fri, 12 Aug 2011 08:28:53 +0000 (10:28 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 24 Oct 2011 12:09:19 +0000 (14:09 +0200)
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 <sebastian.rasmussen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/db8500-prcmu.c

index cb58e44b1e4560cc0bcdf5c630c86dd02f84cf05..6fd4e2993520712f9ed0ffbb793c310107cf3df0 100644 (file)
@@ -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
  */