[Bug 1223] SD card no longer operational with 2.6.24 (the never-ending saga)
Mike (mwester)
mwester at dls.net
Thu Feb 21 07:42:08 CET 2008
Er, I didn't see a commit with this fix yet; so the SD card on the GTA01
is still being corrupted when folks boot up the 2.6.24 kernel. On the
chance that folks perhaps didn't see this email due to over-agressive
SPAM filters, I've stripped the URLs out of it, and attached the patch
directly. :(
Mike
Mike (mwester) wrote:
> Mike (mwester) wrote:
>> Mike (mwester) wrote:
>>> Tested. The write fix is *definitely* needed as well; revision 4080
>>> fixes both read and write. Thanks all - we're pretty close to being
>>> able to call the .24 kernel "stable" for the gta01, I think.
>>
>> No we're not. I spoke too soon, that'll teach me to always test
>> thoroughly. Reads work fine with this change, but writes fail in
>> strange ways. My apologies to anyone inconvenienced by my erroneous
>> declaration of success :(
>>
>> We need to decrement fifo as we write the unaligned data out in the
>> first loop (s3cmci.c):
>
> Still not there (yikes!). The commit for svn4082 committed the change
> from this last email, but it got applied to a different area of the
> source file. So that commit didn't fix the problem. (That's the bad
> news).
>
> Now the good news: that commit exposed a similar problem in a
> different area of the code -- same loop structure, needs the same
> fixes. This time around I spent a little extra time doing a review of
> the two functions, and ended up changing the structure of the loops
> slightly: "while ((condition1) && fifo--)" is a bad idea if you need
> to ensure that fifo doesn't go below zero when the loop exits (follow
> the code with the case where we have an unaligned buffer, and need to
> read or write 1 byte).
>
> Anyway, this time, to avoid ambiguity, here's a URL [1] to the patch
> that should be applied to the svn4082 s3cmci.c source file. The
> entire source file is also available [2].
>
> With this, I sure hope this undead dragon will finally stay dead.
>
> Mike (mwester)
>
URLS below edited in hopes of avoiding SPAM filters.
> [1] moko-dot-mwester-dot-net/s3cmci_diff_from_svn4082.patch
> [2] moko-dot-mwester-dot-net/s3cmci.c
>
Patch follows - yes, tabs and spaces are screwed up with this mailer,
see the pseudo-urls above for the
un-damaged patch (I'm just not in a place where I can fix the mailer
issue at the moment):
--- linux-2.6.24/drivers/mmc/host/s3cmci.c.4082 2008-02-18
20:26:37.000000000 -0600
+++ linux-2.6.24/drivers/mmc/host/s3cmci.c 2008-02-18
21:12:59.000000000 -0600
@@ -251,8 +251,10 @@
host->pio_count += fifo;
/* we might have an unaligned start of data */
- while (((unsigned long)host->pio_ptr & 0x03) && fifo--)
+ while (((unsigned long)host->pio_ptr & 0x03) && fifo) {
*(host->pio_ptr++) = readb(host->base + host->sdidata_b);
+ fifo--;
+ }
/* and a major chunk of data in the middle */
for (; fifo >= 4; fifo -=4) {
@@ -261,8 +263,10 @@
}
/* as well as some non-modulo-four trailer */
- while (fifo)
+ while (fifo) {
*(host->pio_ptr++) = readb(host->base + host->sdidata_b);
+ fifo--;
+ }
}
if (!host->pio_bytes) {
@@ -315,8 +319,10 @@
host->pio_count += fifo;
/* we might have an unaligned start of data */
- while ((unsigned long)host->pio_ptr & 0x03)
+ while (((unsigned long)host->pio_ptr & 0x03) && fifo) {
writeb(*(host->pio_ptr++), host->base + host->sdidata_b);
+ fifo--;
+ }
/* and a major chunk of data in the middle */
for (; fifo >= 4; fifo -=4) {
@@ -325,8 +331,10 @@
}
/* as well as some non-modulo-four trailer */
- while (fifo--)
+ while (fifo) {
writeb(*(host->pio_ptr++), host->base + host->sdidata_b);
+ fifo--;
+ }
}
enable_imask(host, S3C2410_SDIIMSK_TXFIFOHALF);
More information about the openmoko-kernel
mailing list