aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/dma-jz4780.c
diff options
context:
space:
mode:
authorAlex Smith <alex.smith@imgtec.com>2015-07-24 12:24:24 -0400
committerVinod Koul <vinod.koul@intel.com>2015-08-18 12:58:49 -0400
commit026fd406c81b8a2936e77342a255d55534f92061 (patch)
tree282f1be23ebb4347e009f0044b5d93ab754703ed /drivers/dma/dma-jz4780.c
parentd3273e10ad871e903456a875e1062514cd13a244 (diff)
dmaengine: jz4780: Ensure channel is on correct controller in filter
When scanning for a free DMA channel, the filter function should ensure that the channel is on the controller that it was requested to be on in the DT. Signed-off-by: Alex Smith <alex.smith@imgtec.com> Cc: Vinod Koul <vinod.koul@intel.com> Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> Cc: dmaengine@vger.kernel.org Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/dma-jz4780.c')
-rw-r--r--drivers/dma/dma-jz4780.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index 40baaf00b971..572e07e4b42d 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -145,7 +145,8 @@ struct jz4780_dma_dev {
145 struct jz4780_dma_chan chan[JZ_DMA_NR_CHANNELS]; 145 struct jz4780_dma_chan chan[JZ_DMA_NR_CHANNELS];
146}; 146};
147 147
148struct jz4780_dma_data { 148struct jz4780_dma_filter_data {
149 struct device_node *of_node;
149 uint32_t transfer_type; 150 uint32_t transfer_type;
150 int channel; 151 int channel;
151}; 152};
@@ -684,7 +685,10 @@ static bool jz4780_dma_filter_fn(struct dma_chan *chan, void *param)
684{ 685{
685 struct jz4780_dma_chan *jzchan = to_jz4780_dma_chan(chan); 686 struct jz4780_dma_chan *jzchan = to_jz4780_dma_chan(chan);
686 struct jz4780_dma_dev *jzdma = jz4780_dma_chan_parent(jzchan); 687 struct jz4780_dma_dev *jzdma = jz4780_dma_chan_parent(jzchan);
687 struct jz4780_dma_data *data = param; 688 struct jz4780_dma_filter_data *data = param;
689
690 if (jzdma->dma_device.dev->of_node != data->of_node)
691 return false;
688 692
689 if (data->channel > -1) { 693 if (data->channel > -1) {
690 if (data->channel != jzchan->id) 694 if (data->channel != jzchan->id)
@@ -703,11 +707,12 @@ static struct dma_chan *jz4780_of_dma_xlate(struct of_phandle_args *dma_spec,
703{ 707{
704 struct jz4780_dma_dev *jzdma = ofdma->of_dma_data; 708 struct jz4780_dma_dev *jzdma = ofdma->of_dma_data;
705 dma_cap_mask_t mask = jzdma->dma_device.cap_mask; 709 dma_cap_mask_t mask = jzdma->dma_device.cap_mask;
706 struct jz4780_dma_data data; 710 struct jz4780_dma_filter_data data;
707 711
708 if (dma_spec->args_count != 2) 712 if (dma_spec->args_count != 2)
709 return NULL; 713 return NULL;
710 714
715 data.of_node = ofdma->of_node;
711 data.transfer_type = dma_spec->args[0]; 716 data.transfer_type = dma_spec->args[0];
712 data.channel = dma_spec->args[1]; 717 data.channel = dma_spec->args[1];
713 718