socsvn commit: r286783 - soc2015/pratiksinghal/cubie-head/sys/arm/allwinner
pratiksinghal at FreeBSD.org
pratiksinghal at FreeBSD.org
Sun Jun 7 14:26:27 UTC 2015
Author: pratiksinghal
Date: Sun Jun 7 14:26:26 2015
New Revision: 286783
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=286783
Log:
Removed the kernel panic and locking problem
Modified:
soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c
Modified: soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c
==============================================================================
--- soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c Sun Jun 7 13:59:02 2015 (r286782)
+++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c Sun Jun 7 14:26:26 2015 (r286783)
@@ -211,6 +211,8 @@
sc->a10_use_dma = 0 ;
}
}
+ //sc->a10_use_dma = 0 ; /* Remove this after testing */
+ device_printf(sc->a10_dev, "Setting up dma finished %d\n", sc->a10_use_dma) ;
return (0);
fail:
@@ -258,16 +260,21 @@
static int
a10_mmc_prepare_dma(struct a10_mmc_softc* sc)
{
+ device_printf(sc->a10_dev, "In the start of prepare dma\n") ;
struct a10_mmc_dma_desc* dma = sc->a10_dma_desc ;
struct mmc_command* cmd = sc->a10_req->cmd ;
+ device_printf(sc->a10_dev, "After the cmd part\n") ;
int read = (sc->a10_req->cmd->data->flags & MMC_DATA_WRITE) ? 0 : 1 ;
+ device_printf(sc->a10_dev, "After the read part\n") ;
bus_addr_t desc_paddr = (sc->a10_dma_cb_arg).addr ;
+ device_printf(sc->a10_dev, "After the block before the for loop\n") ;
bus_size_t off = 0 ;
int desc, rem,seg ;
uint32_t val ;
desc = 0 ;
+ device_printf(sc->a10_dev, "Before the starting of for loop\n") ;
/* Pick a segment and program all the descriptors in the segment. */
for(seg = 0; seg < sc->a10_dma_cb_arg.nsegs ; seg++)
{
@@ -303,11 +310,13 @@
}
}
+ device_printf(sc->a10_dev, "After the for loop in a10_prepare_dma\n") ;
if(desc == sc->a10_dma_ndesc) {
device_printf(sc->a10_dev, "Couldn't find enough descriptors for DMA transfer") ;
return EIO ;
}
+ device_printf(sc->a10_dev, "After the desc check\n") ;
bus_dmamap_sync(sc->a10_dma_tag, sc->a10_dma_map, BUS_DMASYNC_PREWRITE) ;
val = A10_MMC_READ_4(sc, A10_MMC_GCTRL) ;
@@ -331,7 +340,8 @@
A10_MMC_WRITE_4(sc, A10_MMC_IDIE,val) ;
A10_MMC_WRITE_4(sc, A10_MMC_DLBA,desc_paddr) ;
A10_MMC_WRITE_4(sc, A10_MMC_FTRGL,A10_MMC_DMA_FTRGLEVEL_A20) ;
-
+
+ device_printf(sc->a10_dev, "Done preparing for DMA\n") ;
return (0) ;
}
@@ -500,7 +510,7 @@
rint = A10_MMC_READ_4(sc, A10_MMC_RINTR);
imask = A10_MMC_READ_4(sc, A10_MMC_IMASK);
idst = A10_MMC_READ_4(sc, A10_MMC_IDST) ;
- if (imask == 0 && rint == 0) {
+ if (imask == 0 && rint == 0 ) {
A10_MMC_UNLOCK(sc);
return;
}
@@ -539,6 +549,12 @@
else
a10_mmc_req_ok(sc) ;
}
+ else
+ a10_mmc_req_done(sc) ;
+
+ A10_MMC_WRITE_4(sc, A10_MMC_IDST, idst) ;
+ A10_MMC_WRITE_4(sc, A10_MMC_RINTR, rint) ;
+ A10_MMC_UNLOCK(sc) ;
return ;
}
@@ -575,6 +591,7 @@
uint32_t cmdreg;
sc = device_get_softc(bus);
+ device_printf(sc->a10_dev, "a10_req = %p\n", sc->a10_req) ;
A10_MMC_LOCK(sc);
if (sc->a10_req) {
A10_MMC_UNLOCK(sc);
@@ -609,13 +626,12 @@
blksz = min(cmd->data->len, MMC_SECTOR_SIZE);
A10_MMC_WRITE_4(sc, A10_MMC_BLKSZ, blksz);
A10_MMC_WRITE_4(sc, A10_MMC_BCNTR, cmd->data->len);
+ if(sc->a10_use_dma == 1)
+ a10_mmc_prepare_dma(sc) ;
}
A10_MMC_WRITE_4(sc, A10_MMC_CARG, cmd->arg);
- if(sc->a10_use_dma == 1)
- a10_mmc_prepare_dma(sc) ;
A10_MMC_WRITE_4(sc, A10_MMC_CMDR, cmdreg | cmd->opcode);
-
callout_reset(&sc->a10_timeoutc, sc->a10_timeout * hz,
a10_mmc_timeout, sc);
A10_MMC_UNLOCK(sc);
More information about the svn-soc-all
mailing list