diff options
author | Paul Walmsley <paul@pwsan.com> | 2012-10-21 03:01:12 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-10-21 03:01:12 -0400 |
commit | b5c5353d417580f7a6ac21a0954f1c500a5cc4f5 (patch) | |
tree | 15b485147d6b59f43ead7410bf8fc1ae0ec43d5f /arch | |
parent | 21325b25f4d81c5fcffd55afb6c81cc873ee8b0a (diff) |
ARM: OMAP1: create read_reset_sources() function (for initial use by watchdog)
On OMAP1, the existing OMAP watchdog driver reads a register directly
from a non-watchdog IP block. It also does not convert the register's
contents into the standard WDIOF_* bits expected from the
GETBOOTSTATUS ioctl().
To move towards fixing these problems, create an function in
arch/arm/mach-omap1 to return the reset source data. A subsequent
patch will provide this function to the watchdog driver via
platform_data.
In the long term, the best approach would be to move this function
to a new OMAP1 driver that handles access to the OMAP1 Clock
Generation and Reset Management IP block. Then no platform_data would
be needed.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap1/common.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap1/reset.c | 38 |
2 files changed, 40 insertions, 0 deletions
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h index c2552b24f9f2..e4efac9839a8 100644 --- a/arch/arm/mach-omap1/common.h +++ b/arch/arm/mach-omap1/common.h | |||
@@ -90,4 +90,6 @@ extern int ocpi_enable(void); | |||
90 | static inline int ocpi_enable(void) { return 0; } | 90 | static inline int ocpi_enable(void) { return 0; } |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | extern int omap1_get_reset_sources(void); | ||
94 | |||
93 | #endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ | 95 | #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 @@ | |||
10 | 10 | ||
11 | #include "common.h" | 11 | #include "common.h" |
12 | 12 | ||
13 | /* ARM_SYSST bit shifts related to SoC reset sources */ | ||
14 | #define ARM_SYSST_POR_SHIFT 5 | ||
15 | #define ARM_SYSST_EXT_RST_SHIFT 4 | ||
16 | #define ARM_SYSST_ARM_WDRST_SHIFT 2 | ||
17 | #define ARM_SYSST_GLOB_SWRST_SHIFT 1 | ||
18 | |||
19 | /* Standardized reset source bits (across all OMAP SoCs) */ | ||
20 | #define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0 | ||
21 | #define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1 | ||
22 | #define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3 | ||
23 | #define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5 | ||
24 | |||
25 | |||
13 | void omap1_restart(char mode, const char *cmd) | 26 | void omap1_restart(char mode, const char *cmd) |
14 | { | 27 | { |
15 | /* | 28 | /* |
@@ -23,3 +36,28 @@ void omap1_restart(char mode, const char *cmd) | |||
23 | 36 | ||
24 | omap_writew(1, ARM_RSTCT1); | 37 | omap_writew(1, ARM_RSTCT1); |
25 | } | 38 | } |
39 | |||
40 | /** | ||
41 | * omap1_get_reset_sources - return the source of the SoC's last reset | ||
42 | * | ||
43 | * Returns bits that represent the last reset source for the SoC. The | ||
44 | * format is standardized across OMAPs for use by the OMAP watchdog. | ||
45 | */ | ||
46 | int omap1_get_reset_sources(void) | ||
47 | { | ||
48 | int ret = 0; | ||
49 | u16 rs; | ||
50 | |||
51 | rs = __raw_readw(ARM_SYSST); | ||
52 | |||
53 | if (rs & (1 << ARM_SYSST_POR_SHIFT)) | ||
54 | ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT; | ||
55 | if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT)) | ||
56 | ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT; | ||
57 | if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT)) | ||
58 | ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT; | ||
59 | if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT)) | ||
60 | ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT; | ||
61 | |||
62 | return ret; | ||
63 | } | ||