summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2005-01-12 17:14:38 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2005-01-12 17:14:38 +0000
commitd0da14374159978e16bb9e8ea0d0a7cd30b443b6 (patch)
tree029b4a87ec4347738af0a3834d68bb7b6148c38b /sys/arch
parent51d3a8a79c0962207fc895741acc375122ed1a56 (diff)
Try a watchdog reset (that powers off the zaurus) before cpu_reset().
ok drahn@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/arm/xscale/pxa2x0.c37
-rw-r--r--sys/arch/arm/xscale/pxa2x0reg.h22
-rw-r--r--sys/arch/arm/xscale/pxa2x0var.h7
-rw-r--r--sys/arch/zaurus/zaurus/zaurus_machdep.c2
4 files changed, 65 insertions, 3 deletions
diff --git a/sys/arch/arm/xscale/pxa2x0.c b/sys/arch/arm/xscale/pxa2x0.c
index e329c09e85c..cc791128af0 100644
--- a/sys/arch/arm/xscale/pxa2x0.c
+++ b/sys/arch/arm/xscale/pxa2x0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0.c,v 1.2 2005/01/02 19:52:36 drahn Exp $ */
+/* $OpenBSD: pxa2x0.c,v 1.3 2005/01/12 17:14:37 uwe Exp $ */
/* $NetBSD: pxa2x0.c,v 1.5 2003/12/12 16:42:44 thorpej Exp $ */
/*
@@ -392,3 +392,38 @@ pxa2x0_clkman_config(u_int clk, int enable)
bus_space_write_4(sc->sc_bust, sc->sc_bush_clk, CLKMAN_CKEN, rv);
}
+
+void
+pxa2x0_watchdog_boot(void)
+{
+ struct pxaip_softc *sc;
+ bus_space_handle_t bush_pow;
+ bus_space_handle_t bush_ost;
+ int rv;
+
+ KDASSERT(pxaip_sc != NULL);
+ sc = pxaip_sc;
+
+ if (bus_space_map(sc->sc_bust, PXA2X0_POWMAN_BASE, PXA2X0_POWMAN_SIZE,
+ 0, &bush_pow))
+ panic("pxa2x0_watchdog_boot: failed to map POWMAN");
+
+ if (bus_space_map(sc->sc_bust, PXA2X0_OST_BASE, PXA2X0_OST_SIZE,
+ 0, &bush_ost))
+ panic("pxa2x0_watchdog_boot: failed to map OST");
+
+ bus_space_write_4(sc->sc_bust, bush_pow, POWMAN_RCSR,
+ RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR);
+
+ rv = bus_space_read_4(sc->sc_bust, bush_ost, OST_OSCR0);
+ bus_space_write_4(sc->sc_bust, bush_ost, OST_OSMR3,
+ rv + 0x100);
+ bus_space_write_4(sc->sc_bust, bush_ost, OST_OWER,
+ OWER_WME);
+ rv = bus_space_read_4(sc->sc_bust, bush_ost, OST_OIER);
+ bus_space_write_4(sc->sc_bust, bush_ost, OST_OIER,
+ rv | OIER_E3);
+
+ for (rv = 0; rv < 0x20000000; rv++)
+ /* wait for watchdog reset */;
+}
diff --git a/sys/arch/arm/xscale/pxa2x0reg.h b/sys/arch/arm/xscale/pxa2x0reg.h
index 5eba6ba9ec6..c77eff0ecde 100644
--- a/sys/arch/arm/xscale/pxa2x0reg.h
+++ b/sys/arch/arm/xscale/pxa2x0reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0reg.h,v 1.7 2005/01/10 23:42:22 drahn Exp $ */
+/* $OpenBSD: pxa2x0reg.h,v 1.8 2005/01/12 17:14:37 uwe Exp $ */
/* $NetBSD: pxa2x0reg.h,v 1.4 2003/06/11 20:43:01 scw Exp $ */
/*
@@ -99,6 +99,7 @@
#define PXA2X0_RTC_BASE 0x40900000
#define PXA2X0_RTC_SIZE 0x10
#define PXA2X0_OST_BASE 0x40a00000 /* OS Timer */
+#define PXA2X0_OST_SIZE 0x24
#define PXA2X0_PWM0_BASE 0x40b00000
#define PXA2X0_PWM1_BASE 0x40c00000
#define PXA2X0_INTCTL_BASE 0x40d00000 /* Interrupt controller */
@@ -106,6 +107,7 @@
#define PXA2X0_GPIO_BASE 0x40e00000
#define PXA2X0_GPIO_SIZE 0x70
#define PXA2X0_POWMAN_BASE 0x40f00000 /* Power management */
+#define PXA2X0_POWMAN_SIZE 0x100
#define PXA2X0_SSP_BASE 0x41000000
#define PXA2X0_MMC_BASE 0x41100000 /* MultiMediaCard */
#define PXA2X0_MMC_SIZE 0x48
@@ -215,6 +217,13 @@ struct pxa2x0_dma_desc {
#define I2C_ISR 0x1698 /* Status register */
#define I2C_ISAR 0x16a0 /* Slave address */
+/* Power Manager */
+#define POWMAN_RCSR 0x30 /* Reset Controller Status Register */
+#define RCSR_GPR (1<<3)
+#define RCSR_SMR (1<<2)
+#define RCSR_WDR (1<<1)
+#define RCSR_HWR (1<<0)
+
/* Clock Manager */
#define CLKMAN_CCCR 0x00 /* Core Clock Configuration */
#define CCCR_TURBO_X1 (2<<7)
@@ -695,4 +704,15 @@ struct pxa2x0_dma_desc {
USBHC_HIT_UPRT | USBHC_HIT_STAT | USBHC_HIT_SMAT | USBHC_HIT_UPS3T)
#define USBHC_RST_WAIT 10 /* ms to wait for reset */
+/* OS Timer */
+#define OST_OSMR0 0x0000 /* Match 0 */
+#define OST_OSMR1 0x0004 /* Match 1 */
+#define OST_OSMR2 0x0008 /* Match 2 */
+#define OST_OSMR3 0x000c /* Match 3 */
+#define OST_OSCR0 0x0010 /* Counter 0 */
+#define OST_OWER 0x0018 /* Watchdog Enable */
+#define OWER_WME (1<<0)
+#define OST_OIER 0x001c /* Interrupt Enable */
+#define OIER_E3 (1<<3)
+
#endif /* _ARM_XSCALE_PXA2X0REG_H_ */
diff --git a/sys/arch/arm/xscale/pxa2x0var.h b/sys/arch/arm/xscale/pxa2x0var.h
index 991ae6f2214..81c9d49b25e 100644
--- a/sys/arch/arm/xscale/pxa2x0var.h
+++ b/sys/arch/arm/xscale/pxa2x0var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pxa2x0var.h,v 1.2 2005/01/02 19:52:37 drahn Exp $ */
+/* $OpenBSD: pxa2x0var.h,v 1.3 2005/01/12 17:14:37 uwe Exp $ */
/* $NetBSD: pxa2x0var.h,v 1.2 2003/06/05 13:48:28 scw Exp $ */
/*
@@ -87,4 +87,9 @@ extern void pxa2x0_probe_sdram(vaddr_t, paddr_t *, psize_t *);
*/
extern void pxa2x0_clkman_config(u_int, int);
+/*
+ * Force a watchdog reset to occur.
+ */
+extern void pxa2x0_watchdog_boot(void);
+
#endif /* _ARM_XSCALE_PXA2X0VAR_H_ */
diff --git a/sys/arch/zaurus/zaurus/zaurus_machdep.c b/sys/arch/zaurus/zaurus/zaurus_machdep.c
index 389fa1f2999..a6d893ccd45 100644
--- a/sys/arch/zaurus/zaurus/zaurus_machdep.c
+++ b/sys/arch/zaurus/zaurus/zaurus_machdep.c
@@ -289,6 +289,7 @@ boot(int howto)
cngetc();
}
printf("rebooting...\n");
+ pxa2x0_watchdog_boot();
cpu_reset();
/*NOTREACHED*/
}
@@ -326,6 +327,7 @@ boot(int howto)
}
printf("rebooting...\n");
+ pxa2x0_watchdog_boot();
cpu_reset();
/*NOTREACHED*/
}