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 Invoke callback routine for all DMA in...
details: https://anonhg.NetBSD.org/src/rev/d0f682c78f9a
branches: trunk
changeset: 339776:d0f682c78f9a
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun Aug 09 13:06:44 2015 +0000
description:
Invoke callback routine for all DMA interrupts.
Pass status and error bits to callback instead of filtering them early.
Adjust the current only callback routine in the EMMC driver.
diffstat:
sys/arch/arm/broadcom/bcm2835_dmac.c | 23 +++++++++++++----------
sys/arch/arm/broadcom/bcm2835_dmac.h | 4 ++--
sys/arch/arm/broadcom/bcm2835_emmc.c | 15 ++++++++++-----
3 files changed, 25 insertions(+), 17 deletions(-)
diffs (128 lines):
diff -r 4a1d7ce53070 -r d0f682c78f9a sys/arch/arm/broadcom/bcm2835_dmac.c
--- a/sys/arch/arm/broadcom/bcm2835_dmac.c Sun Aug 09 13:03:10 2015 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_dmac.c Sun Aug 09 13:06:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_dmac.c,v 1.12 2015/08/02 16:46:12 jmcneill Exp $ */
+/* $NetBSD: bcm2835_dmac.c,v 1.13 2015/08/09 13:06:44 mlelstv 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.12 2015/08/02 16:46:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_dmac.c,v 1.13 2015/08/09 13:06:44 mlelstv Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -53,7 +53,7 @@
struct bcm_dmac_softc *ch_sc;
void *ch_ih;
uint8_t ch_index;
- void (*ch_callback)(void *);
+ void (*ch_callback)(uint32_t, uint32_t, void *);
void *ch_callbackarg;
uint32_t ch_debug;
};
@@ -165,23 +165,26 @@
{
struct bcm_dmac_channel *ch = priv;
struct bcm_dmac_softc *sc = ch->ch_sc;
- uint32_t cs;
+ uint32_t cs, ce;
cs = DMAC_READ(sc, DMAC_CS(ch->ch_index));
- if (!(cs & DMAC_CS_INTMASK))
- return 0;
+ DMAC_WRITE(sc, DMAC_CS(ch->ch_index), cs);
+ cs &= DMAC_CS_INT | DMAC_CS_END | DMAC_CS_ERROR;
- DMAC_WRITE(sc, DMAC_CS(ch->ch_index), cs);
+ ce = DMAC_READ(sc, DMAC_DEBUG(ch->ch_index));
+ ce &= DMAC_DEBUG_READ_ERROR | DMAC_DEBUG_FIFO_ERROR
+ | DMAC_DEBUG_READ_LAST_NOT_SET_ERROR;
+ DMAC_WRITE(sc, DMAC_DEBUG(ch->ch_index), ce);
if (ch->ch_callback)
- ch->ch_callback(ch->ch_callbackarg);
+ ch->ch_callback(cs, ce, ch->ch_callbackarg);
return 1;
}
struct bcm_dmac_channel *
-bcm_dmac_alloc(enum bcm_dmac_type type, int ipl, void (*cb)(void *),
- void *cbarg)
+bcm_dmac_alloc(enum bcm_dmac_type type, int ipl,
+ void (*cb)(uint32_t, uint32_t, void *), void *cbarg)
{
struct bcm_dmac_softc *sc;
struct bcm_dmac_channel *ch = NULL;
diff -r 4a1d7ce53070 -r d0f682c78f9a sys/arch/arm/broadcom/bcm2835_dmac.h
--- a/sys/arch/arm/broadcom/bcm2835_dmac.h Sun Aug 09 13:03:10 2015 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_dmac.h Sun Aug 09 13:06:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_dmac.h,v 1.3 2014/09/12 19:33:45 jakllsch Exp $ */
+/* $NetBSD: bcm2835_dmac.h,v 1.4 2015/08/09 13:06:44 mlelstv Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -102,7 +102,7 @@
struct bcm_dmac_channel;
struct bcm_dmac_channel *bcm_dmac_alloc(enum bcm_dmac_type, int,
- void (*)(void *), void *);
+ void (*)(uint32_t, uint32_t, void *), void *);
void bcm_dmac_free(struct bcm_dmac_channel *);
void bcm_dmac_set_conblk_addr(struct bcm_dmac_channel *, bus_addr_t);
int bcm_dmac_transfer(struct bcm_dmac_channel *);
diff -r 4a1d7ce53070 -r d0f682c78f9a sys/arch/arm/broadcom/bcm2835_emmc.c
--- a/sys/arch/arm/broadcom/bcm2835_emmc.c Sun Aug 09 13:03:10 2015 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_emmc.c Sun Aug 09 13:06:44 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_emmc.c,v 1.27 2015/08/09 13:03:10 mlelstv Exp $ */
+/* $NetBSD: bcm2835_emmc.c,v 1.28 2015/08/09 13:06:44 mlelstv Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.27 2015/08/09 13:03:10 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_emmc.c,v 1.28 2015/08/09 13:06:44 mlelstv Exp $");
#include "bcmdmac.h"
@@ -82,7 +82,7 @@
static void bcmemmc_attach_i(device_t);
#if NBCMDMAC > 0
static int bcmemmc_xfer_data_dma(struct sdhc_softc *, struct sdmmc_command *);
-static void bcmemmc_dma_done(void *);
+static void bcmemmc_dma_done(uint32_t, uint32_t, void *);
#endif
CFATTACH_DECL_NEW(bcmemmc, sizeof(struct bcmemmc_softc),
@@ -331,14 +331,19 @@
}
static void
-bcmemmc_dma_done(void *arg)
+bcmemmc_dma_done(uint32_t status, uint32_t error, void *arg)
{
struct bcmemmc_softc * const sc = arg;
kmutex_t *plock = sdhc_host_lock(sc->sc_hosts[0]);
+ if (status != (DMAC_CS_INT|DMAC_CS_END))
+ device_printf(sc->sc.sc_dev, "status %#x error %#x\n",
+ status,error);
+
mutex_enter(plock);
KASSERT(sc->sc_state == EMMC_DMA_STATE_BUSY);
- sc->sc_state = EMMC_DMA_STATE_IDLE;
+ if (status & DMAC_CS_END)
+ sc->sc_state = EMMC_DMA_STATE_IDLE;
cv_broadcast(&sc->sc_cv);
mutex_exit(plock);
}
Home |
Main Index |
Thread Index |
Old Index