Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339687
b: refs/heads/master
c: b5c5353
h: refs/heads/master
i:
  339685: 191aa11
  339683: 0fe024c
  339679: 7af1c11
v: v3
  • Loading branch information
Paul Walmsley committed Oct 21, 2012
1 parent 9c1096d commit 389ed09
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21325b25f4d81c5fcffd55afb6c81cc873ee8b0a
refs/heads/master: b5c5353d417580f7a6ac21a0954f1c500a5cc4f5
2 changes: 2 additions & 0 deletions trunk/arch/arm/mach-omap1/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,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 */
38 changes: 38 additions & 0 deletions trunk/arch/arm/mach-omap1/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/*
Expand All @@ -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;
}

0 comments on commit 389ed09

Please sign in to comment.