diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-03-01 04:34:10 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2017-03-01 04:34:10 +0000 |
commit | 7f58cc94c7bcc48c346df26d0be700ee08093e34 (patch) | |
tree | 0e57c2510eca1163aef037af6cbfd168f6d5b4f0 /sys | |
parent | ab1b92a9be064b592e4e4d0ed7cca45597a9e303 (diff) |
Dynamically attach edma(4) using the FDT.
From Ian Sutton.
Diffstat (limited to 'sys')
-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/edma.c | 33 | ||||
-rw-r--r-- | sys/arch/armv7/omap/files.omap | 4 |
4 files changed, 30 insertions, 15 deletions
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC index b74774649ad..e4b2d1bc5df 100644 --- a/sys/arch/armv7/conf/GENERIC +++ b/sys/arch/armv7/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.71 2017/01/23 22:43:17 jsg Exp $ +# $OpenBSD: GENERIC,v 1.72 2017/03/01 04:34:09 jsg Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -63,7 +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 +#edma* at fdt? # OMAP3 dma controller prcm* at omap? # power/clock controller ompinmux* at fdt? # pin muxing omdog* at fdt? # watchdog timer diff --git a/sys/arch/armv7/conf/RAMDISK b/sys/arch/armv7/conf/RAMDISK index 3c76c71d2e7..be942eb04ea 100644 --- a/sys/arch/armv7/conf/RAMDISK +++ b/sys/arch/armv7/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.65 2017/01/23 22:43:17 jsg Exp $ +# $OpenBSD: RAMDISK,v 1.66 2017/03/01 04:34:09 jsg Exp $ machine armv7 arm @@ -61,7 +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 +#edma* at fdt? # OMAP3 dma controller prcm* at omap? # power/clock controller ompinmux* at fdt? # pin muxing omdog* at fdt? # watchdog timer diff --git a/sys/arch/armv7/omap/edma.c b/sys/arch/armv7/omap/edma.c index 333bcc880a7..01e62a026d2 100644 --- a/sys/arch/armv7/omap/edma.c +++ b/sys/arch/armv7/omap/edma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edma.c,v 1.5 2015/01/22 14:33:01 krw Exp $ */ +/* $OpenBSD: edma.c,v 1.6 2017/03/01 04:34:09 jsg Exp $ */ /* * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -19,12 +19,15 @@ #include <sys/types.h> #include <sys/systm.h> -#include <machine/bus.h> +#include <machine/fdt.h> #include <armv7/armv7/armv7var.h> #include <armv7/omap/prcmvar.h> #include <armv7/omap/edmavar.h> +#include <dev/ofw/openfirm.h> +#include <dev/ofw/fdt.h> + #define DEVNAME(s) ((s)->sc_dev.dv_xname) struct edma_softc { @@ -78,30 +81,42 @@ struct edma_softc { struct edma_softc *edma_sc; +int edma_match(struct device *, void *, void *); void edma_attach(struct device *, struct device *, void *); int edma_comp_intr(void *); struct cfattach edma_ca = { - sizeof(struct edma_softc), NULL, edma_attach + sizeof(struct edma_softc), edma_match, edma_attach }; struct cfdriver edma_cd = { NULL, "edma", DV_DULL }; +int +edma_match(struct device *parent, void *match, void *aux) +{ + struct fdt_attach_args *faa = aux; + + return OF_is_compatible(faa->fa_node, "ti,edma3-tpcc"); +} + void edma_attach(struct device *parent, struct device *self, void *aux) { - struct armv7_attach_args *aa = aux; + struct fdt_attach_args *faa = aux; struct edma_softc *sc = (struct edma_softc *)self; uint32_t rev; int i; - sc->sc_iot = aa->aa_iot; + if (faa->fa_nreg < 1) + return; + + sc->sc_iot = faa->fa_iot; /* Map Base address for TPCC and TPCTX */ - if (bus_space_map(sc->sc_iot, aa->aa_dev->mem[0].addr, - aa->aa_dev->mem[0].size, 0, &sc->sc_tpcc)) { + if (bus_space_map(sc->sc_iot, faa->fa_reg[0].addr, + faa->fa_reg[0].size, 0, &sc->sc_tpcc)) { printf("%s: bus_space_map failed for TPCC\n", DEVNAME(sc)); return ; } @@ -115,12 +130,12 @@ edma_attach(struct device *parent, struct device *self, void *aux) /* XXX IPL_VM ? */ /* Enable interrupts line */ - sc->sc_ih_comp = arm_intr_establish(aa->aa_dev->irq[0], IPL_VM, + sc->sc_ih_comp = arm_intr_establish_fdt(faa->fa_node, IPL_VM, edma_comp_intr, sc, DEVNAME(sc)); if (sc->sc_ih_comp == NULL) { printf("%s: unable to establish interrupt comp\n", DEVNAME(sc)); bus_space_unmap(sc->sc_iot, sc->sc_tpcc, - aa->aa_dev->mem[0].size); + faa->fa_reg[0].size); return ; } diff --git a/sys/arch/armv7/omap/files.omap b/sys/arch/armv7/omap/files.omap index 411288d7756..39512d81eb8 100644 --- a/sys/arch/armv7/omap/files.omap +++ b/sys/arch/armv7/omap/files.omap @@ -1,4 +1,4 @@ -# $OpenBSD: files.omap,v 1.19 2016/10/03 01:59:20 jsg Exp $ +# $OpenBSD: files.omap,v 1.20 2017/03/01 04:34:09 jsg Exp $ define omap {} device omap: omap @@ -39,7 +39,7 @@ attach tiiic at fdt file arch/armv7/omap/ti_iic.c tiiic device edma -attach edma at omap +attach edma at fdt file arch/armv7/omap/edma.c edma device intc |