Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297508
b: refs/heads/master
c: 6c05f09
h: refs/heads/master
v: v3
  • Loading branch information
Javier Martin authored and Vinod Koul committed Mar 6, 2012
1 parent e609d4f commit df6a2dd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d8b53489d4c80490a70327fce6657816e33fafb3
refs/heads/master: 6c05f09155f40368c51ce00b8291401858e49bcb
36 changes: 35 additions & 1 deletion trunk/drivers/dma/imx-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ static int imxdma_alloc_chan_resources(struct dma_chan *chan)
struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
struct imx_dma_data *data = chan->private;

imxdmac->dma_request = data->dma_request;
if (data != NULL)
imxdmac->dma_request = data->dma_request;

dma_async_tx_descriptor_init(&imxdmac->desc, chan);
imxdmac->desc.tx_submit = imxdma_tx_submit;
Expand Down Expand Up @@ -327,6 +328,36 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_cyclic(
return &imxdmac->desc;
}

static struct dma_async_tx_descriptor *imxdma_prep_dma_memcpy(
struct dma_chan *chan, dma_addr_t dest,
dma_addr_t src, size_t len, unsigned long flags)
{
struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
struct imxdma_engine *imxdma = imxdmac->imxdma;
int ret;

dev_dbg(imxdma->dev, "%s channel: %d src=0x%x dst=0x%x len=%d\n",
__func__, imxdmac->channel, src, dest, len);

if (imxdmac->status == DMA_IN_PROGRESS)
return NULL;
imxdmac->status = DMA_IN_PROGRESS;

ret = imx_dma_config_channel(imxdmac->imxdma_channel,
IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR,
IMX_DMA_MEMSIZE_32 | IMX_DMA_TYPE_LINEAR,
0, 0);
if (ret)
return NULL;

ret = imx_dma_setup_single(imxdmac->imxdma_channel, src, len,
dest, DMA_MODE_WRITE);
if (ret)
return NULL;

return &imxdmac->desc;
}

static void imxdma_issue_pending(struct dma_chan *chan)
{
struct imxdma_channel *imxdmac = to_imxdma_chan(chan);
Expand All @@ -348,6 +379,7 @@ static int __init imxdma_probe(struct platform_device *pdev)

dma_cap_set(DMA_SLAVE, imxdma->dma_device.cap_mask);
dma_cap_set(DMA_CYCLIC, imxdma->dma_device.cap_mask);
dma_cap_set(DMA_MEMCPY, imxdma->dma_device.cap_mask);

/* Initialize channel parameters */
for (i = 0; i < MAX_DMA_CHANNELS; i++) {
Expand Down Expand Up @@ -381,11 +413,13 @@ static int __init imxdma_probe(struct platform_device *pdev)
imxdma->dma_device.device_tx_status = imxdma_tx_status;
imxdma->dma_device.device_prep_slave_sg = imxdma_prep_slave_sg;
imxdma->dma_device.device_prep_dma_cyclic = imxdma_prep_dma_cyclic;
imxdma->dma_device.device_prep_dma_memcpy = imxdma_prep_dma_memcpy;
imxdma->dma_device.device_control = imxdma_control;
imxdma->dma_device.device_issue_pending = imxdma_issue_pending;

platform_set_drvdata(pdev, imxdma);

imxdma->dma_device.copy_align = 2; /* 2^2 = 4 bytes alignment */
imxdma->dma_device.dev->dma_parms = &imxdma->dma_parms;
dma_set_max_seg_size(imxdma->dma_device.dev, 0xffffff);

Expand Down

0 comments on commit df6a2dd

Please sign in to comment.