Module Name:    src
Committed By:   jakllsch
Date:           Fri Sep 12 19:33:45 UTC 2014

Modified Files:
        src/sys/arch/arm/broadcom: bcm2835_dmac.c bcm2835_dmac.h

Log Message:
Move DMA interrupt establishement to time of engine allocation so as to
allow the IPL to be specified by the driver using the DMA engine.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/broadcom/bcm2835_dmac.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/broadcom/bcm2835_dmac.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_dmac.c
diff -u src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.5 src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.6
--- src/sys/arch/arm/broadcom/bcm2835_dmac.c:1.5	Fri Sep 12 16:06:29 2014
+++ src/sys/arch/arm/broadcom/bcm2835_dmac.c	Fri Sep 12 19:33:45 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_dmac.c,v 1.5 2014/09/12 16:06:29 jmcneill Exp $ */
+/* $NetBSD: bcm2835_dmac.c,v 1.6 2014/09/12 19:33:45 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcne...@invisible.ca>
@@ -29,7 +29,7 @@
 #include "opt_ddb.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_dmac.c,v 1.5 2014/09/12 16:06:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_dmac.c,v 1.6 2014/09/12 19:33:45 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -154,13 +154,6 @@ bcm_dmac_attach(device_t parent, device_
 		val = DMAC_READ(sc, DMAC_CS(index));
 		val |= DMAC_CS_RESET;
 		DMAC_WRITE(sc, DMAC_CS(index), val);
-
-		ch->ch_ih = bcm2835_intr_establish(BCM2835_INT_DMA0 + index,
-		    IPL_SCHED, bcm_dmac_intr, ch);
-		if (ch->ch_ih == NULL) {
-			aprint_error("(err)");
-			sc->sc_channelmask &= ~__BIT(index);
-		}
 	}
 	aprint_normal("\n");
 	aprint_naive("\n");
@@ -186,7 +179,8 @@ bcm_dmac_intr(void *priv)
 }
 
 struct bcm_dmac_channel *
-bcm_dmac_alloc(enum bcm_dmac_type type, void (*cb)(void *), void *cbarg)
+bcm_dmac_alloc(enum bcm_dmac_type type, int ipl, void (*cb)(void *),
+    void *cbarg)
 {
 	struct bcm_dmac_softc *sc;
 	struct bcm_dmac_channel *ch = NULL;
@@ -214,6 +208,14 @@ bcm_dmac_alloc(enum bcm_dmac_type type, 
 	}
 	mutex_exit(&sc->sc_lock);
 
+	ch->ch_ih = bcm2835_intr_establish(BCM2835_INT_DMA0 + ch->ch_index,
+	    ipl, bcm_dmac_intr, ch);
+	if (ch->ch_ih == NULL) {
+		aprint_error_dev(sc->sc_dev,
+		    "failed to establish interrupt for DMA%d\n", ch->ch_index);
+		sc->sc_channelmask &= ~__BIT(index);
+	}
+
 	return ch;
 }
 

Index: src/sys/arch/arm/broadcom/bcm2835_dmac.h
diff -u src/sys/arch/arm/broadcom/bcm2835_dmac.h:1.2 src/sys/arch/arm/broadcom/bcm2835_dmac.h:1.3
--- src/sys/arch/arm/broadcom/bcm2835_dmac.h:1.2	Fri Sep 12 17:40:53 2014
+++ src/sys/arch/arm/broadcom/bcm2835_dmac.h	Fri Sep 12 19:33:45 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_dmac.h,v 1.2 2014/09/12 17:40:53 jakllsch Exp $ */
+/* $NetBSD: bcm2835_dmac.h,v 1.3 2014/09/12 19:33:45 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcne...@invisible.ca>
@@ -101,7 +101,7 @@ enum bcm_dmac_type {
 
 struct bcm_dmac_channel;
 
-struct bcm_dmac_channel *bcm_dmac_alloc(enum bcm_dmac_type,
+struct bcm_dmac_channel *bcm_dmac_alloc(enum bcm_dmac_type, int,
 					void (*)(void *), void *);
 void bcm_dmac_free(struct bcm_dmac_channel *);
 void bcm_dmac_set_conblk_addr(struct bcm_dmac_channel *, bus_addr_t);

Reply via email to