Subject: [PATCH v2 2/2] dmaengine: Add hisilicon k3 DMA engine driver

From: [email-masked] (zhangfei)
Date: Tue, 20 Aug 2013 17:23:39 +0800

On 13-08-20 04:27 PM, Vinod Koul wrote:
> On Tue, Aug 20, 2013 at 03:55:05PM +0800, zhangfei gao wrote:
>> There are many example keep define simple.
> and there are others examples which have done the otherway. I would prefer that
> way please!
>
Personally, I prefer simple is better, it is only used in the file.
But is it fine to change.

>
>>>>> why do we need the else part here?
>>>> Since asynchronous mode is supported.
>>>> Desc is submitted to list but may not get physical channel to run.
>>> But when you pause you pause the running channel. You dont pause a descriptor.
>>> So whatever you are trying to imply doesnt make sense to me.
>>
>> Here delete node from chan_pending, which will be quired from tasklet.
>>
>> The physical channel is free matched.
>> dma_issue_pending will put node to d->k3_dma_issue_pending if no phy allocated.
>> Tasklet do two jobs
>> 1, check running channel for new request form desc_issued.
>> 2, check any new chan_pending and alloc phy if available.
>>
>> If no phy, the node will be put in chan_pending.
>> If pause does not remove from chan_pending, it may be got from tasklet
>> to start a new transaction.
>> So it's safe to remove from chan_pending when pause, and add back when resume.
> But when you add, where do you start from, from the start of the descriptor or
> the previosu position.
>
> The point is pause-resume you dont need to do all that. Channel is paused so
> just pause it by stopping exuection, not more. Then you resume by asking
> controller to start from where it left off.

Since it is async mode, it does not know the physical channel is really 
started or not.

When desc is submitted, it can be
a). get phy and run, pause can stop and resume where it stops.
b). Dot not start at all since no phy available (16 phys vs 27 request 
line), if pause do nothing it will stay in chan_pending, if tasklet 
happens again, it will be fetched and started, while upper layer thought 
it is already paused.

Do we need consider case b?