dmaengine: Move all map_sg/unmap_sg for slave channel to its client
Dan Williams wrote: ... DMA-slave clients request specific channels and know the hardware details at a low level, so it should not be too high an expectation to push dma mapping responsibility to the client. Also this patch includes DMA_COMPL_{SRC,DEST}_UNMAP_SINGLE support for dw_dmac driver. Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
committed by
Dan Williams
parent
bbea0b6e0d
commit
657a77fa72
@@ -576,6 +576,7 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data)
|
||||
struct scatterlist *sg;
|
||||
unsigned int i;
|
||||
enum dma_data_direction direction;
|
||||
unsigned int sglen;
|
||||
|
||||
/*
|
||||
* We don't do DMA on "complex" transfers, i.e. with
|
||||
@@ -605,11 +606,14 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data)
|
||||
else
|
||||
direction = DMA_TO_DEVICE;
|
||||
|
||||
sglen = dma_map_sg(&host->pdev->dev, data->sg, data->sg_len, direction);
|
||||
if (sglen != data->sg_len)
|
||||
goto unmap_exit;
|
||||
desc = chan->device->device_prep_slave_sg(chan,
|
||||
data->sg, data->sg_len, direction,
|
||||
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
|
||||
if (!desc)
|
||||
return -ENOMEM;
|
||||
goto unmap_exit;
|
||||
|
||||
host->dma.data_desc = desc;
|
||||
desc->callback = atmci_dma_complete;
|
||||
@@ -620,6 +624,9 @@ atmci_submit_data_dma(struct atmel_mci *host, struct mmc_data *data)
|
||||
chan->device->device_issue_pending(chan);
|
||||
|
||||
return 0;
|
||||
unmap_exit:
|
||||
dma_unmap_sg(&host->pdev->dev, data->sg, sglen, direction);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
#else /* CONFIG_MMC_ATMELMCI_DMA */
|
||||
|
Reference in New Issue
Block a user