summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-11-05 10:52:03 -0800
committerOlof Johansson <olof@lixom.net>2012-11-05 10:52:03 -0800
commit976669971ff7d2d668ee3d9e92d0d9db5aae847c (patch)
treee696fcf3eb3b9c6311fc4fa51aa8c89a29aad9c2 /arch/arm/mach-omap1
parent9237b5aa447dce55913b61f435c5140410bf5310 (diff)
parent7fc54fd3084457c7f11b9e2e1e3fcd19a3badc33 (diff)
downloadtalos-op-linux-976669971ff7d2d668ee3d9e92d0d9db5aae847c.tar.gz
talos-op-linux-976669971ff7d2d668ee3d9e92d0d9db5aae847c.zip
Merge tag 'omap-for-v3.8/cleanup-prcm-part1-take2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/headers
From Paul Walmsley <paul@pwsan.com> via Tony Lindgren: The first set of OMAP PRM/CM-related cleanup patches for 3.8. Prepares for the future move of the PRM/CM code to drivers/. Also includes some prcm.[ch] cleanup patches from the WDTIMER cleanup series that don't need external acks. * tag 'omap-for-v3.8/cleanup-prcm-part1-take2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: OMAP2+: PRM: create PRM reset source API for the watchdog timer driver ARM: OMAP1: create read_reset_sources() function (for initial use by watchdog) ARM: OMAP2+: CM: prepare for use of cm_ll_data function pointers ARM: OMAP2+: PRM: prepare for use of prm_ll_data function pointers ARM: OMAP2/3: clockdomain/PRM/CM: move the low-level clockdomain functions into PRM/CM ARM: OMAP2+: CM/hwmod: split CM functions into OMAP2, OMAP3-specific files ARM: OMAP2+: powerdomain/PRM: move the low-level powerdomain functions into PRM ARM: OMAP2+: PRM: split PRM functions into OMAP2, OMAP3-specific files ARM: OMAP2+: PRM: remove PRM weak functions
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/common.h2
-rw-r--r--arch/arm/mach-omap1/reset.c38
2 files changed, 40 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index 26e19d3b7924..d6ac18d04da7 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -94,4 +94,6 @@ extern int ocpi_enable(void);
static inline int ocpi_enable(void) { return 0; }
#endif
+extern int omap1_get_reset_sources(void);
+
#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index b17709103866..a0a9f97772ea 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -10,6 +10,19 @@
#include "common.h"
+/* ARM_SYSST bit shifts related to SoC reset sources */
+#define ARM_SYSST_POR_SHIFT 5
+#define ARM_SYSST_EXT_RST_SHIFT 4
+#define ARM_SYSST_ARM_WDRST_SHIFT 2
+#define ARM_SYSST_GLOB_SWRST_SHIFT 1
+
+/* Standardized reset source bits (across all OMAP SoCs) */
+#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
+#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
+#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
+#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
+
+
void omap1_restart(char mode, const char *cmd)
{
/*
@@ -23,3 +36,28 @@ void omap1_restart(char mode, const char *cmd)
omap_writew(1, ARM_RSTCT1);
}
+
+/**
+ * omap1_get_reset_sources - return the source of the SoC's last reset
+ *
+ * Returns bits that represent the last reset source for the SoC. The
+ * format is standardized across OMAPs for use by the OMAP watchdog.
+ */
+int omap1_get_reset_sources(void)
+{
+ int ret = 0;
+ u16 rs;
+
+ rs = __raw_readw(ARM_SYSST);
+
+ if (rs & (1 << ARM_SYSST_POR_SHIFT))
+ ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT;
+ if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT))
+ ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT;
+ if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT))
+ ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT;
+ if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT))
+ ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT;
+
+ return ret;
+}
OpenPOWER on IntegriCloud