socsvn commit: r287377 - soc2015/pratiksinghal/cubie-head/sys/arm/allwinner

pratiksinghal at FreeBSD.org pratiksinghal at FreeBSD.org
Sat Jun 20 12:15:10 UTC 2015


Author: pratiksinghal
Date: Sat Jun 20 12:15:08 2015
New Revision: 287377
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287377

Log:
  Corrected the way segment address is passed in prepare function

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	Sat Jun 20 11:20:25 2015	(r287376)
+++ soc2015/pratiksinghal/cubie-head/sys/arm/allwinner/a10_mmc.c	Sat Jun 20 12:15:08 2015	(r287377)
@@ -97,7 +97,7 @@
 	int 			a10_dma_ops ;
 	bus_dma_tag_t		a10_dma_buff_tag ;
 	bus_dmamap_t		a10_dma_buff_map ;
-	bus_addr_t		a10_dma_buff_addr ;
+	bus_addr_t		a10_dma_buff_addrs[A10_DMA_NSEGS] ;
 
 };
 
@@ -230,7 +230,7 @@
 			sc->a10_use_dma = 0 ;
 		}
 	}
-	sc->a10_dma_buff_addr = 0;
+	sc->a10_dma_buff_addrs[0] = 0;
 #ifdef DEBUG
 	device_printf(sc->a10_dev, "DMA status %d\n", sc->a10_use_dma) ;
 #endif
@@ -300,22 +300,22 @@
 	rem = min(len,cmd->data->len) ;
 	uint32_t error = bus_dmamap_load(sc->a10_dma_buff_tag, sc->a10_dma_buff_map,
 					cmd->data->data,rem,a10_dma_buff_cb,
-					&sc->a10_dma_buff_addr,0) ;
+					sc->a10_dma_buff_addrs,0) ;
 	if (error == EINPROGRESS) {
-		for( ; sc->a10_dma_buff_addr == 0 ; )  { }
+		for( ; sc->a10_dma_buff_addrs[0] == 0 ; )  { }
 	}
 	else if (error != 0)  {
 		device_printf(sc->a10_dev, "DMA transaction failed due to insufficient resources\n") ;
 		return EIO  ;
 	}
 
-	bus_addr_t paddr = sc->a10_dma_buff_addr ;
 	while (rem > 0) {
 		if (desc == sc->a10_dma_ndesc)
 			break ;
 		len = min(sc->a10_dma_xfer_len, rem) ;
 		dma[desc].buff_size = htole32(len) ;
-		dma[desc].buff_addr = htole32(paddr + off) ;
+		device_printf(sc->a10_dev, "The address is %lu\n", sc->a10_dma_buff_addrs[desc]) ; 
+		dma[desc].buff_addr = htole32(sc->a10_dma_buff_addrs[desc]) ;
 		dma[desc].config = htole32(A10_MMC_DMA_CONFIG_CH|A10_MMC_DMA_CONFIG_OWN) ;
 
 		cmd->data->len -= len ;
@@ -374,11 +374,10 @@
 static int
 a10_mmc_can_do_dma(struct mmc_request* req)
 {
-	return (1) ; 
-	//if ((req->cmd->data->len > A10_MMC_DMA_MAXLEN) || (req->cmd->data->len <= A10_MMC_DMA_MINLEN))
-	//	return (0) ;
-	//else
-	//	return (1) ;
+	if ((req->cmd->data->len > A10_MMC_DMA_MAXLEN) || (req->cmd->data->len <= A10_MMC_DMA_MINLEN))
+		return (0) ;
+	else
+		return (1) ;
 }
 static void
 a10_dma_cb(void* arg, bus_dma_segment_t* segs, int nsegs, int error)
@@ -399,7 +398,10 @@
 		printf("a10_mmc: Error in a10_dma_buff_callback function, code = %d\n", error) ;
 		return  ;
 	}
-	*(bus_addr_t*)arg = segs[0].ds_addr ;
+	bus_addr_t* ptr = (bus_addr_t*) arg ;
+	int i = 0;
+	for(i=0; i<nsegs; i++)
+		ptr[i] = segs[i].ds_addr ; 
 }
 
 static int
@@ -463,7 +465,7 @@
 	sc->a10_resid = 0;
 	sc->a10_idst = 0 ;
 	sc->a10_intr_wait = 0;
-	sc->a10_dma_buff_addr = 0 ;
+	sc->a10_dma_buff_addrs[0] = 0 ;
 	req->done(req);
 }
 


More information about the svn-soc-all mailing list