summaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorPawel Szyszuk <pawel.szyszuk@stericsson.com>2011-08-11 11:36:25 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 10:59:04 +0200
commitd88a8f7366fc842f818e8861c82ee120670e8a7f (patch)
treed04d0127f2e993c55083830f307f2cc7af31c72b /drivers/mfd
parent42836cec139354aca999205b82fbc6f010645a70 (diff)
mfd/db5500-prcmu: implement reset and cause
This implements the reset accessor function so that the DB5500 PRCMU can reset the system, and the corresponding accessor to retrieve the cause of reset after a restart. Signed-off-by: Pawel Szyszuk <pawel.szyszuk@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/db5500-prcmu.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mfd/db5500-prcmu.c b/drivers/mfd/db5500-prcmu.c
index 35a7a0c74a1..60bfda292ab 100644
--- a/drivers/mfd/db5500-prcmu.c
+++ b/drivers/mfd/db5500-prcmu.c
@@ -27,6 +27,8 @@
#include <mach/db5500-regs.h>
#include "dbx500-prcmu-regs.h"
+#define PRCM_SW_RST_REASON (tcdm_base + 0xFF8) /* 2 bytes */
+
#define _PRCM_MB_HEADER (tcdm_base + 0xFE8)
#define PRCM_REQ_MB0_HEADER (_PRCM_MB_HEADER + 0x0)
#define PRCM_REQ_MB1_HEADER (_PRCM_MB_HEADER + 0x1)
@@ -957,6 +959,29 @@ int db5500_prcmu_set_display_clocks(void)
return 0;
}
+/**
+ * db5500_prcmu_system_reset - System reset
+ *
+ * Saves the reset reason code and then sets the APE_SOFTRST register which
+ * fires an interrupt to fw
+ */
+void db5500_prcmu_system_reset(u16 reset_code)
+{
+ writew(reset_code, PRCM_SW_RST_REASON);
+ writel(1, PRCM_APE_SOFTRST);
+}
+
+/**
+ * db5500_prcmu_get_reset_code - Retrieve SW reset reason code
+ *
+ * Retrieves the reset reason code stored by prcmu_system_reset() before
+ * last restart.
+ */
+u16 db5500_prcmu_get_reset_code(void)
+{
+ return readw(PRCM_SW_RST_REASON);
+}
+
static void ack_dbb_wakeup(void)
{
unsigned long flags;