socsvn commit: r285916 - soc2015/pratiksinghal/cubie-head/sys/arm/allwinner
pratiksinghal at FreeBSD.org
pratiksinghal at FreeBSD.org
Sat May 23 10:08:59 UTC 2015
Author: pratiksinghal
Date: Sat May 23 10:08:58 2015
New Revision: 285916
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=285916
Log:
Fixed a typo and added some useful comments
Modified:
soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_dma.c
soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c
Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_dma.c
==============================================================================
--- soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_dma.c Sat May 23 09:49:40 2015 (r285915)
+++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_dma.c Sat May 23 10:08:58 2015 (r285916)
@@ -17,7 +17,7 @@
#include "a10_dma.h"
-/*Total no of channels for Dedicated and Nomal DMA */
+/*Total no of channels for Dedicated and Normal DMA */
#define NNDMA 8
#define NDDMA 8
@@ -65,6 +65,7 @@
static int a10_dma_attach(device_t) ;
static int a10_dma_detach(device_t) ;
static void a10_dma_release_resources(device_t) ;
+static void a10_temp_setup_dma() ;
static void a10_dma_intr(void*) ;
@@ -153,7 +154,11 @@
/* Not implemented yet. */
static void a10_dma_intr(void* ptr)
{
- //struct a10_dma_softc* sc = (struct a10_dma_softc*) ptr ;
+ struct a10_dma_softc* sc = (struct a10_dma_softc*) ptr ;
+ if(DMA_READ(sc, DMA_IRQ_PEND_STA_REG)&DDMA_IRQ_FULL_ENABLE(0))
+ device_printf(sc->a10_dma_dev, "DDMA channel 0 end transfer interrupt received on the dma controller.") ;
+ else
+ device_printf(sc->a10_dma_dev, "Unexpected interrupt received in a10_dma_intr") ;
return ;
}
@@ -191,6 +196,11 @@
device_printf(a10_dma_cnt->sc->a10_dma_dev, "Freed DDMA Channel no %u\n", pos) ;
}
+void a10_temp_setup_dma()
+{
+ struct a10_dma_softc* sc = a10_dma_cnt->sc ;
+ DMA_WRITE(sc, DMA_IRQ_EN_REG,DDMA_IRQ_FULL_ENABLE(0)) ;
+}
static device_method_t a10_dma_methods[] = {
DEVMETHOD(device_probe, a10_dma_probe),
DEVMETHOD(device_attach, a10_dma_attach),
@@ -208,3 +218,6 @@
} ;
DRIVER_MODULE(a10_dma, simplebus, a10_dma_driver ,a10_dma_devclass,0,0) ;
+
+/* The application which wants to use the DMA needs to request a DMA channel and "autoconfigure" it and then handle its interrupts. */
+/* Specifically, (wrt MMC) the MMC driver will start the DMA transfer and then wait for the interrupt to occur. */
Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c
==============================================================================
--- soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c Sat May 23 09:49:40 2015 (r285915)
+++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c Sat May 23 10:08:58 2015 (r285916)
@@ -310,6 +310,7 @@
"Spurious timeout - no active request\n");
}
+/* We have to request the dma controller to transfer data in this function. */
static int
a10_mmc_pio_transfer(struct a10_mmc_softc *sc, struct mmc_data *data)
{
@@ -319,6 +320,7 @@
buf = (uint32_t *)data->data;
write = (data->flags & MMC_DATA_WRITE) ? 1 : 0;
bit = write ? A10_MMC_FIFO_FULL : A10_MMC_FIFO_EMPTY;
+ uint32_t old_resid = sc->a10_resid ;
for (i = sc->a10_resid; i < (data->len >> 2); i++) {
if ((A10_MMC_READ_4(sc, A10_MMC_STAS) & bit))
return (1);
@@ -328,7 +330,14 @@
buf[i] = A10_MMC_READ_4(sc, A10_MMC_FIFO);
sc->a10_resid = i + 1;
}
-
+ if(!write)
+ {
+ device_printf(sc->a10_dev, "Transferred %d bytes from the card\n", (i-old_resid)*4 ) ;
+ }
+ else
+ {
+ device_printf(sc->a10_dev, "Wrote %d bytes to the card\n", (i-old_resid)*4 ) ;
+ }
return (0);
}
More information about the svn-soc-all
mailing list