From be215b460d1f2314222e4caee341ae86cccff417 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sun, 15 May 2016 22:10:25 +0000 Subject: Map the ADMA2 descriptor table use BUS_DMA_COHERENT and add a missing bus_dmamap_sync(9). Doesn't really fix anything, but adding the missing sync makes the code more correct. Using BUS_DMA_COHERENT avoids some cache flushes. --- sys/arch/armv7/imx/imxesdhc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/arch/armv7/imx/imxesdhc.c b/sys/arch/armv7/imx/imxesdhc.c index 6c7cbefc2d2..4a7164f82e5 100644 --- a/sys/arch/armv7/imx/imxesdhc.c +++ b/sys/arch/armv7/imx/imxesdhc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imxesdhc.c,v 1.18 2016/05/08 20:22:03 kettenis Exp $ */ +/* $OpenBSD: imxesdhc.c,v 1.19 2016/05/15 22:10:24 kettenis Exp $ */ /* * Copyright (c) 2009 Dale Rahn * Copyright (c) 2006 Uwe Stuehler @@ -362,7 +362,7 @@ imxesdhc_attach(struct device *parent, struct device *self, void *args) if (error) goto adma_done; error = bus_dmamem_map(sc->sc_dmat, sc->adma_segs, rseg, - PAGE_SIZE, &sc->adma2, BUS_DMA_WAITOK); + PAGE_SIZE, &sc->adma2, BUS_DMA_WAITOK | BUS_DMA_COHERENT); if (error) { bus_dmamem_free(sc->sc_dmat, sc->adma_segs, rseg); goto adma_done; @@ -976,6 +976,8 @@ imxesdhc_transfer_data(struct imxesdhc_softc *sc, struct sdmmc_command *cmd) } } + bus_dmamap_sync(sc->sc_dmat, sc->adma_map, 0, PAGE_SIZE, + BUS_DMASYNC_POSTWRITE); goto done; } -- cgit v1.2.3