From: zonque@gmail.com (Daniel Mack)
To: linux-arm-kernel@lists.infradead.org
Subject: [v3 1/2] dma: mmp_pdma: add support for residue reporting
Date: Fri, 16 Aug 2013 17:40:06 +0200 [thread overview]
Message-ID: <520E47D6.8020000@gmail.com> (raw)
In-Reply-To: <520DDB81.20607@marvell.com>
On 16.08.2013 09:57, Xiang Wang wrote:
> On 08/15/2013 12:19 AM, Daniel Mack wrote:
>> In order to report the channel's residue, we have to memorize the first
>> dma buffer position when the channel is configured.
>>
>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>> ---
>> drivers/dma/mmp_pdma.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 43 insertions(+), 2 deletions(-)
>>
>
>> +static unsigned int mmp_pdma_residue(struct mmp_pdma_chan *chan)
>> +{
>> + struct mmp_pdma_desc_sw *sw;
>> + u32 curr, done = 0;
>> +
>> + if (chan->dir == DMA_DEV_TO_MEM)
>> + curr = readl(chan->phy->base + DTADR(chan->phy->idx));
> One concern for this patch:
> If we call dmaengine_tx_status() after dma_do_tasklet at mmp_pdma.c,
> chan->phy will most likely to be NULL.
> dma_do_tasklet() -> start_pending_queue() -> mmp_pdma_free_phy()
Yes, I noticed this, too. I'm not really sure what the reason is to call
start_pending_queue() _before_ the callbacks are done. A quick test
shows that it works as well the other way around.
> For why do we call dmaengine_tx_status() after a DMA interrupt:
> briefly, if we use DMA to handle device trailing bytes, it'll report a
> DMA interrupt. We need to get to know how many bytes have been received
> in the IRQ handler.
> We've discussed about this in the link below:
> http://thread.gmane.org/gmane.linux.kernel/1500713
Thanks for the link, I wasn't aware of that discussion. And I actually
second what Andy said: As long as the residue calculation algorithm can
cope with the chan->phy==NULL condition and return 0 in that case, it's
actually doing the right thing, because a completed transaction has a
residue of 0 bytes.
I'll send out another series later, that also aims to fix the tasklet
behaviour. I'd appreciate another round of reviews :)
Daniel
prev parent reply other threads:[~2013-08-16 15:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 16:19 [v3 1/2] dma: mmp_pdma: add support for residue reporting Daniel Mack
2013-08-14 16:23 ` Russell King - ARM Linux
2013-08-15 1:57 ` Chao Xie
2013-08-15 3:44 ` Daniel Mack
2013-08-15 8:08 ` Chao Xie
2013-08-15 18:12 ` Daniel Mack
2013-08-16 2:21 ` Chao Xie
2013-08-16 7:57 ` Xiang Wang
2013-08-16 15:40 ` Daniel Mack [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=520E47D6.8020000@gmail.com \
--to=zonque@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.