Subject: linux-next: manual merge of the slave-dma tree with the arm tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 9 Dec 2014 14:09:01 +1100

Hi Vinod,

Today's linux-next merge of the slave-dma tree got a conflict in
drivers/dma/pl330.c between commits ae43b3289186 ("ARM: 8202/1:
dmaengine: pl330: Add runtime Power Management support v12") and
b816ccc5c01f ("ARM: 8206/1: dmaengine: pl330: Add PM sleep support")
from the arm tree and commits 86e15941d3f5 ("dmaengine: pl330: Split
device_control") and c9a09dacf851 ("dmaengine: pl330: Declare slave
capabilities for the generic code") from the slave-dma tree.

I fixed it up (hopefully - see below) and can carry the fix as
necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    [email-masked]

diff --cc drivers/dma/pl330.c
index ca1566045ca4,b84222270c11..000000000000
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@@ -2092,71 -2092,38 +2116,44 @@@ static int pl330_terminate_all(struct d
  	struct dma_pl330_desc *desc;
  	unsigned long flags;
  	struct pl330_dmac *pl330 = pch->dmac;
- 	struct dma_slave_config *slave_config;
  	LIST_HEAD(list);
  
- 	switch (cmd) {
- 	case DMA_TERMINATE_ALL:
- 		pm_runtime_get_sync(pl330->ddma.dev);
- 		spin_lock_irqsave(&pch->lock, flags);
++	pm_runtime_get_sync(pl330->ddma.dev);
+ 	spin_lock_irqsave(&pch->lock, flags);
  
- 		spin_lock(&pl330->lock);
- 		_stop(pch->thread);
- 		spin_unlock(&pl330->lock);
+ 	spin_lock(&pl330->lock);
+ 	_stop(pch->thread);
+ 	spin_unlock(&pl330->lock);
  
- 		pch->thread->req[0].desc = NULL;
- 		pch->thread->req[1].desc = NULL;
- 		pch->thread->req_running = -1;
+ 	pch->thread->req[0].desc = NULL;
+ 	pch->thread->req[1].desc = NULL;
+ 	pch->thread->req_running = -1;
  
- 		/* Mark all desc done */
- 		list_for_each_entry(desc, &pch->submitted_list, node) {
- 			desc->status = FREE;
- 			dma_cookie_complete(&desc->txd);
- 		}
+ 	/* Mark all desc done */
+ 	list_for_each_entry(desc, &pch->submitted_list, node) {
+ 		desc->status = FREE;
+ 		dma_cookie_complete(&desc->txd);
+ 	}
  
- 		list_for_each_entry(desc, &pch->work_list , node) {
- 			desc->status = FREE;
- 			dma_cookie_complete(&desc->txd);
- 		}
+ 	list_for_each_entry(desc, &pch->work_list , node) {
+ 		desc->status = FREE;
+ 		dma_cookie_complete(&desc->txd);
+ 	}
  
- 		list_for_each_entry(desc, &pch->completed_list , node) {
- 			desc->status = FREE;
- 			dma_cookie_complete(&desc->txd);
- 		}
+ 	list_for_each_entry(desc, &pch->completed_list , node) {
+ 		desc->status = FREE;
+ 		dma_cookie_complete(&desc->txd);
+ 	}
  
- 		if (!list_empty(&pch->work_list))
- 			pm_runtime_put(pl330->ddma.dev);
++	if (!list_empty(&pch->work_list))
++		pm_runtime_put(pl330->ddma.dev);
 +
- 		list_splice_tail_init(&pch->submitted_list, &pl330->desc_pool);
- 		list_splice_tail_init(&pch->work_list, &pl330->desc_pool);
- 		list_splice_tail_init(&pch->completed_list, &pl330->desc_pool);
- 		spin_unlock_irqrestore(&pch->lock, flags);
- 		pm_runtime_mark_last_busy(pl330->ddma.dev);
- 		pm_runtime_put_autosuspend(pl330->ddma.dev);
- 		break;
- 	case DMA_SLAVE_CONFIG:
- 		slave_config = (struct dma_slave_config *)arg;
- 
- 		if (slave_config->direction == DMA_MEM_TO_DEV) {
- 			if (slave_config->dst_addr)
- 				pch->fifo_addr = slave_config->dst_addr;
- 			if (slave_config->dst_addr_width)
- 				pch->burst_sz = __ffs(slave_config->dst_addr_width);
- 			if (slave_config->dst_maxburst)
- 				pch->burst_len = slave_config->dst_maxburst;
- 		} else if (slave_config->direction == DMA_DEV_TO_MEM) {
- 			if (slave_config->src_addr)
- 				pch->fifo_addr = slave_config->src_addr;
- 			if (slave_config->src_addr_width)
- 				pch->burst_sz = __ffs(slave_config->src_addr_width);
- 			if (slave_config->src_maxburst)
- 				pch->burst_len = slave_config->src_maxburst;
- 		}
- 		break;
- 	default:
- 		dev_err(pch->dmac->ddma.dev, "Not supported command.\n");
- 		return -ENXIO;
- 	}
+ 	list_splice_tail_init(&pch->submitted_list, &pl330->desc_pool);
+ 	list_splice_tail_init(&pch->work_list, &pl330->desc_pool);
+ 	list_splice_tail_init(&pch->completed_list, &pl330->desc_pool);
+ 	spin_unlock_irqrestore(&pch->lock, flags);
++	pm_runtime_mark_last_busy(pl330->ddma.dev);
++	pm_runtime_put_autosuspend(pl330->ddma.dev);1
  
  	return 0;
  }
@@@ -2623,59 -2578,6 +2620,46 @@@ static irqreturn_t pl330_irq_handler(in
  	BIT(DMA_SLAVE_BUSWIDTH_4_BYTES) | \
  	BIT(DMA_SLAVE_BUSWIDTH_8_BYTES)
  
- static int pl330_dma_device_slave_caps(struct dma_chan *dchan,
- 	struct dma_slave_caps *caps)
- {
- 	caps->src_addr_widths = PL330_DMA_BUSWIDTHS;
- 	caps->dstn_addr_widths = PL330_DMA_BUSWIDTHS;
- 	caps->directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
- 	caps->cmd_pause = false;
- 	caps->cmd_terminate = true;
- 	caps->residue_granularity = DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
- 
- 	return 0;
- }
- 
 +/*
 + * Runtime PM callbacks are provided by amba/bus.c driver.
 + *
 + * It is assumed here that IRQ safe runtime PM is chosen in probe and amba
 + * bus driver will only disable/enable the clock in runtime PM callbacks.
 + */
 +static int __maybe_unused pl330_suspend(struct device *dev)
 +{
 +	struct amba_device *pcdev = to_amba_device(dev);
 +
 +	pm_runtime_disable(dev);
 +
 +	if (!pm_runtime_status_suspended(dev)) {
 +		/* amba did not disable the clock */
 +		amba_pclk_disable(pcdev);
 +	}
 +	amba_pclk_unprepare(pcdev);
 +
 +	return 0;
 +}
 +
 +static int __maybe_unused pl330_resume(struct device *dev)
 +{
 +	struct amba_device *pcdev = to_amba_device(dev);
 +	int ret;
 +
 +	ret = amba_pclk_prepare(pcdev);
 +	if (ret)
 +		return ret;
 +
 +	if (!pm_runtime_status_suspended(dev))
 +		ret = amba_pclk_enable(pcdev);
 +
 +	pm_runtime_enable(dev);
 +
 +	return ret;
 +}
 +
 +static SIMPLE_DEV_PM_OPS(pl330_pm, pl330_suspend, pl330_resume);
 +
  static int
  pl330_probe(struct amba_device *adev, const struct amba_id *id)
  {