Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Jul 2016 10:38:28 +0000 (UTC)
From:      Jared McNeill <jmcneill@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302522 - head/sys/arm/allwinner
Message-ID:  <201607101038.u6AAcS8t001149@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmcneill
Date: Sun Jul 10 10:38:28 2016
New Revision: 302522
URL: https://svnweb.freebsd.org/changeset/base/302522

Log:
  Align descriptors and data buffers to 32 bits. This restriction is
  described in the A20 (and later) user manuals.

Modified:
  head/sys/arm/allwinner/a10_mmc.c
  head/sys/arm/allwinner/a10_mmc.h

Modified: head/sys/arm/allwinner/a10_mmc.c
==============================================================================
--- head/sys/arm/allwinner/a10_mmc.c	Sun Jul 10 10:21:22 2016	(r302521)
+++ head/sys/arm/allwinner/a10_mmc.c	Sun Jul 10 10:38:28 2016	(r302522)
@@ -316,7 +316,8 @@ a10_mmc_setup_dma(struct a10_mmc_softc *
 
 	/* Allocate the DMA descriptor memory. */
 	dma_desc_size = sizeof(struct a10_mmc_dma_desc) * A10_MMC_DMA_SEGS;
-	error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), 1, 0,
+	error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev),
+	    A10_MMC_DMA_ALIGN, 0,
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	    dma_desc_size, 1, dma_desc_size, 0, NULL, NULL, &sc->a10_dma_tag);
 	if (error)
@@ -334,7 +335,8 @@ a10_mmc_setup_dma(struct a10_mmc_softc *
 		return (sc->a10_dma_map_err);
 
 	/* Create the DMA map for data transfers. */
-	error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev), 1, 0,
+	error = bus_dma_tag_create(bus_get_dma_tag(sc->a10_dev),
+	    A10_MMC_DMA_ALIGN, 0,
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
 	    A10_MMC_DMA_MAX_SIZE * A10_MMC_DMA_SEGS, A10_MMC_DMA_SEGS,
 	    A10_MMC_DMA_MAX_SIZE, BUS_DMA_ALLOCNOW, NULL, NULL,

Modified: head/sys/arm/allwinner/a10_mmc.h
==============================================================================
--- head/sys/arm/allwinner/a10_mmc.h	Sun Jul 10 10:21:22 2016	(r302521)
+++ head/sys/arm/allwinner/a10_mmc.h	Sun Jul 10 10:38:28 2016	(r302522)
@@ -196,4 +196,7 @@ struct a10_mmc_dma_desc {
 	uint32_t next;
 };
 
+/* DMA descriptors and data buffers must be aligned to 32-bits */
+#define	A10_MMC_DMA_ALIGN		4
+
 #endif /* _A10_MMC_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607101038.u6AAcS8t001149>