X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=rpikern;a=blobdiff_plain;f=src%2Frpi.c;fp=src%2Frpi.c;h=0b2f298e73a7bfb57ccd8cd38a63c5ba567fd29e;hp=ba39596a506b91b4bc46ef2f2ef20c7bb7fb95f5;hb=6da291dc416a718164b5596aa16b1901f2770732;hpb=32ccc707bc0821d7ff4248fe9f58e92e9c6ebef9 diff --git a/src/rpi.c b/src/rpi.c index ba39596..0b2f298 100644 --- a/src/rpi.c +++ b/src/rpi.c @@ -40,6 +40,13 @@ #define TMCTL_PRESCALER(x) (((uint32_t)(x) & 0xff) << 16) +/* watchdog */ +#define PM_RSTC_REG IOREG(0x10001c) +#define PM_WDOG_REG IOREG(0x100024) + +#define PM_PASSWD 0x5a000000 +#define PMRSTC_WRCFG_FULL_RESET 0x00000020 +#define PMRSTC_WRCFG_CLEAR 0xffffffcf /* MAILBOX */ #define MBOX_READ_REG IOREG(0xb880) @@ -88,6 +95,12 @@ static int detect(void) return -1; } +void rpi_reboot(void) +{ + PM_WDOG_REG = PM_PASSWD | 1; + PM_RSTC_REG = PM_PASSWD | (PM_RSTC_REG & PMRSTC_WRCFG_CLEAR) | PMRSTC_WRCFG_FULL_RESET; + for(;;) halt_cpu(); +} void rpi_mbox_send(int chan, uint32_t msg) {