From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: DMA/cache problems on SA1110/SA1111 (Was: Re: USB Host on a SA1111)
Date: Sat, 26 Dec 2009 15:59:22 +0000 [thread overview]
Message-ID: <20091226155922.GA30221@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <de2dcbb80912260618w3d3978c9pc8362ce9f2458459@mail.gmail.com>
On Sat, Dec 26, 2009 at 03:18:31PM +0100, Filip Zyzniewski wrote:
> On Tue, Dec 22, 2009 at 5:59 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>
> > Make sure that the DMA mask is correctly set - SA1111's have a bug in them
> > which means that certain address bits must have a certain value for all
> > DMA activities.
>
> I know this bug from SA1111 errata. I know that sound DMA is ok on 2.4
> kernels on the Jornada 720s, so I am trying to find what they were
> doing to have it working.
>...
> Should I try to port the remaining part of the 2.4 function to the 2.6 one?
No. Clearly you didn't read what I wrote. Let me be more explicit.
We deal with the DMA problem a different way in 2.6 - we set the DMA
mask with the appropriate bit clear:
/*
* Now clear the bits in the DMA mask to work around the SA1111
* DMA erratum (Intel StrongARM SA-1111 Microprocessor Companion
* Chip Specification Update, June 2000, Erratum #7).
*/
if (sachip->dev->dma_mask)
*sachip->dev->dma_mask &= sa1111_dma_mask[drac >> 2];
sachip->dev->coherent_dma_mask &= sa1111_dma_mask[drac >> 2];
And then the DMA bounce code does this:
unsigned long mask = *dev->dma_mask;
needs_bounce = (dma_addr | (dma_addr + size - 1)) & ~mask;
which checks whether the buffer being presented for DMA has the
problem bit set - if it does, it bounces the buffer.
Now, the problem with DMA masks is that Linux is screwy when it comes
to dealing with them - the assumption is that DMA masks are a set of
zeros followed by a set of ones, in other words, it's not a proper
bitmask.
Moreover, device drivers are expected to know what the correct DMA mask
is for their device, irrespective of what's going on upstream of the
device. Very stupid when you have things like limited size windows
(as found on IOP platforms.)
So, check the DMA mask. And check your DMA memory setup. If either one
is wrong, you _will_ get non-DMA'd buffers passed through. That's your
very first port of call.
prev parent reply other threads:[~2009-12-26 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-22 16:33 DMA/cache problems on SA1110/SA1111 (Was: Re: USB Host on a SA1111) Filip Zyzniewski
2009-12-22 16:59 ` Russell King - ARM Linux
2009-12-26 14:18 ` Filip Zyzniewski
2009-12-26 15:55 ` Filip Zyzniewski
2009-12-26 15:59 ` Russell King - ARM Linux [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=20091226155922.GA30221@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