From owner-svn-soc-all@FreeBSD.ORG Sat May 23 10:08:59 2015 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 90905189 for ; Sat, 23 May 2015 10:08:59 +0000 (UTC) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E2AC1C44 for ; Sat, 23 May 2015 10:08:59 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4NA8x9W036651 for ; Sat, 23 May 2015 10:08:59 GMT (envelope-from pratiksinghal@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.9/8.14.9/Submit) id t4NA8wH4036647 for svn-soc-all@FreeBSD.org; Sat, 23 May 2015 10:08:58 GMT (envelope-from pratiksinghal@FreeBSD.org) Date: Sat, 23 May 2015 10:08:58 GMT Message-Id: <201505231008.t4NA8wH4036647@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to pratiksinghal@FreeBSD.org using -f From: pratiksinghal@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r285916 - soc2015/pratiksinghal/cubie-head/sys/arm/allwinner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 May 2015 10:08:59 -0000 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); }