Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91135
b: refs/heads/master
c: 565ac44
h: refs/heads/master
i:
  91133: 9c76d36
  91131: c8960e2
  91127: f47135d
  91119: 810bd26
  91103: 14af99b
  91071: 351f76a
  91007: dbd86ed
  90879: a088329
  90623: f004633
  90111: db57e95
v: v3
  • Loading branch information
Andrew Victor authored and Russell King committed Apr 4, 2008
1 parent 3d6a456 commit 317bc7d
Show file tree
Hide file tree
Showing 3 changed files with 77 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: f5d0f4574fe1584891b5167fb0ba42974af13e49
refs/heads/master: 565ac44593d17bdfc9f595614b56bb335a9b8d6f
74 changes: 74 additions & 0 deletions trunk/arch/arm/mach-at91/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,79 @@ static inline void sdram_selfrefresh_enable(void)
#endif


/*
* Show the reason for the previous system reset.
*/
#if defined(AT91_SHDWC)

#include <asm/arch/at91_rstc.h>
#include <asm/arch/at91_shdwc.h>

static void __init show_reset_status(void)
{
static char reset[] __initdata = "reset";

static char general[] __initdata = "general";
static char wakeup[] __initdata = "wakeup";
static char watchdog[] __initdata = "watchdog";
static char software[] __initdata = "software";
static char user[] __initdata = "user";
static char unknown[] __initdata = "unknown";

static char signal[] __initdata = "signal";
static char rtc[] __initdata = "rtc";
static char rtt[] __initdata = "rtt";
static char restore[] __initdata = "power-restored";

char *reason, *r2 = reset;
u32 reset_type, wake_type;

reset_type = at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_RSTTYP;
wake_type = at91_sys_read(AT91_SHDW_SR);

switch (reset_type) {
case AT91_RSTC_RSTTYP_GENERAL:
reason = general;
break;
case AT91_RSTC_RSTTYP_WAKEUP:
/* board-specific code enabled the wakeup sources */
reason = wakeup;

/* "wakeup signal" */
if (wake_type & AT91_SHDW_WAKEUP0)
r2 = signal;
else {
r2 = reason;
if (wake_type & AT91_SHDW_RTTWK) /* rtt wakeup */
reason = rtt;
else if (wake_type & AT91_SHDW_RTCWK) /* rtc wakeup */
reason = rtc;
else if (wake_type == 0) /* power-restored wakeup */
reason = restore;
else /* unknown wakeup */
reason = unknown;
}
break;
case AT91_RSTC_RSTTYP_WATCHDOG:
reason = watchdog;
break;
case AT91_RSTC_RSTTYP_SOFTWARE:
reason = software;
break;
case AT91_RSTC_RSTTYP_USER:
reason = user;
break;
default:
reason = unknown;
break;
}
pr_info("AT91: Starting after %s %s\n", reason, r2);
}
#else
static void __init show_reset_status(void) {}
#endif


static int at91_pm_valid_state(suspend_state_t state)
{
switch (state) {
Expand Down Expand Up @@ -294,6 +367,7 @@ static int __init at91_pm_init(void)

suspend_set_ops(&at91_pm_ops);

show_reset_status();
return 0;
}
arch_initcall(at91_pm_init);
2 changes: 2 additions & 0 deletions trunk/include/asm-arm/arch-at91/at91_shdwc.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
#define AT91_SHDW_WKMODE0_LOW 2
#define AT91_SHDW_WKMODE0_ANYLEVEL 3
#define AT91_SHDW_CPTWK0 (0xf << 4) /* Counter On Wake Up 0 */
#define AT91_SHDW_CPTWK0_(x) ((x) << 4)
#define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */

#define AT91_SHDW_SR (AT91_SHDWC + 0x08) /* Shut Down Status Register */
#define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */
#define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */
#define AT91_SHDW_RTCWK (1 << 17) /* Real-time Clock Wake-up [SAM9RL] */

#endif

0 comments on commit 317bc7d

Please sign in to comment.