提交 b7f7552b 编写于 作者: M Maxime Ripard 提交者: Vinod Koul

dmaengine: fsl-dma: Split device_control

Split the device_control callback of the Freescale Elo DMA driver to make use
of the newly introduced callbacks, that will eventually be used to retrieve
slave capabilities.

While we're at it, remove the useless prep_sg callback.
Signed-off-by: NMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: NVinod Koul <vinod.koul@intel.com>
上级 ac850cc7
...@@ -941,37 +941,8 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_sg(struct dma_chan *dchan, ...@@ -941,37 +941,8 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_sg(struct dma_chan *dchan,
return NULL; return NULL;
} }
/** static int fsl_dma_device_terminate_all(struct dma_chan *dchan)
* fsl_dma_prep_slave_sg - prepare descriptors for a DMA_SLAVE transaction
* @chan: DMA channel
* @sgl: scatterlist to transfer to/from
* @sg_len: number of entries in @scatterlist
* @direction: DMA direction
* @flags: DMAEngine flags
* @context: transaction context (ignored)
*
* Prepare a set of descriptors for a DMA_SLAVE transaction. Following the
* DMA_SLAVE API, this gets the device-specific information from the
* chan->private variable.
*/
static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg(
struct dma_chan *dchan, struct scatterlist *sgl, unsigned int sg_len,
enum dma_transfer_direction direction, unsigned long flags,
void *context)
{
/*
* This operation is not supported on the Freescale DMA controller
*
* However, we need to provide the function pointer to allow the
* device_control() method to work.
*/
return NULL;
}
static int fsl_dma_device_control(struct dma_chan *dchan,
enum dma_ctrl_cmd cmd, unsigned long arg)
{ {
struct dma_slave_config *config;
struct fsldma_chan *chan; struct fsldma_chan *chan;
int size; int size;
...@@ -980,45 +951,47 @@ static int fsl_dma_device_control(struct dma_chan *dchan, ...@@ -980,45 +951,47 @@ static int fsl_dma_device_control(struct dma_chan *dchan,
chan = to_fsl_chan(dchan); chan = to_fsl_chan(dchan);
switch (cmd) { spin_lock_bh(&chan->desc_lock);
case DMA_TERMINATE_ALL:
spin_lock_bh(&chan->desc_lock);
/* Halt the DMA engine */
dma_halt(chan);
/* Remove and free all of the descriptors in the LD queue */ /* Halt the DMA engine */
fsldma_free_desc_list(chan, &chan->ld_pending); dma_halt(chan);
fsldma_free_desc_list(chan, &chan->ld_running);
fsldma_free_desc_list(chan, &chan->ld_completed);
chan->idle = true;
spin_unlock_bh(&chan->desc_lock); /* Remove and free all of the descriptors in the LD queue */
return 0; fsldma_free_desc_list(chan, &chan->ld_pending);
fsldma_free_desc_list(chan, &chan->ld_running);
fsldma_free_desc_list(chan, &chan->ld_completed);
chan->idle = true;
case DMA_SLAVE_CONFIG: spin_unlock_bh(&chan->desc_lock);
config = (struct dma_slave_config *)arg; return 0;
}
/* make sure the channel supports setting burst size */ static int fsl_dma_device_config(struct dma_chan *dchan,
if (!chan->set_request_count) struct dma_slave_config *config)
return -ENXIO; {
struct fsldma_chan *chan;
int size;
/* we set the controller burst size depending on direction */ if (!dchan)
if (config->direction == DMA_MEM_TO_DEV) return -EINVAL;
size = config->dst_addr_width * config->dst_maxburst;
else
size = config->src_addr_width * config->src_maxburst;
chan->set_request_count(chan, size); chan = to_fsl_chan(dchan);
return 0;
default: /* make sure the channel supports setting burst size */
if (!chan->set_request_count)
return -ENXIO; return -ENXIO;
}
/* we set the controller burst size depending on direction */
if (config->direction == DMA_MEM_TO_DEV)
size = config->dst_addr_width * config->dst_maxburst;
else
size = config->src_addr_width * config->src_maxburst;
chan->set_request_count(chan, size);
return 0; return 0;
} }
/** /**
* fsl_dma_memcpy_issue_pending - Issue the DMA start command * fsl_dma_memcpy_issue_pending - Issue the DMA start command
* @chan : Freescale DMA channel * @chan : Freescale DMA channel
...@@ -1395,8 +1368,8 @@ static int fsldma_of_probe(struct platform_device *op) ...@@ -1395,8 +1368,8 @@ static int fsldma_of_probe(struct platform_device *op)
fdev->common.device_prep_dma_sg = fsl_dma_prep_sg; fdev->common.device_prep_dma_sg = fsl_dma_prep_sg;
fdev->common.device_tx_status = fsl_tx_status; fdev->common.device_tx_status = fsl_tx_status;
fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending; fdev->common.device_issue_pending = fsl_dma_memcpy_issue_pending;
fdev->common.device_prep_slave_sg = fsl_dma_prep_slave_sg; fdev->common.device_config = fsl_dma_device_config;
fdev->common.device_control = fsl_dma_device_control; fdev->common.device_terminate_all = fsl_dma_device_terminate_all;
fdev->common.dev = &op->dev; fdev->common.dev = &op->dev;
dma_set_mask(&(op->dev), DMA_BIT_MASK(36)); dma_set_mask(&(op->dev), DMA_BIT_MASK(36));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册