This patch series does the below
--> Fixes sparse warnings in the driver.
--> Fixes race conditions in the driver for cdma.
--> Fixes issues with the dma_get_slave_caps() API failures.
This patch series got created on top of below commit
in the slave-dma.git topic/xilinx branch.
"dmaengine: xilinx_dma: Fix typos"
Kedareswara rao Appana (4):
dmaengine: xilinx_dma: Fix dma_get_slave_caps() API failures
dmaengine: xilinx_dma: Fix race condition in the driver for cdma
dmaengine: xilinx_dma: Fix compilation warning
dmaengine: xilinx_dma: Free BD consistent memory
drivers/dma/xilinx/xilinx_dma.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
--
2.7.4
When client driver uses dma_get_slave_caps() api,
it checks for certain fields of dma_device struct
currently driver is not settings few fields resulting
dma_get_slave_caps() returning failure.
This patch fixes this issue by populating proper values
to the struct dma_device fields.
Signed-off-by: Kedareswara rao Appana <[email protected]>
---
drivers/dma/xilinx/xilinx_dma.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 88d317d..21ac954 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -2398,6 +2398,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
chan->direction = DMA_MEM_TO_DEV;
chan->id = chan_id;
chan->tdest = chan_id;
+ xdev->common.directions = BIT(DMA_MEM_TO_DEV);
chan->ctrl_offset = XILINX_DMA_MM2S_CTRL_OFFSET;
if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
@@ -2415,6 +2416,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
chan->direction = DMA_DEV_TO_MEM;
chan->id = chan_id;
chan->tdest = chan_id - xdev->nr_channels;
+ xdev->common.directions |= BIT(DMA_DEV_TO_MEM);
chan->ctrl_offset = XILINX_DMA_S2MM_CTRL_OFFSET;
if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
@@ -2629,6 +2631,8 @@ static int xilinx_dma_probe(struct platform_device *pdev)
dma_cap_set(DMA_PRIVATE, xdev->common.cap_mask);
}
+ xdev->common.dst_addr_widths = BIT(addr_width / 8);
+ xdev->common.src_addr_widths = BIT(addr_width / 8);
xdev->common.device_alloc_chan_resources =
xilinx_dma_alloc_chan_resources;
xdev->common.device_free_chan_resources =
--
2.7.4
This patch fixes the below sparse warning in the driver
drivers/dma/xilinx/xilinx_dma.c: In function ‘xilinx_vdma_dma_prep_interleaved’:
drivers/dma/xilinx/xilinx_dma.c:1614:43: warning: variable ‘prev’ set but not used [-Wunused-but-set-variable]
struct xilinx_vdma_tx_segment *segment, *prev = NULL;
Signed-off-by: Kedareswara rao Appana <[email protected]>
---
drivers/dma/xilinx/xilinx_dma.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 8467671..845e638 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -1611,7 +1611,7 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan,
{
struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
struct xilinx_dma_tx_descriptor *desc;
- struct xilinx_vdma_tx_segment *segment, *prev = NULL;
+ struct xilinx_vdma_tx_segment *segment;
struct xilinx_vdma_desc_hw *hw;
if (!is_slave_direction(xt->dir))
@@ -1665,8 +1665,6 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan,
/* Insert the segment into the descriptor segments list. */
list_add_tail(&segment->node, &desc->segments);
- prev = segment;
-
/* Link the last hardware descriptor with the first. */
segment = list_first_entry(&desc->segments,
struct xilinx_vdma_tx_segment, node);
--
2.7.4
when hardware is idle we need to toggle the SG bit
in the control register, inorder to update new value to the
current descriptor register other wise undefined
results will occur.
This patch updates the same.
Signed-off-by: Kedareswara rao Appana <[email protected]>
---
drivers/dma/xilinx/xilinx_dma.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 21ac954..8467671 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -1204,6 +1204,12 @@ static void xilinx_cdma_start_transfer(struct xilinx_dma_chan *chan)
}
if (chan->has_sg) {
+ dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR,
+ XILINX_CDMA_CR_SGMODE);
+
+ dma_ctrl_set(chan, XILINX_DMA_REG_DMACR,
+ XILINX_CDMA_CR_SGMODE);
+
xilinx_write(chan, XILINX_DMA_REG_CURDESC,
head_desc->async_tx.phys);
@@ -2052,6 +2058,10 @@ static int xilinx_dma_terminate_all(struct dma_chan *dchan)
chan->cyclic = false;
}
+ if ((chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) && chan->has_sg)
+ dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR,
+ XILINX_CDMA_CR_SGMODE);
+
return 0;
}
--
2.7.4
Free BD consistent memory while freeing the channel
i.e in free_chan_resources.
Signed-off-by: Radhey Shyam Pandey <[email protected]>
Signed-off-by: Kedareswara rao Appana <[email protected]>
---
drivers/dma/xilinx/xilinx_dma.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
index 845e638..a9edbd8 100644
--- a/drivers/dma/xilinx/xilinx_dma.c
+++ b/drivers/dma/xilinx/xilinx_dma.c
@@ -764,6 +764,11 @@ static void xilinx_dma_free_chan_resources(struct dma_chan *dchan)
INIT_LIST_HEAD(&chan->free_seg_list);
spin_unlock_irqrestore(&chan->lock, flags);
+ /* Free memory that is allocated for BD */
+ dma_free_coherent(chan->dev, sizeof(*chan->seg_v) *
+ XILINX_DMA_NUM_DESCS, chan->seg_v,
+ chan->seg_p);
+
/* Free Memory that is allocated for cyclic DMA Mode */
dma_free_coherent(chan->dev, sizeof(*chan->cyclic_seg_v),
chan->cyclic_seg_v, chan->cyclic_seg_p);
--
2.7.4
On Thu, Dec 21, 2017 at 03:41:35PM +0530, Kedareswara rao Appana wrote:
Patch title should say what is does, not the cause/effect
An apt title might be "populate dma caps properly"
> When client driver uses dma_get_slave_caps() api,
> it checks for certain fields of dma_device struct
> currently driver is not settings few fields resulting
> dma_get_slave_caps() returning failure.
It would help to mention the fields you are setting here
>
> This patch fixes this issue by populating proper values
> to the struct dma_device fields.
>
> Signed-off-by: Kedareswara rao Appana <[email protected]>
> ---
> drivers/dma/xilinx/xilinx_dma.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index 88d317d..21ac954 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -2398,6 +2398,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
> chan->direction = DMA_MEM_TO_DEV;
> chan->id = chan_id;
> chan->tdest = chan_id;
> + xdev->common.directions = BIT(DMA_MEM_TO_DEV);
>
> chan->ctrl_offset = XILINX_DMA_MM2S_CTRL_OFFSET;
> if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
> @@ -2415,6 +2416,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
> chan->direction = DMA_DEV_TO_MEM;
> chan->id = chan_id;
> chan->tdest = chan_id - xdev->nr_channels;
> + xdev->common.directions |= BIT(DMA_DEV_TO_MEM);
>
> chan->ctrl_offset = XILINX_DMA_S2MM_CTRL_OFFSET;
> if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
> @@ -2629,6 +2631,8 @@ static int xilinx_dma_probe(struct platform_device *pdev)
> dma_cap_set(DMA_PRIVATE, xdev->common.cap_mask);
> }
>
> + xdev->common.dst_addr_widths = BIT(addr_width / 8);
> + xdev->common.src_addr_widths = BIT(addr_width / 8);
> xdev->common.device_alloc_chan_resources =
> xilinx_dma_alloc_chan_resources;
> xdev->common.device_free_chan_resources =
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe dmaengine" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
~Vinod
On Thu, Dec 21, 2017 at 03:41:36PM +0530, Kedareswara rao Appana wrote:
same issue for patch title here too
> when hardware is idle we need to toggle the SG bit
> in the control register, inorder to update new value to the
> current descriptor register other wise undefined
> results will occur.
can you try making it bit more clear..
>
> This patch updates the same.
>
> Signed-off-by: Kedareswara rao Appana <[email protected]>
> ---
> drivers/dma/xilinx/xilinx_dma.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index 21ac954..8467671 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -1204,6 +1204,12 @@ static void xilinx_cdma_start_transfer(struct xilinx_dma_chan *chan)
> }
>
> if (chan->has_sg) {
> + dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR,
> + XILINX_CDMA_CR_SGMODE);
> +
> + dma_ctrl_set(chan, XILINX_DMA_REG_DMACR,
> + XILINX_CDMA_CR_SGMODE);
> +
> xilinx_write(chan, XILINX_DMA_REG_CURDESC,
> head_desc->async_tx.phys);
>
> @@ -2052,6 +2058,10 @@ static int xilinx_dma_terminate_all(struct dma_chan *dchan)
> chan->cyclic = false;
> }
>
> + if ((chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) && chan->has_sg)
> + dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR,
> + XILINX_CDMA_CR_SGMODE);
> +
> return 0;
> }
>
> --
> 2.7.4
>
--
~Vinod
On Thu, Dec 21, 2017 at 03:41:37PM +0530, Kedareswara rao Appana wrote:
Fix title here too
BTW whats with LINUX tag in patches, pls drop them
> This patch fixes the below sparse warning in the driver
> drivers/dma/xilinx/xilinx_dma.c: In function ‘xilinx_vdma_dma_prep_interleaved’:
> drivers/dma/xilinx/xilinx_dma.c:1614:43: warning: variable ‘prev’ set but not used [-Wunused-but-set-variable]
> struct xilinx_vdma_tx_segment *segment, *prev = NULL;
>
> Signed-off-by: Kedareswara rao Appana <[email protected]>
> ---
> drivers/dma/xilinx/xilinx_dma.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index 8467671..845e638 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -1611,7 +1611,7 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan,
> {
> struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
> struct xilinx_dma_tx_descriptor *desc;
> - struct xilinx_vdma_tx_segment *segment, *prev = NULL;
> + struct xilinx_vdma_tx_segment *segment;
> struct xilinx_vdma_desc_hw *hw;
>
> if (!is_slave_direction(xt->dir))
> @@ -1665,8 +1665,6 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan,
> /* Insert the segment into the descriptor segments list. */
> list_add_tail(&segment->node, &desc->segments);
>
> - prev = segment;
> -
> /* Link the last hardware descriptor with the first. */
> segment = list_first_entry(&desc->segments,
> struct xilinx_vdma_tx_segment, node);
> --
> 2.7.4
>
--
~Vinod
Hi Vinod,
Thanks for the review...
>
>On Thu, Dec 21, 2017 at 03:41:35PM +0530, Kedareswara rao Appana wrote:
>
>Patch title should say what is does, not the cause/effect
Sure will fix in v2...
>
>An apt title might be "populate dma caps properly"
>
>> When client driver uses dma_get_slave_caps() api, it checks for
>> certain fields of dma_device struct currently driver is not settings
>> few fields resulting
>> dma_get_slave_caps() returning failure.
>
>It would help to mention the fields you are setting here
Sure will fix in v2...
Regards,
Kedar.
>
>>
>> This patch fixes this issue by populating proper values to the struct
>> dma_device fields.
>>
>> Signed-off-by: Kedareswara rao Appana <[email protected]>
>> ---
>> drivers/dma/xilinx/xilinx_dma.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/dma/xilinx/xilinx_dma.c
>> b/drivers/dma/xilinx/xilinx_dma.c index 88d317d..21ac954 100644
>> --- a/drivers/dma/xilinx/xilinx_dma.c
>> +++ b/drivers/dma/xilinx/xilinx_dma.c
>> @@ -2398,6 +2398,7 @@ static int xilinx_dma_chan_probe(struct
>xilinx_dma_device *xdev,
>> chan->direction = DMA_MEM_TO_DEV;
>> chan->id = chan_id;
>> chan->tdest = chan_id;
>> + xdev->common.directions = BIT(DMA_MEM_TO_DEV);
>>
>> chan->ctrl_offset = XILINX_DMA_MM2S_CTRL_OFFSET;
>> if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { @@ -
>2415,6
>> +2416,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
>> chan->direction = DMA_DEV_TO_MEM;
>> chan->id = chan_id;
>> chan->tdest = chan_id - xdev->nr_channels;
>> + xdev->common.directions |= BIT(DMA_DEV_TO_MEM);
>>
>> chan->ctrl_offset = XILINX_DMA_S2MM_CTRL_OFFSET;
>> if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) { @@ -
>2629,6
>> +2631,8 @@ static int xilinx_dma_probe(struct platform_device *pdev)
>> dma_cap_set(DMA_PRIVATE, xdev->common.cap_mask);
>> }
>>
>> + xdev->common.dst_addr_widths = BIT(addr_width / 8);
>> + xdev->common.src_addr_widths = BIT(addr_width / 8);
>> xdev->common.device_alloc_chan_resources =
>> xilinx_dma_alloc_chan_resources;
>> xdev->common.device_free_chan_resources =
>> --
>> 2.7.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe dmaengine"
>> in the body of a message to [email protected] More majordomo
>> info at http://vger.kernel.org/majordomo-info.html
>
>--
>~Vinod
Hi Vinod,
Thanks for the review...
>
>On Thu, Dec 21, 2017 at 03:41:36PM +0530, Kedareswara rao Appana wrote:
>
>same issue for patch title here too
Ok will fix in v2...
>
>> when hardware is idle we need to toggle the SG bit in the control
>> register, inorder to update new value to the current descriptor
>> register other wise undefined results will occur.
>
>can you try making it bit more clear..
Sure will fix in v2...
Regards,
Kedar.
>
>>
>> This patch updates the same.
>>
>> Signed-off-by: Kedareswara rao Appana <[email protected]>
>> ---
>> drivers/dma/xilinx/xilinx_dma.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/dma/xilinx/xilinx_dma.c
>> b/drivers/dma/xilinx/xilinx_dma.c index 21ac954..8467671 100644
>> --- a/drivers/dma/xilinx/xilinx_dma.c
>> +++ b/drivers/dma/xilinx/xilinx_dma.c
>> @@ -1204,6 +1204,12 @@ static void xilinx_cdma_start_transfer(struct
>xilinx_dma_chan *chan)
>> }
>>
>> if (chan->has_sg) {
>> + dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR,
>> + XILINX_CDMA_CR_SGMODE);
>> +
>> + dma_ctrl_set(chan, XILINX_DMA_REG_DMACR,
>> + XILINX_CDMA_CR_SGMODE);
>> +
>> xilinx_write(chan, XILINX_DMA_REG_CURDESC,
>> head_desc->async_tx.phys);
>>
>> @@ -2052,6 +2058,10 @@ static int xilinx_dma_terminate_all(struct dma_chan
>*dchan)
>> chan->cyclic = false;
>> }
>>
>> + if ((chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) &&
>chan->has_sg)
>> + dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR,
>> + XILINX_CDMA_CR_SGMODE);
>> +
>> return 0;
>> }
>>
>> --
>> 2.7.4
>>
>
>--
>~Vinod
Hi Vinod,
Thanks for the review...
>
>On Thu, Dec 21, 2017 at 03:41:37PM +0530, Kedareswara rao Appana wrote:
>
>Fix title here too
Sure will fix in v2...
>
>BTW whats with LINUX tag in patches, pls drop them
Ok will mention the Linux tag info in the cover letter patch from the next patch series on wards...
Regards,
Kedar.
>
>> This patch fixes the below sparse warning in the driver
>> drivers/dma/xilinx/xilinx_dma.c: In function
>‘xilinx_vdma_dma_prep_interleaved’:
>> drivers/dma/xilinx/xilinx_dma.c:1614:43: warning: variable ‘prev’ set but not
>used [-Wunused-but-set-variable]
>> struct xilinx_vdma_tx_segment *segment, *prev = NULL;
>>
>> Signed-off-by: Kedareswara rao Appana <[email protected]>
>> ---
>> drivers/dma/xilinx/xilinx_dma.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/dma/xilinx/xilinx_dma.c
>> b/drivers/dma/xilinx/xilinx_dma.c index 8467671..845e638 100644
>> --- a/drivers/dma/xilinx/xilinx_dma.c
>> +++ b/drivers/dma/xilinx/xilinx_dma.c
>> @@ -1611,7 +1611,7 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan
>> *dchan, {
>> struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
>> struct xilinx_dma_tx_descriptor *desc;
>> - struct xilinx_vdma_tx_segment *segment, *prev = NULL;
>> + struct xilinx_vdma_tx_segment *segment;
>> struct xilinx_vdma_desc_hw *hw;
>>
>> if (!is_slave_direction(xt->dir))
>> @@ -1665,8 +1665,6 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan
>*dchan,
>> /* Insert the segment into the descriptor segments list. */
>> list_add_tail(&segment->node, &desc->segments);
>>
>> - prev = segment;
>> -
>> /* Link the last hardware descriptor with the first. */
>> segment = list_first_entry(&desc->segments,
>> struct xilinx_vdma_tx_segment, node);
>> --
>> 2.7.4
>>
>
>--
>~Vinod
On Wed, Jan 03, 2018 at 05:13:29AM +0000, Appana Durga Kedareswara Rao wrote:
> Hi Vinod,
>
> Thanks for the review...
>
> >
> >On Thu, Dec 21, 2017 at 03:41:37PM +0530, Kedareswara rao Appana wrote:
> >
> >Fix title here too
>
> Sure will fix in v2...
>
> >
> >BTW whats with LINUX tag in patches, pls drop them
>
> Ok will mention the Linux tag info in the cover letter patch from the next
> patch series on wards...
Please wrap your replies within 80chars. It is very hard to read! I have
reflown for readability
Can you explain what you mean by that info, what are you trying to convey?
--
~Vinod
Hi Vinod,
>On Wed, Jan 03, 2018 at 05:13:29AM +0000, Appana Durga Kedareswara Rao
>wrote:
>> Hi Vinod,
>>
>> Thanks for the review...
>>
>> >
>> >On Thu, Dec 21, 2017 at 03:41:37PM +0530, Kedareswara rao Appana wrote:
>> >
>> >Fix title here too
>>
>> Sure will fix in v2...
>>
>> >
>> >BTW whats with LINUX tag in patches, pls drop them
>>
>> Ok will mention the Linux tag info in the cover letter patch from the
>> next patch series on wards...
>
>Please wrap your replies within 80chars. It is very hard to read! I have reflown for
>readability
Sure will take care of it next time onwards...
>
>Can you explain what you mean by that info, what are you trying to convey?
What I mean here is will mention the Linux kernel tag
Information in the cover letter patch...
Regards,
Kedar.
>
>--
>~Vinod
Hi,
<Snip>
>>> >BTW whats with LINUX tag in patches, pls drop them
>>>
>>> Ok will mention the Linux tag info in the cover letter patch from the
>>> next patch series on wards...
>>
>>Please wrap your replies within 80chars. It is very hard to read! I have reflown
>for
>>readability
>
>Sure will take care of it next time onwards...
>
>>
>>Can you explain what you mean by that info, what are you trying to convey?
>
>What I mean here is will mention the Linux kernel tag
>Information in the cover letter patch...
Oops sorry I misunderstood your comment...
In my company we have internally different projects
To differentiate b/w them we usually use LINUX prefix
By mistake I have added the LINUX prefix in this patch series
I have removed it in the v2 series...
Regards,
Kedar.
>
>Regards,
>Kedar.
>
>>
>>--
>>~Vinod