dmaengine: nbpfaxi: Split device_control
Split the device_control callback of the NBPF AXI DMA driver to make use of the newly introduced callbacks, that will eventually be used to retrieve slave capabilities. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
Родитель
5c9d2e37ac
Коммит
e22aec0f00
|
@ -565,13 +565,6 @@ static void nbpf_configure(struct nbpf_device *nbpf)
|
|||
nbpf_write(nbpf, NBPF_CTRL, NBPF_CTRL_LVINT);
|
||||
}
|
||||
|
||||
static void nbpf_pause(struct nbpf_channel *chan)
|
||||
{
|
||||
nbpf_chan_write(chan, NBPF_CHAN_CTRL, NBPF_CHAN_CTRL_SETSUS);
|
||||
/* See comment in nbpf_prep_one() */
|
||||
nbpf_chan_write(chan, NBPF_CHAN_CTRL, NBPF_CHAN_CTRL_CLREN);
|
||||
}
|
||||
|
||||
/* Generic part */
|
||||
|
||||
/* DMA ENGINE functions */
|
||||
|
@ -837,54 +830,58 @@ static void nbpf_chan_idle(struct nbpf_channel *chan)
|
|||
}
|
||||
}
|
||||
|
||||
static int nbpf_control(struct dma_chan *dchan, enum dma_ctrl_cmd cmd,
|
||||
unsigned long arg)
|
||||
static int nbpf_pause(struct dma_chan *dchan)
|
||||
{
|
||||
struct nbpf_channel *chan = nbpf_to_chan(dchan);
|
||||
struct dma_slave_config *config;
|
||||
|
||||
dev_dbg(dchan->device->dev, "Entry %s(%d)\n", __func__, cmd);
|
||||
dev_dbg(dchan->device->dev, "Entry %s\n", __func__);
|
||||
|
||||
switch (cmd) {
|
||||
case DMA_TERMINATE_ALL:
|
||||
dev_dbg(dchan->device->dev, "Terminating\n");
|
||||
nbpf_chan_halt(chan);
|
||||
nbpf_chan_idle(chan);
|
||||
break;
|
||||
chan->paused = true;
|
||||
nbpf_chan_write(chan, NBPF_CHAN_CTRL, NBPF_CHAN_CTRL_SETSUS);
|
||||
/* See comment in nbpf_prep_one() */
|
||||
nbpf_chan_write(chan, NBPF_CHAN_CTRL, NBPF_CHAN_CTRL_CLREN);
|
||||
|
||||
case DMA_SLAVE_CONFIG:
|
||||
if (!arg)
|
||||
return -EINVAL;
|
||||
config = (struct dma_slave_config *)arg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We could check config->slave_id to match chan->terminal here,
|
||||
* but with DT they would be coming from the same source, so
|
||||
* such a check would be superflous
|
||||
*/
|
||||
static int nbpf_terminate_all(struct dma_chan *dchan)
|
||||
{
|
||||
struct nbpf_channel *chan = nbpf_to_chan(dchan);
|
||||
|
||||
chan->slave_dst_addr = config->dst_addr;
|
||||
chan->slave_dst_width = nbpf_xfer_size(chan->nbpf,
|
||||
config->dst_addr_width, 1);
|
||||
chan->slave_dst_burst = nbpf_xfer_size(chan->nbpf,
|
||||
config->dst_addr_width,
|
||||
config->dst_maxburst);
|
||||
chan->slave_src_addr = config->src_addr;
|
||||
chan->slave_src_width = nbpf_xfer_size(chan->nbpf,
|
||||
config->src_addr_width, 1);
|
||||
chan->slave_src_burst = nbpf_xfer_size(chan->nbpf,
|
||||
config->src_addr_width,
|
||||
config->src_maxburst);
|
||||
break;
|
||||
dev_dbg(dchan->device->dev, "Entry %s\n", __func__);
|
||||
dev_dbg(dchan->device->dev, "Terminating\n");
|
||||
|
||||
case DMA_PAUSE:
|
||||
chan->paused = true;
|
||||
nbpf_pause(chan);
|
||||
break;
|
||||
nbpf_chan_halt(chan);
|
||||
nbpf_chan_idle(chan);
|
||||
|
||||
default:
|
||||
return -ENXIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nbpf_config(struct dma_chan *dchan,
|
||||
struct dma_slave_config *config)
|
||||
{
|
||||
struct nbpf_channel *chan = nbpf_to_chan(dchan);
|
||||
|
||||
dev_dbg(dchan->device->dev, "Entry %s\n", __func__);
|
||||
|
||||
/*
|
||||
* We could check config->slave_id to match chan->terminal here,
|
||||
* but with DT they would be coming from the same source, so
|
||||
* such a check would be superflous
|
||||
*/
|
||||
|
||||
chan->slave_dst_addr = config->dst_addr;
|
||||
chan->slave_dst_width = nbpf_xfer_size(chan->nbpf,
|
||||
config->dst_addr_width, 1);
|
||||
chan->slave_dst_burst = nbpf_xfer_size(chan->nbpf,
|
||||
config->dst_addr_width,
|
||||
config->dst_maxburst);
|
||||
chan->slave_src_addr = config->src_addr;
|
||||
chan->slave_src_width = nbpf_xfer_size(chan->nbpf,
|
||||
config->src_addr_width, 1);
|
||||
chan->slave_src_burst = nbpf_xfer_size(chan->nbpf,
|
||||
config->src_addr_width,
|
||||
config->src_maxburst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1426,7 +1423,9 @@ static int nbpf_probe(struct platform_device *pdev)
|
|||
|
||||
/* Compulsory for DMA_SLAVE fields */
|
||||
dma_dev->device_prep_slave_sg = nbpf_prep_slave_sg;
|
||||
dma_dev->device_control = nbpf_control;
|
||||
dma_dev->device_config = nbpf_config;
|
||||
dma_dev->device_pause = nbpf_pause;
|
||||
dma_dev->device_terminate_all = nbpf_terminate_all;
|
||||
|
||||
platform_set_drvdata(pdev, nbpf);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче