dma: pl330: Use the generic of_dma_xlate_by_chan_id
Hi Lars,
------- Original Message -------
Sender : Lars-Peter Clausen<[email protected]>
Date : Apr 02, 2013 16:33 (GMT+09:00)
Title : Re: [PATCH 2/2] dma: pl330: Use the generic of_dma_xlate_by_chan_id
Quoted 17 lines · PADMAVATHI VENNA
Hi,
------- Original Message -------
Sender : Lars-Peter Clausen
Date : Mar 25, 2013 22:16 (GMT+09:00)
Title : [PATCH 2/2] dma: pl330: Use the genericof_dma_xlate_by_chan_idUse the generic
of_dma_xlate_by_chan_idxlate callback instead of a custom implementation.There is one minor difference between the generic
of_dma_xlate_by_chan_idfunction and the pl330 specific one.of_dma_xlate_by_chan_idonly sets theDMA_SLAVEcapability for the channel capability mask, while the pl330 driver additionally sets theDMA_CYCLICcapability. But since all pl330 channels which have theDMA_SLAVEcapability set also haveDMA_CYCLICcapability set both functions will have the same result.
Quoted 3 lines
I am not clear about the dma capabilities. Is it mentioned some where that if we set
DMA_SLAVEcapability will that also setDMA_CYCLICcapability?
Well DMA_SLAVE won't automatically set DMA_CYCLIC. But the driver sets both.
I tested your patches, it's woking for audio. But I need some clarification related to capabilities. As per my understanding, controller driver registers the available capabilities in the probe and client drivers requests for a particular capability. In both the cases, in the dmaengine it checks if the requested capability is satisfied.
If we don't set the DMA_CYCLIC, how __dma_device_satisfies_mask works?
Please correct me if I am wrong.
Thanks
Padma
- Lars
Quoted 78 lines
Signed-off-by Lars-Peter Clausen---
drivers/dma/pl330.c| 41 +----------------------------------------1 file changed, 1 insertion(+), 40 deletions(-)drivers/dma/pl330.c +1
-40@@ -608,11 +608,6 @@ struct dma_pl330_desc {struct dma_pl330_chan *pchan; }; -struct dma_pl330_filter_args { -struct dma_pl330_dmac *pdmac; -unsigned int chan_id; -}; -static inline void _callback (struct pl330_req *r,enum pl330_op_err err) {if (r && r->xfer_cb)@@ -2358,16 +2353,6 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)tasklet_schedule (&pch->task); } -static bool pl330_dt_filter (struct dma_chan *chan,void *param) -{ -struct dma_pl330_filter_args *fargs = param; - -if (chan->device != &fargs->pdmac->ddma) -return false; - -return (chan->chan_id == fargs->chan_id); -} -bool pl330_filter (struct dma_chan *chan,void *param) {u8 *peri_id;@@ -2380,30 +2365,6 @@ bool pl330_filter(struct dma_chan *chan, void *param) }EXPORT_SYMBOL (pl330_filter); -static struct dma_chan *of_dma_pl330_xlate (struct of_phandle_args *dma_spec, -struct of_dma *ofdma) -{ -int count = dma_spec->args_count; -struct dma_pl330_dmac *pdmac = ofdma->of_dma_data; -struct dma_pl330_filter_args fargs; -dma_cap_mask_t cap; - -if (!pdmac) -return NULL ; - -if (count !=1 ) -return NULL ; - - fargs.pdmac = pdmac; - fargs.chan_id = dma_spec->args[0 ]; - -dma_cap_zero (cap); -dma_cap_set (DMA_SLAVE , cap); -dma_cap_set (DMA_CYCLIC , cap); - -return dma_request_channel (cap, pl330_dt_filter, &fargs); -} -static int pl330_alloc_chan_resources (struct dma_chan *chan) {struct dma_pl330_chan *pch =to_pchan (chan);@@ -2996,7 +2957,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pi->pcfg.num_peri, pi->pcfg.num_events); ret =of_dma_controller_register (adev->dev.of_node, - of_dma_pl330_xlate, pdmac); + of_dma_xlate_by_chan_id, pd);if (ret) { dev_err(&adev->dev,"unable to register DMA to the generic DT DMA helpers\n");ÿôèº{.nÇ+‰·Ÿ®‰†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºÊ‡Ú™ë,j¢f£¢·hš�ï�êÿ‘êçz_è®(階ŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨èÚ&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿÃÿ¶ìÿ¢¸?–I¥
Quoted 37 lines · PADMAVATHI VENNA
Hi Lars,
------- Original Message -------
Sender : Lars-Peter Clausen<[email protected]>
Date : Apr 02, 2013 16:33 (GMT+09:00)
Title : Re: [PATCH 2/2] dma: pl330: Use the genericof_dma_xlate_by_chan_idQuoted 17 lines · PADMAVATHI VENNA
Hi,
------- Original Message -------
Sender : Lars-Peter Clausen
Date : Mar 25, 2013 22:16 (GMT+09:00)
Title : [PATCH 2/2] dma: pl330: Use the genericof_dma_xlate_by_chan_idUse the generic
of_dma_xlate_by_chan_idxlate callback instead of a custom implementation.There is one minor difference between the generic
of_dma_xlate_by_chan_idfunction and the pl330 specific one.of_dma_xlate_by_chan_idonly sets theDMA_SLAVEcapability for the channel capability mask, while the pl330 driver additionally sets theDMA_CYCLICcapability. But since all pl330 channels which have theDMA_SLAVEcapability set also haveDMA_CYCLICcapability set both functions will have the same result.Quoted 3 lines
I am not clear about the dma capabilities. Is it mentioned some where that if we set
DMA_SLAVEcapability will that also setDMA_CYCLICcapability?Well
DMA_SLAVEwon't automatically setDMA_CYCLIC. But the driver sets both.I tested your patches, it's woking for audio. But I need some clarification related to capabilities. As per my understanding, controller driver registers the available capabilities in the probe and client drivers requests for a particular capability. In both the cases, in the dmaengine it checks if the requested capability is satisfied.
If we don't set theDMA_CYCLIC, how__dma_device_satisfies_maskworks?
Quoted 4 lines
Please correct me if I am wrong.
Thanks
Padma
Hi,
Well, DMA_SLAVE | DMA_CYCLIC is a more restrictive mask than DMA_SLAVE. So any channel that matches DMA_SLAVE | DMA_CYCLIC will also match DMA_SLAVE.
- Lars
Quoted 80 lines
- Lars
Quoted 78 lines
Signed-off-by Lars-Peter Clausen---
drivers/dma/pl330.c| 41 +----------------------------------------1 file changed, 1 insertion(+), 40 deletions(-)drivers/dma/pl330.c +1
-40@@ -608,11 +608,6 @@ struct dma_pl330_desc {struct dma_pl330_chan *pchan; }; -struct dma_pl330_filter_args { -struct dma_pl330_dmac *pdmac; -unsigned int chan_id; -}; -static inline void _callback (struct pl330_req *r,enum pl330_op_err err) {if (r && r->xfer_cb)@@ -2358,16 +2353,6 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err err)tasklet_schedule (&pch->task); } -static bool pl330_dt_filter (struct dma_chan *chan,void *param) -{ -struct dma_pl330_filter_args *fargs = param; - -if (chan->device != &fargs->pdmac->ddma) -return false; - -return (chan->chan_id == fargs->chan_id); -} -bool pl330_filter (struct dma_chan *chan,void *param) {u8 *peri_id;@@ -2380,30 +2365,6 @@ bool pl330_filter(struct dma_chan *chan, void *param) }EXPORT_SYMBOL (pl330_filter); -static struct dma_chan *of_dma_pl330_xlate (struct of_phandle_args *dma_spec, -struct of_dma *ofdma) -{ -int count = dma_spec->args_count; -struct dma_pl330_dmac *pdmac = ofdma->of_dma_data; -struct dma_pl330_filter_args fargs; -dma_cap_mask_t cap; - -if (!pdmac) -return NULL ; - -if (count !=1 ) -return NULL ; - - fargs.pdmac = pdmac; - fargs.chan_id = dma_spec->args[0 ]; - -dma_cap_zero (cap); -dma_cap_set (DMA_SLAVE , cap); -dma_cap_set (DMA_CYCLIC , cap); - -return dma_request_channel (cap, pl330_dt_filter, &fargs); -} -static int pl330_alloc_chan_resources (struct dma_chan *chan) {struct dma_pl330_chan *pch =to_pchan (chan);@@ -2996,7 +2957,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) pi->pcfg.num_peri, pi->pcfg.num_events); ret =of_dma_controller_register (adev->dev.of_node, - of_dma_pl330_xlate, pdmac); + of_dma_xlate_by_chan_id, pd);if (ret) {dev_err (&adev->dev,"unable to register DMA to the generic DT DMA helpers\n" );
Quoted 3 lines · Lars-Peter Clausen
Quoted 2 lines · PADMAVATHI VENNA
Quoted 2 lines
Use the generic
of_dma_xlate_by_chan_idxlate callback instead of a custom implementation.
Hi Padma,
Can you please fix your MUA to
1) not break the message ids
2) reply inline which makes a distinction for quoted text
Quoted 22 lines
Quoted 22 lines
Quoted 11 lines
There is one minor difference between the generic
of_dma_xlate_by_chan_idfunction and the pl330 specific one.of_dma_xlate_by_chan_idonly sets theDMA_SLAVEcapability for the channel capability mask, while the pl330 driver additionally sets theDMA_CYCLICcapability. But since all pl330 channels which have theDMA_SLAVEcapability set also haveDMA_CYCLICcapability set both functions will have the same result.I am not clear about the dma capabilities. Is it mentioned some where that if we set
DMA_SLAVEcapability will that also setDMA_CYCLICcapability?Well
DMA_SLAVEwon't automatically setDMA_CYCLIC. But the driver sets both.I tested your patches, it's woking for audio. But I need some clarification related to capabilities. As per my understanding, controller driver registers the available capabilities in the probe and client drivers requests for a particular capability. In both the cases, in the dmaengine it checks if the requested capability is satisfied.
If we don't set theDMA_CYCLIC, how__dma_device_satisfies_maskworks?Please correct me if I am wrong.
Quoted 7 lines
Quoted 2 lines
Thanks
PadmaHi,
Well,
DMA_SLAVE|DMA_CYCLICis a more restrictive mask thanDMA_SLAVE. So any channel that matchesDMA_SLAVE|DMA_CYCLICwill also matchDMA_SLAVE.
DMA_SLAVE means that controllers channel can do slave transactions and should support the slave APIs.DMA_CYCLIC means that controller can do a cyclic transfers for the sg list sent and will do so untill channel is aborted
Now we are talking about DMA_CYCLIC for periphrals only so DMA_SLAVE cna be implied and is usually the normal usage though nothing prevent you from doing a cyclic memcpy if you would wish.
Right thing would be to set mask aptly on both sides, and since you are doing DMA_CYCLIC, i would expect both the controller and client have done this, if not we need this to be fixed :)
--
~Vinod