The recent s3cmci changes from upstream introduced a bug that could
make s3cmci loop forever. It did that in the 128 byte transfers used
for WLAN SDIO.
I've attached a patch that solves the problem. I've also submitted
it on linux-arm-kernel, so the fix should eventually trickle back.
- Werner
fix-mmc-busy-loop-on-bytes.patch
christer-mmc-byte-alignment.patch reduced the FIFO I/O granularity
from words to bytes. This also includes the decision when the FIFO
is empty or full.
However, we sometimes only want to transfer full words, in which
case do_pio_read/do_pio_write busy-loop until the FIFO has filled
up or drained enough.
In the case of do_pio_write, this can cause an endless loop if the
amount of data exceeds the FIFO size, because do_pio_write runs
before the transfer is initiated, so the FIFO never drains.
Signed-off-by: Werner Almesberger <[EMAIL PROTECTED]>
---
Index: ktrack/drivers/mmc/host/s3cmci.c
===================================================================
--- ktrack.orig/drivers/mmc/host/s3cmci.c 2008-10-30 23:07:50.000000000 -0200
+++ ktrack/drivers/mmc/host/s3cmci.c 2008-10-30 23:08:14.000000000 -0200
@@ -289,8 +289,11 @@
* an even multiple of 4. */
if (fifo >= host->pio_bytes)
fifo = host->pio_bytes;
- else
+ else {
fifo -= fifo & 3;
+ if (!fifo)
+ break;
+ }
host->pio_bytes -= fifo;
host->pio_count += fifo;
@@ -362,8 +365,11 @@
* words, so round down to an even multiple of 4. */
if (fifo >= host->pio_bytes)
fifo = host->pio_bytes;
- else
+ else {
fifo -= fifo & 3;
+ if (!fifo)
+ break;
+ }
host->pio_bytes -= fifo;
host->pio_count += fifo;