[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-tech
Subject:    Re: armv7/omap: attach edma at fdt, re-enable
From:       Ian Sutton <ian () ce ! gl>
Date:       2017-02-27 9:16:30
Message-ID: 20170227091630.GB80327 () mail ! ce ! gl
[Download RAW message or body]

On Mon, Feb 27, 2017 at 08:08:16PM +1100, Jonathan Gray wrote:
> There is only one with "ti,edma3-tpcc".

Geez. It may be time to increase my font size.

Index: conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/arch/armv7/conf/GENERIC,v
retrieving revision 1.71
diff -u -p -r1.71 GENERIC
--- conf/GENERIC	23 Jan 2017 22:43:17 -0000	1.71
+++ conf/GENERIC	27 Feb 2017 09:16:03 -0000
@@ -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
Index: omap/edma.c
===================================================================
RCS file: /cvs/src/sys/arch/armv7/omap/edma.c,v
retrieving revision 1.5
diff -u -p -r1.5 edma.c
--- omap/edma.c	22 Jan 2015 14:33:01 -0000	1.5
+++ omap/edma.c	27 Feb 2017 09:16:03 -0000
@@ -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,39 @@ 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;
+	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 +127,12 @@ edma_attach(struct device *parent, struc
 
 	/* 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 ;
 	}
 
Index: omap/files.omap
===================================================================
RCS file: /cvs/src/sys/arch/armv7/omap/files.omap,v
retrieving revision 1.19
diff -u -p -r1.19 files.omap
--- omap/files.omap	3 Oct 2016 01:59:20 -0000	1.19
+++ omap/files.omap	27 Feb 2017 09:16:03 -0000
@@ -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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic