Skip to content

Commit

Permalink
dmaengine: rcar-dmac: Work around descriptor mode IOMMU errata
Browse files Browse the repository at this point in the history
When descriptor memory is accessed through an IOMMU the DMADAR register
isn't initialized automatically from the first descriptor at beginning
of transfer by the DMAC like it should. Initialize it manually with the
destination address of the first chunk.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  • Loading branch information
Laurent Pinchart authored and Vinod Koul committed Feb 16, 2015
1 parent 6a63480 commit 3f46306
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/dma/sh/rcar-dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ static void rcar_dmac_chan_start_xfer(struct rcar_dmac_chan *chan)
rcar_dmac_chan_write(chan, RCAR_DMARS, chan->mid_rid);

if (desc->hwdescs.use) {
struct rcar_dmac_xfer_chunk *chunk;

dev_dbg(chan->chan.device->dev,
"chan%u: queue desc %p: %u@%pad\n",
chan->index, desc, desc->nchunks, &desc->hwdescs.dma);
Expand All @@ -340,6 +342,18 @@ static void rcar_dmac_chan_start_xfer(struct rcar_dmac_chan *chan)
RCAR_DMACHCRB_DCNT(desc->nchunks - 1) |
RCAR_DMACHCRB_DRST);

/*
* Errata: When descriptor memory is accessed through an IOMMU
* the DMADAR register isn't initialized automatically from the
* first descriptor at beginning of transfer by the DMAC like it
* should. Initialize it manually with the destination address
* of the first chunk.
*/
chunk = list_first_entry(&desc->chunks,
struct rcar_dmac_xfer_chunk, node);
rcar_dmac_chan_write(chan, RCAR_DMADAR,
chunk->dst_addr & 0xffffffff);

/*
* Program the descriptor stage interrupt to occur after the end
* of the first stage.
Expand Down

0 comments on commit 3f46306

Please sign in to comment.