Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/broadcom Move DMA interrupt establishement to t...



details:   https://anonhg.NetBSD.org/src/rev/d07cf881d499
branches:  trunk
changeset: 332235:d07cf881d499
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Sep 12 19:33:45 2014 +0000

description:
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.

diffstat:

 sys/arch/arm/broadcom/bcm2835_dmac.c |  22 ++++++++++++----------
 sys/arch/arm/broadcom/bcm2835_dmac.h |   4 ++--
 2 files changed, 14 insertions(+), 12 deletions(-)

diffs (75 lines):

diff -r 78d2dd7ffe69 -r d07cf881d499 sys/arch/arm/broadcom/bcm2835_dmac.c
--- a/sys/arch/arm/broadcom/bcm2835_dmac.c      Fri Sep 12 17:40:53 2014 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_dmac.c      Fri Sep 12 19:33:45 2014 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
                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 @@
 }
 
 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 @@
        }
        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;
 }
 
diff -r 78d2dd7ffe69 -r d07cf881d499 sys/arch/arm/broadcom/bcm2835_dmac.h
--- a/sys/arch/arm/broadcom/bcm2835_dmac.h      Fri Sep 12 17:40:53 2014 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_dmac.h      Fri Sep 12 19:33:45 2014 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -101,7 +101,7 @@
 
 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);



Home | Main Index | Thread Index | Old Index