diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-26 05:16:34 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2016-06-26 05:16:34 +0000 |
commit | bf187243af9a2ce4e27b7582c2fc97098dc7d1de (patch) | |
tree | 4be9555b146575505fc43e4de0f539782f67bff6 /sys/arch | |
parent | 42e8ad9a326ff38d4ac04406dfc0cd8a5fb3cf7f (diff) |
Dynamically attach omdog(4) using the FDT.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/armv7/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/armv7/conf/RAMDISK | 4 | ||||
-rw-r--r-- | sys/arch/armv7/omap/files.omap | 4 | ||||
-rw-r--r-- | sys/arch/armv7/omap/omap.c | 6 | ||||
-rw-r--r-- | sys/arch/armv7/omap/omdog.c | 32 |
5 files changed, 32 insertions, 18 deletions
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC index 7fb791b975d..b6600cf9827 100644 --- a/sys/arch/armv7/conf/GENERIC +++ b/sys/arch/armv7/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.23 2016/06/19 14:27:35 jsg Exp $ +# $OpenBSD: GENERIC,v 1.24 2016/06/26 05:16:33 jsg Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -64,7 +64,7 @@ intc* at omap? # OMAP3 interrupt controller edma* at omap? # OMAP3 dma controller prcm* at omap? # power/clock controller sitaracm* at omap? # sitara control module -omdog* at omap? # watchdog timer +omdog* at fdt? # watchdog timer omgpio* at omap? # user-visible GPIO pins? gpio* at omgpio? #tiiic* at omap? diff --git a/sys/arch/armv7/conf/RAMDISK b/sys/arch/armv7/conf/RAMDISK index 6ed438c009d..33c82d19989 100644 --- a/sys/arch/armv7/conf/RAMDISK +++ b/sys/arch/armv7/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.20 2016/06/19 14:27:35 jsg Exp $ +# $OpenBSD: RAMDISK,v 1.21 2016/06/26 05:16:33 jsg Exp $ machine armv7 arm @@ -63,7 +63,7 @@ intc* at omap? # OMAP3 interrupt controller edma* at omap? # OMAP3 dma controller prcm* at omap? # power/clock controller sitaracm* at omap? # sitara control module -omdog* at omap? # watchdog timer +omdog* at fdt? # watchdog timer omgpio* at omap? # user-visible GPIO pins? gpio* at omgpio? #tiiic* at omap? diff --git a/sys/arch/armv7/omap/files.omap b/sys/arch/armv7/omap/files.omap index 092b27e67b5..961b9a394e7 100644 --- a/sys/arch/armv7/omap/files.omap +++ b/sys/arch/armv7/omap/files.omap @@ -1,4 +1,4 @@ -# $OpenBSD: files.omap,v 1.10 2016/06/19 14:27:35 jsg Exp $ +# $OpenBSD: files.omap,v 1.11 2016/06/26 05:16:33 jsg Exp $ define omap {} device omap: omap @@ -55,7 +55,7 @@ attach omapid at omap file arch/armv7/omap/omapid.c omapid device omdog -attach omdog at omap +attach omdog at fdt file arch/armv7/omap/omdog.c omdog attach ohci at omap with omohci diff --git a/sys/arch/armv7/omap/omap.c b/sys/arch/armv7/omap/omap.c index 67d407f60b7..6065124283d 100644 --- a/sys/arch/armv7/omap/omap.c +++ b/sys/arch/armv7/omap/omap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omap.c,v 1.12 2016/06/19 14:27:35 jsg Exp $ */ +/* $OpenBSD: omap.c,v 1.13 2016/06/26 05:16:33 jsg Exp $ */ /* * Copyright (c) 2005,2008 Dale Rahn <drahn@openbsd.com> * @@ -41,7 +41,6 @@ struct board_dev beagleboard_devs[] = { { "intc", 0 }, { "gptimer", 0 }, { "gptimer", 1 }, - { "omdog", 0 }, { "omgpio", 0 }, { "omgpio", 1 }, { "omgpio", 2 }, @@ -58,7 +57,6 @@ struct board_dev beaglebone_devs[] = { { "edma", 0 }, { "dmtimer", 0 }, { "dmtimer", 1 }, - { "omdog", 0 }, { "omgpio", 0 }, { "omgpio", 1 }, { "omgpio", 2 }, @@ -75,7 +73,6 @@ struct board_dev overo_devs[] = { { "intc", 0 }, { "gptimer", 0 }, { "gptimer", 1 }, - { "omdog", 0 }, { "omgpio", 0 }, { "omgpio", 1 }, { "omgpio", 2 }, @@ -88,7 +85,6 @@ struct board_dev overo_devs[] = { struct board_dev pandaboard_devs[] = { { "omapid", 0 }, { "prcm", 0 }, - { "omdog", 0 }, { "omgpio", 0 }, { "omgpio", 1 }, { "omgpio", 2 }, diff --git a/sys/arch/armv7/omap/omdog.c b/sys/arch/armv7/omap/omdog.c index d3d54a5e073..f4df5c4452d 100644 --- a/sys/arch/armv7/omap/omdog.c +++ b/sys/arch/armv7/omap/omdog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: omdog.c,v 1.5 2014/12/10 12:27:56 mikeb Exp $ */ +/* $OpenBSD: omdog.c,v 1.6 2016/06/26 05:16:33 jsg Exp $ */ /* * Copyright (c) 2013 Federico G. Schwindt <fgsch@openbsd.org> * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> @@ -24,8 +24,13 @@ #include <sys/evcount.h> #include <sys/socket.h> #include <sys/timeout.h> + #include <machine/intr.h> #include <machine/bus.h> +#include <machine/fdt.h> + +#include <dev/ofw/openfirm.h> + #include <armv7/armv7/armv7var.h> #define WIDR 0x00 /* Identification Register */ @@ -56,6 +61,7 @@ struct omdog_softc { struct omdog_softc *omdog_sc; +int omdog_match(struct device *, void *, void *); void omdog_attach(struct device *, struct device *, void *); int omdog_activate(struct device *, int); void omdog_start(struct omdog_softc *); @@ -65,23 +71,35 @@ int omdog_cb(void *, int); void omdog_reset(void); struct cfattach omdog_ca = { - sizeof (struct omdog_softc), NULL, omdog_attach, NULL, omdog_activate + sizeof (struct omdog_softc), omdog_match, omdog_attach, NULL, + omdog_activate }; struct cfdriver omdog_cd = { NULL, "omdog", DV_DULL }; +int +omdog_match(struct device *parent, void *match, void *aux) +{ + struct fdt_attach_args *faa = aux; + + return OF_is_compatible(faa->fa_node, "ti,omap3-wdt"); +} + void -omdog_attach(struct device *parent, struct device *self, void *args) +omdog_attach(struct device *parent, struct device *self, void *aux) { - struct armv7_attach_args *aa = args; + struct fdt_attach_args *faa = aux; struct omdog_softc *sc = (struct omdog_softc *) self; u_int32_t rev; - sc->sc_iot = aa->aa_iot; - if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr, - aa->aa_dev->mem[0].size, 0, &sc->sc_ioh)) + if (faa->fa_nreg < 2) + return; + + sc->sc_iot = faa->fa_iot; + if (bus_space_map(sc->sc_iot, faa->fa_reg[0], + faa->fa_reg[1], 0, &sc->sc_ioh)) panic("%s: bus_space_map failed!", __func__); rev = bus_space_read_4(sc->sc_iot, sc->sc_ioh, WIDR); |