diff options
author | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-01-14 01:17:04 +0000 |
---|---|---|
committer | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-01-14 01:17:04 +0000 |
commit | ddddac646d8d8a31cee97ad6f3629f36e6560a8a (patch) | |
tree | 0298b209c6b0990b6523d85dac0905a2c400958f /sys | |
parent | 9281fb6fdf7fbed7d79a0a38aca31604cf4813a8 (diff) |
Support reboot and powerdown.
ok drahn@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/zaurus/zaurus/zaurus_machdep.c | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/sys/arch/zaurus/zaurus/zaurus_machdep.c b/sys/arch/zaurus/zaurus/zaurus_machdep.c index a6d893ccd45..3396c3d6f8f 100644 --- a/sys/arch/zaurus/zaurus/zaurus_machdep.c +++ b/sys/arch/zaurus/zaurus/zaurus_machdep.c @@ -1,3 +1,4 @@ +/* $OpenBSD */ /* $NetBSD: lubbock_machdep.c,v 1.2 2003/07/15 00:25:06 lukem Exp $ */ /* @@ -234,6 +235,9 @@ extern struct user *proc0paddr; /* Prototypes */ +void zaurus_reset(void); +void zaurus_powerdown(void); + #if 0 void process_kernel_args(char *); void parse_mi_bootargs(char *args); @@ -261,6 +265,55 @@ bs_protos(bs_notimpl); int comcnspeed = CONSPEED; int comcnmode = CONMODE; + +/* + * + */ +void +zaurus_reset(void) +{ + bus_space_tag_t bust = &pxa2x0_bs_tag; + bus_space_handle_t bush_pow; + bus_space_handle_t bush_mc; + int rv; + + if (bus_space_map(bust, PXA2X0_POWMAN_BASE, PXA2X0_POWMAN_SIZE, 0, + &bush_pow)) + panic("pxa2x0_gpio_boot: failed to map POWMAN"); + + if (bus_space_map(bust, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, + &bush_mc)) + panic("zaurus_reset: failed to map MEMCTL"); + + bus_space_write_4(bust, bush_pow, POWMAN_RCSR, + RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR); + + rv = bus_space_read_4(bust, bush_mc, MEMCTL_MSC0); + if ((rv & 0xffff0000) == 0x7ff00000) + bus_space_write_4(bust, bush_mc, MEMCTL_MSC0, + (rv & 0xffff) | 0x7ee00000); + + pxa2x0_gpio_set_function(89, GPIO_OUT | GPIO_SET); + + /* Wait for the external reset circuit to kick the CPU. */ + delay(1000000); +} + +/* + * + */ +void +zaurus_powerdown(void) +{ + + /* + * XXX most of the time this does the right thing, but + * XXX sometimes the zaurus can't be turned on by pressing + * XXX the power button until the battery is replaced. + */ + pxa2x0_watchdog_boot(); +} + /* * void boot(int howto, char *bootstr) * @@ -289,8 +342,9 @@ boot(int howto) cngetc(); } printf("rebooting...\n"); - pxa2x0_watchdog_boot(); - cpu_reset(); + zaurus_reset(); + printf("reboot failed; spinning\n"); + while(1); /*NOTREACHED*/ } @@ -321,14 +375,22 @@ boot(int howto) IRQdisable; if (howto & RB_HALT) { + if (howto & RB_POWERDOWN) { + + printf("\nAttempting to power down...\n"); + delay(500000); + zaurus_powerdown(); + } + printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); } printf("rebooting...\n"); - pxa2x0_watchdog_boot(); - cpu_reset(); + zaurus_reset(); + printf("reboot failed; spinning\n"); + while(1); /*NOTREACHED*/ } |