From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [v2 rebased 1/2] dma: mmp_pdma: add support for residue reporting
Date: Wed, 14 Aug 2013 13:46:43 +0100 [thread overview]
Message-ID: <20130814124643.GP23006@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1376483121-11306-1-git-send-email-zonque@gmail.com>
On Wed, Aug 14, 2013 at 02:25:20PM +0200, 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.
This is actually broken, and I'm surprised that Vinod even suggested it.
Think about what happens with a scatter-gather list where the addresses
of each element really are scattered in memory. Let's say that the
N'th element is at a lower address than the first element, and we're on
that N'th element. What happens when curr is less than chan->start_addr
here:
> +static unsigned int mmp_pdma_residue(struct mmp_pdma_chan *chan)
> +{
> + u32 curr, done;
> +
> + if (chan->dir == DMA_DEV_TO_MEM)
> + curr = readl(chan->phy->base + DTADR(chan->phy->idx));
> + else
> + curr = readl(chan->phy->base + DSADR(chan->phy->idx));
> +
> + done = curr - chan->start_addr;
> +
> + return chan->total_len - done;
> +}
next prev parent reply other threads:[~2013-08-14 12:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 12:25 [v2 rebased 1/2] dma: mmp_pdma: add support for residue reporting Daniel Mack
2013-08-14 12:46 ` Russell King - ARM Linux [this message]
2013-08-14 16:15 ` Daniel Mack
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=20130814124643.GP23006@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).