summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-09-15 21:55:52 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-09-15 21:55:52 +0000
commita62e5041e21fdb6412ad7821c6a6e28955b7eafd (patch)
tree1b4f69a0a6a2f45dc26183e156b731e654085d54 /sys/arch
parent7e7470f63c9cf017ecfb9c73aeb89b3104c06311 (diff)
Add omwugen(4) a driver for the TI logic that generates wakeup events
and routes interrupts to the GIC/ampintc(4). The code is derived from imxgpc(4) which has the same role on imx. In the pandaboard device tree wugen is the default interrupt parent and is used for the hsmmc nodes. Adding this driver makes ommmc(4) interrupts work again on pandaboard. ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/armv7/conf/GENERIC3
-rw-r--r--sys/arch/armv7/conf/RAMDISK3
-rw-r--r--sys/arch/armv7/omap/files.omap6
-rw-r--r--sys/arch/armv7/omap/omwugen.c63
4 files changed, 72 insertions, 3 deletions
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC
index b142f4eec10..c11ef0ebf5f 100644
--- a/sys/arch/armv7/conf/GENERIC
+++ b/sys/arch/armv7/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.53 2016/09/12 08:28:44 mpi Exp $
+# $OpenBSD: GENERIC,v 1.54 2016/09/15 21:55:51 jsg Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -63,6 +63,7 @@ omapid* at omap?
# OMAP on-chip devices
intc* at fdt? # OMAP3 interrupt controller
+omwugen* at fdt? # Wake-up generator
#edma* at omap? # OMAP3 dma controller
prcm* at omap? # power/clock controller
sitaracm* at omap? # sitara control module
diff --git a/sys/arch/armv7/conf/RAMDISK b/sys/arch/armv7/conf/RAMDISK
index 75364d33f95..b0a8e4a82d0 100644
--- a/sys/arch/armv7/conf/RAMDISK
+++ b/sys/arch/armv7/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.48 2016/08/21 06:36:23 jsg Exp $
+# $OpenBSD: RAMDISK,v 1.49 2016/09/15 21:55:51 jsg Exp $
machine armv7 arm
@@ -61,6 +61,7 @@ omapid* at omap?
# OMAP on-chip devices
intc* at fdt? # OMAP3 interrupt controller
+omwugen* at fdt? # Wake-up generator
#edma* at omap? # OMAP3 dma controller
prcm* at omap? # power/clock controller
sitaracm* at omap? # sitara control module
diff --git a/sys/arch/armv7/omap/files.omap b/sys/arch/armv7/omap/files.omap
index 976733b6852..f4c22f18a09 100644
--- a/sys/arch/armv7/omap/files.omap
+++ b/sys/arch/armv7/omap/files.omap
@@ -1,4 +1,4 @@
-# $OpenBSD: files.omap,v 1.17 2016/08/15 13:42:49 patrick Exp $
+# $OpenBSD: files.omap,v 1.18 2016/09/15 21:55:51 jsg Exp $
define omap {}
device omap: omap
@@ -42,6 +42,10 @@ device intc
attach intc at fdt
file arch/armv7/omap/intc.c intc
+device omwugen
+attach omwugen at fdt
+file arch/armv7/omap/omwugen.c omwugen
+
device gptimer
attach gptimer at omap
file arch/armv7/omap/gptimer.c gptimer
diff --git a/sys/arch/armv7/omap/omwugen.c b/sys/arch/armv7/omap/omwugen.c
new file mode 100644
index 00000000000..951cd4b14e2
--- /dev/null
+++ b/sys/arch/armv7/omap/omwugen.c
@@ -0,0 +1,63 @@
+/* $OpenBSD: omwugen.c,v 1.1 2016/09/15 21:55:51 jsg Exp $ */
+/*
+ * Copyright (c) 2016 Mark Kettenis
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/fdt.h>
+
+#include <dev/ofw/openfirm.h>
+
+struct omwugen_softc {
+ struct device sc_dev;
+ struct interrupt_controller sc_ic;
+};
+
+int omwugen_match(struct device *, void *, void *);
+void omwugen_attach(struct device *, struct device *, void *);
+
+struct cfattach omwugen_ca = {
+ sizeof(struct omwugen_softc), omwugen_match, omwugen_attach
+};
+
+struct cfdriver omwugen_cd = {
+ NULL, "omwugen", DV_DULL
+};
+
+int
+omwugen_match(struct device *parent, void *match, void *aux)
+{
+ struct fdt_attach_args *faa = aux;
+
+ return OF_is_compatible(faa->fa_node, "ti,omap4-wugen-mpu");
+}
+
+void
+omwugen_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct fdt_attach_args *faa = aux;
+ struct omwugen_softc *sc = (struct omwugen_softc *)self;
+
+ sc->sc_ic.ic_node = faa->fa_node;
+ sc->sc_ic.ic_cookie = &sc->sc_ic;
+ sc->sc_ic.ic_establish = arm_intr_parent_establish_fdt;
+ sc->sc_ic.ic_disestablish = arm_intr_parent_disestablish_fdt;
+ arm_intr_register_fdt(&sc->sc_ic);
+
+ printf("\n");
+}