Re: [PATCH V4 2/3] dmaengine: tegra-adma: Add support for Tegra210 ADMA

Jon Hunter
2016-04-19T13:59:49Z

On 19/04/16 14:25, Vinod Koul wrote:
> On Mon, Apr 18, 2016 at 04:06:23PM +0100, Jon Hunter wrote:
>> On 14/04/16 12:04, Jon Hunter wrote:

[snip]

>>> I had a look at this, but actually, I don't think this is going to work.
>>>
>>> Looking at dma_request_channel(), it is going to get a DMA channel that
>>> matches the mask for any DMA controller. In the xlate I already know
>>> which DMA controller I am and I just want one of the channels. The flow
>>> here is ...
>>>
>>> dma_request_chan()
>>> --> of_dma_request_slave_channel()
>>> --> xlate()
>>> --> dma_get_any_slave_channel()
>>>
>>> There are several other DMA drivers that are calling
>>> dma_get_any_slave_channel() from their xlate function which makes sense
>>> because they are requesting one of their own channels.
>>>
>>> I can understand that you wish to consolidate the APIs for requesting a
>>> channel, but it seems to me that you still need to have an API that DMA
>>> controller drivers can call where they can pass their dma_device
>>> structure to ensure you get a channel for the appropriate DMA controller.
>
> Yes but the idea was that xlate will help you to get the right channel. The
> whole dmaengine property was supposed to help you with that

Well it depends on the DMA controller. In the case of tegra the xlate
helps you extract the slave request ID for a given device. However,
because any channel can be used with any slave request ID, we don't care
about the exact channel. So we request any available channel for the DMA
controller in question and program it with the slave request we got from
the xlate.

> Please check the omap code which gets a specfic channel using this

Yes I have already seen this and it does not help here, because OMAP
uses of_dma_simple_xlate() which calls dma_request_channel() and again
this will get a channel from any DMA controller that matches the caps
flags. For tegra we have two DMA controllers and both support CYCLIC
transfers and so I am concerned we would get a channel from the wrong
DMA controller.

I have seen some DMA drivers (such as imx-dma) use the filter function
to match the DMA controller, but it seems daft to use the filter
function to match the DMA controller when we already know in the xlate
which DMA controller we are.

Cheers
Jon