linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: add PrimeCell generic DMA to MMCI/PL180
Date: Tue, 1 Feb 2011 13:30:36 +0000	[thread overview]
Message-ID: <20110201133036.GI31216@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <AANLkTikLABG5yWDYcOe12mfy_Hco15k_ByqYX15GH9Cy@mail.gmail.com>

On Thu, Jan 27, 2011 at 02:07:21PM +0100, Linus Walleij wrote:
> 2011/1/25 Russell King - ARM Linux <linux@arm.linux.org.uk>:
> 
> > The DMA controller must be programmed with the right burst size for the
> > peripheral, which in this case would be 8 words, otherwise the 'last'
> > burst signalling goes wrong.
> 
> Now I think I found the real bug behind this...
> 
> In the Vendor data we set this:
> 	.dmareg_enable		= 1 << 12, /* DMAREQCTRL */
> 
> This actually means:
> 
> DMAREQCTL: DMA requests control.
> 0: SREQ are generated when data to be transferred is
> less than 8 words.
> 1: no SREQ is generated when data to be transferred
> is less than 8 words, LBREQ is generated instead.
> 
> Which will work for all MMC card transfers I believe, since
> these are even 512 byte multiples. No problem...
> 
> Then comes an SDIO request and it is 7 bytes so LBREQ
> is emitted 7 times instead of 6 * SREQ + 1 LSREQ.
> 
> Which works if you set down the burst size to 1 byte,
> firing 7 consecutive bursts each terminated with LBREQ
> which the DMA controller is perfectly happy with.
> 
> So while setting the burstsize down to 1 byte works
> since it matches the twisted logic of DMAREQCTL,
> instead flipping the bit in DMAREQCTL to 0
> if (size % 8 != 0) makes some more kind of sense.
> 
> This needs to be tested to see whether it works or
> not, so I'll see what we can do.

I really can't see this making any difference.  In the case of a 7 word
transfer, you've setup the DMA controller to transfer 7 * 4 = 28 bytes.

1. If DMAREQCTL = 1, the MMCI issues a LBREQ.

   If the DMA controller has a burst size of 32 bytes, if it fetches 32
   bytes from the device, it is broken.  It doesn't matter what the
   primecell does - it's the DMA controller misbehaving.  In that case,
   the work-around needs to be in the DMA controller code to reduce the
   bursting so that the DMA controller doesn't transfer more than the
   requested size.

   This is not specific to MMCI as other devices will suffer the same
   problem.  So it's wrong to put it into every primecell driver just
   because someone has a broken DMA controller somewhere.

2. If DMAREQCTL = 0, the MMCI issues six SREQ plus one LSREQ.

   This reflects the behaviour of the ARM primecell, and SREQ should
   result in the DMA controller performing one transfer per request.

So, the solutions as I see it are:

1. If DMAREQCTL = 1, move the burst limiting work-around into the DMA
   engine driver, if it really is a problem.

2. Set DMAREQCTL = 0.

(2) seems to be the most sane solution to me.

  reply	other threads:[~2011-02-01 13:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06  9:42 [PATCH] ARM: add PrimeCell generic DMA to MMCI/PL180 Linus Walleij
2010-12-19 16:32 ` Russell King - ARM Linux
2010-12-19 19:59   ` Russell King - ARM Linux
2010-12-21 13:54     ` Russell King - ARM Linux
2010-12-21 15:59       ` Russell King - ARM Linux
2010-12-22 21:55         ` Linus Walleij
2011-01-24 16:01           ` Russell King - ARM Linux
2011-01-24 21:06             ` Linus Walleij
2011-01-24 21:22               ` Russell King - ARM Linux
2011-01-25  8:33                 ` Linus Walleij
2011-01-26  9:24                   ` Russell King - ARM Linux
2011-01-26  9:50                   ` Russell King - ARM Linux
2011-01-25  9:36                 ` Linus Walleij
2011-01-25  9:47                 ` Linus Walleij
2011-01-25 10:23                   ` Russell King - ARM Linux
2011-01-27 13:07                     ` Linus Walleij
2011-02-01 13:30                       ` Russell King - ARM Linux [this message]
2011-02-01 14:15                         ` Linus Walleij

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=20110201133036.GI31216@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).