Commit 95335f1f authored by Maxime Ripard's avatar Maxime Ripard Committed by Vinod Koul

dmaengine: mpc512x: Split device_control

Split the device_control callback of the Freescale MPC512x DMA driver to make
use of the newly introduced callbacks, that will eventually be used to retrieve
slave capabilities.
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent b7f7552b
...@@ -800,32 +800,12 @@ mpc_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, ...@@ -800,32 +800,12 @@ mpc_dma_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
return NULL; return NULL;
} }
static int mpc_dma_device_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, static int mpc_dma_device_config(struct dma_chan *chan,
unsigned long arg) struct dma_slave_config *cfg)
{ {
struct mpc_dma_chan *mchan; struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan);
struct mpc_dma *mdma;
struct dma_slave_config *cfg;
unsigned long flags; unsigned long flags;
mchan = dma_chan_to_mpc_dma_chan(chan);
switch (cmd) {
case DMA_TERMINATE_ALL:
/* Disable channel requests */
mdma = dma_chan_to_mpc_dma(chan);
spin_lock_irqsave(&mchan->lock, flags);
out_8(&mdma->regs->dmacerq, chan->chan_id);
list_splice_tail_init(&mchan->prepared, &mchan->free);
list_splice_tail_init(&mchan->queued, &mchan->free);
list_splice_tail_init(&mchan->active, &mchan->free);
spin_unlock_irqrestore(&mchan->lock, flags);
return 0;
case DMA_SLAVE_CONFIG:
/* /*
* Software constraints: * Software constraints:
* - only transfers between a peripheral device and * - only transfers between a peripheral device and
...@@ -841,8 +821,6 @@ static int mpc_dma_device_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, ...@@ -841,8 +821,6 @@ static int mpc_dma_device_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
* - peripheral port's address is constant during the transfer. * - peripheral port's address is constant during the transfer.
*/ */
cfg = (void *)arg;
if (cfg->src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES || if (cfg->src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES ||
cfg->dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES || cfg->dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES ||
!IS_ALIGNED(cfg->src_addr, 4) || !IS_ALIGNED(cfg->src_addr, 4) ||
...@@ -866,13 +844,25 @@ static int mpc_dma_device_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, ...@@ -866,13 +844,25 @@ static int mpc_dma_device_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
spin_unlock_irqrestore(&mchan->lock, flags); spin_unlock_irqrestore(&mchan->lock, flags);
return 0; return 0;
}
default: static int mpc_dma_device_terminate_all(struct dma_chan *chan)
/* Unknown command */ {
break; struct mpc_dma_chan *mchan = dma_chan_to_mpc_dma_chan(chan);
} struct mpc_dma *mdma = dma_chan_to_mpc_dma(chan);
unsigned long flags;
/* Disable channel requests */
spin_lock_irqsave(&mchan->lock, flags);
return -ENXIO; out_8(&mdma->regs->dmacerq, chan->chan_id);
list_splice_tail_init(&mchan->prepared, &mchan->free);
list_splice_tail_init(&mchan->queued, &mchan->free);
list_splice_tail_init(&mchan->active, &mchan->free);
spin_unlock_irqrestore(&mchan->lock, flags);
return 0;
} }
static int mpc_dma_probe(struct platform_device *op) static int mpc_dma_probe(struct platform_device *op)
...@@ -963,7 +953,8 @@ static int mpc_dma_probe(struct platform_device *op) ...@@ -963,7 +953,8 @@ static int mpc_dma_probe(struct platform_device *op)
dma->device_tx_status = mpc_dma_tx_status; dma->device_tx_status = mpc_dma_tx_status;
dma->device_prep_dma_memcpy = mpc_dma_prep_memcpy; dma->device_prep_dma_memcpy = mpc_dma_prep_memcpy;
dma->device_prep_slave_sg = mpc_dma_prep_slave_sg; dma->device_prep_slave_sg = mpc_dma_prep_slave_sg;
dma->device_control = mpc_dma_device_control; dma->device_config = mpc_dma_device_config;
dma->device_terminate_all = mpc_dma_device_terminate_all;
INIT_LIST_HEAD(&dma->channels); INIT_LIST_HEAD(&dma->channels);
dma_cap_set(DMA_MEMCPY, dma->cap_mask); dma_cap_set(DMA_MEMCPY, dma->cap_mask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment