From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 14/53] dmaengine: dw: Split device_control
Date: Thu, 16 Oct 2014 14:17:28 +0300 [thread overview]
Message-ID: <1413458248.2396.15.camel@linux.intel.com> (raw)
In-Reply-To: <1413454672-27400-15-git-send-email-maxime.ripard@free-electrons.com>
On Thu, 2014-10-16 at 12:17 +0200, Maxime Ripard wrote:
> Split the device_control callback of the DesignWare DMA driver to make use
> of the newly introduced callbacks, that will eventually be used to retrieve
> slave capabilities.
I will look at the main patches in the series later, but now I would
like to comment this one.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> drivers/dma/dw/core.c | 92 +++++++++++++++++++++++++++------------------------
> 1 file changed, 49 insertions(+), 43 deletions(-)
>
> diff --git a/drivers/dma/dw/core.c b/drivers/dma/dw/core.c
> index 1af731b83b3f..a3d3a51387c6 100644
> --- a/drivers/dma/dw/core.c
> +++ b/drivers/dma/dw/core.c
> @@ -955,8 +955,7 @@ static inline void convert_burst(u32 *maxburst)
> *maxburst = 0;
> }
>
> -static int
> -set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
> +static int dwc_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
> {
> struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
>
> @@ -977,29 +976,54 @@ set_runtime_config(struct dma_chan *chan, struct dma_slave_config *sconfig)
> return 0;
> }
>
> -static inline void dwc_chan_pause(struct dw_dma_chan *dwc)
> +static inline void dwc_chan_resume(struct dw_dma_chan *dwc)
Could we keep the order of functions as previous?
> {
> u32 cfglo = channel_readl(dwc, CFG_LO);
> - unsigned int count = 20; /* timeout iterations */
>
> + channel_writel(dwc, CFG_LO, cfglo & ~DWC_CFGL_CH_SUSP);
> +
> + dwc->paused = false;
> +}
> +
> +static int dwc_pause(struct dma_chan *chan)
> +{
> + struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
> + unsigned long flags;
> + unsigned int count = 20; /* timeout iterations */
> + u32 cfglo;
> +
> + spin_lock_irqsave(&dwc->lock, flags);
> +
> + cfglo = channel_readl(dwc, CFG_LO);
> channel_writel(dwc, CFG_LO, cfglo | DWC_CFGL_CH_SUSP);
> while (!(channel_readl(dwc, CFG_LO) & DWC_CFGL_FIFO_EMPTY) && count--)
> udelay(2);
>
> dwc->paused = true;
> +
> + spin_unlock_irqrestore(&dwc->lock, flags);
> +
> + return 0;
> }
>
> -static inline void dwc_chan_resume(struct dw_dma_chan *dwc)
> +static int dwc_resume(struct dma_chan *chan)
> {
> - u32 cfglo = channel_readl(dwc, CFG_LO);
> + struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
> + unsigned long flags;
>
> - channel_writel(dwc, CFG_LO, cfglo & ~DWC_CFGL_CH_SUSP);
> + if (!dwc->paused)
> + return 0;
>
> - dwc->paused = false;
> + spin_lock_irqsave(&dwc->lock, flags);
> +
> + dwc_chan_resume(dwc);
> +
> + spin_unlock_irqrestore(&dwc->lock, flags);
> +
> + return 0;
> }
>
> -static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
> - unsigned long arg)
> +static int dwc_terminate_all(struct dma_chan *chan)
> {
> struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
> struct dw_dma *dw = to_dw_dma(chan->device);
> @@ -1007,44 +1031,23 @@ static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
> unsigned long flags;
> LIST_HEAD(list);
>
> - if (cmd == DMA_PAUSE) {
> - spin_lock_irqsave(&dwc->lock, flags);
> -
> - dwc_chan_pause(dwc);
> -
> - spin_unlock_irqrestore(&dwc->lock, flags);
> - } else if (cmd == DMA_RESUME) {
> - if (!dwc->paused)
> - return 0;
> -
> - spin_lock_irqsave(&dwc->lock, flags);
> -
> - dwc_chan_resume(dwc);
> -
> - spin_unlock_irqrestore(&dwc->lock, flags);
> - } else if (cmd == DMA_TERMINATE_ALL) {
> - spin_lock_irqsave(&dwc->lock, flags);
> + spin_lock_irqsave(&dwc->lock, flags);
>
> - clear_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags);
> + clear_bit(DW_DMA_IS_SOFT_LLP, &dwc->flags);
>
> - dwc_chan_disable(dw, dwc);
> + dwc_chan_disable(dw, dwc);
>
> - dwc_chan_resume(dwc);
> + dwc_chan_resume(dwc);
>
> - /* active_list entries will end up before queued entries */
> - list_splice_init(&dwc->queue, &list);
> - list_splice_init(&dwc->active_list, &list);
> + /* active_list entries will end up before queued entries */
> + list_splice_init(&dwc->queue, &list);
> + list_splice_init(&dwc->active_list, &list);
>
> - spin_unlock_irqrestore(&dwc->lock, flags);
> + spin_unlock_irqrestore(&dwc->lock, flags);
>
> - /* Flush all pending and queued descriptors */
> - list_for_each_entry_safe(desc, _desc, &list, desc_node)
> - dwc_descriptor_complete(dwc, desc, false);
> - } else if (cmd == DMA_SLAVE_CONFIG) {
> - return set_runtime_config(chan, (struct dma_slave_config *)arg);
> - } else {
> - return -ENXIO;
> - }
> + /* Flush all pending and queued descriptors */
> + list_for_each_entry_safe(desc, _desc, &list, desc_node)
> + dwc_descriptor_complete(dwc, desc, false);
>
> return 0;
> }
> @@ -1654,7 +1657,10 @@ int dw_dma_probe(struct dw_dma_chip *chip, struct dw_dma_platform_data *pdata)
> dw->dma.device_prep_dma_memcpy = dwc_prep_dma_memcpy;
>
> dw->dma.device_prep_slave_sg = dwc_prep_slave_sg;
> - dw->dma.device_control = dwc_control;
> + dw->dma.device_config = dwc_config;
> + dw->dma.device_pause = dwc_pause;
> + dw->dma.device_resume = dwc_resume;
> + dw->dma.device_terminate_all = dwc_terminate_all;
>
> dw->dma.device_tx_status = dwc_tx_status;
> dw->dma.device_issue_pending = dwc_issue_pending;
--
Andy Shevchenko <andriy.shevchenko@intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2014-10-16 11:17 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 10:16 [PATCH v2 00/53] dmaengine: Implement generic slave capabilities retrieval Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 01/53] dmaengine: Make the destination abbreviation coherent Maxime Ripard
2014-10-16 10:25 ` Mark Brown
2014-10-16 10:32 ` Laurent Pinchart
2014-10-16 15:26 ` Stephen Warren
2014-10-16 10:17 ` [PATCH v2 02/53] dmaengine: Make channel allocation callbacks optional Maxime Ripard
2014-10-16 10:35 ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 03/53] dmaengine: Introduce a device_config callback Maxime Ripard
2014-10-16 10:44 ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 04/53] dmaengine: split out pause/resume operations from device_control Maxime Ripard
2014-10-16 10:45 ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 05/53] dmaengine: Add device_terminate_all callback Maxime Ripard
2014-10-16 10:46 ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 06/53] dmaengine: Create a generic dma_slave_caps callback Maxime Ripard
2014-10-16 16:15 ` Laurent Pinchart
2014-10-16 16:24 ` Maxime Ripard
2014-10-22 20:16 ` Laurent Pinchart
2014-10-23 8:08 ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 07/53] dmaengine: Move slave caps to dma_device Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 08/53] dmaengine: pl08x: Split device_control Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 09/53] dmaengine: hdmac: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 10/53] dmaengine: bcm2835: " Maxime Ripard
2014-10-16 15:27 ` Stephen Warren
2014-10-16 10:17 ` [PATCH v2 11/53] dmaengine: coh901318: " Maxime Ripard
2014-10-28 14:40 ` Linus Walleij
2014-10-16 10:17 ` [PATCH v2 12/53] dmaengine: cppi41: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 13/53] dmaengine: jz4740: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 14/53] dmaengine: dw: " Maxime Ripard
2014-10-16 11:17 ` Andy Shevchenko [this message]
2014-10-16 14:05 ` Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 15/53] dmaengine: edma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 16/53] dmaengine: ep93xx: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 17/53] dmaengine: fsl-edma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 18/53] dmaengine: imx: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 19/53] dmaengine: imx-sdma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 20/53] dmaengine: intel-mid-dma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 21/53] dmaengine: ipu-idmac: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 22/53] dmaengine: k3: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 23/53] dmaengine: mmp-pdma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 24/53] dmaengine: mmp-tdma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 25/53] dmaengine: moxart: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 26/53] dmaengine: fsl-dma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 27/53] dmaengine: mpc512x: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 28/53] dmaengine: mxs: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 29/53] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 30/53] dmaengine: omap: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 31/53] dmaengine: pl330: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 32/53] dmaengine: bam-dma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 33/53] dmaengine: s3c24xx: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 34/53] dmaengine: sa11x0: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 35/53] dmaengine: sh: " Maxime Ripard
2014-10-16 16:17 ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 36/53] dmaengine: sirf: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 37/53] dmaengine: sun6i: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 38/53] dmaengine: d40: " Maxime Ripard
2014-10-28 14:41 ` Linus Walleij
2014-10-16 10:17 ` [PATCH v2 39/53] dmaengine: tegra20: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 40/53] dmaengine: xilinx: " Maxime Ripard
2014-10-16 16:20 ` Laurent Pinchart
2014-10-16 10:17 ` [PATCH v2 41/53] dmaengine: mv_xor: Remove device_control Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 42/53] dmaengine: pch-dma: Rename device_control Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 43/53] dmaengine: td: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 44/53] dmaengine: txx9: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 45/53] dmaengine: bcm2835: Declare slave capabilities for the generic code Maxime Ripard
2014-10-16 15:27 ` Stephen Warren
2014-10-16 10:17 ` [PATCH v2 46/53] dmaengine: fsl-edma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 47/53] dmaengine: edma: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 48/53] dmaengine: nbpfaxi: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 49/53] dmaengine: omap: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 50/53] dmaengine: pl330: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 51/53] dmaengine: sirf: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 52/53] dmaengine: sun6i: " Maxime Ripard
2014-10-16 10:17 ` [PATCH v2 53/53] dmaengine: Mark device_control and device_slave_caps as deprecated Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413458248.2396.15.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).