aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorWerner Almesberger <werner@openmoko.org>2008-11-19 17:11:18 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:11:18 +0000
commit21f6d336852a942547ddb218f50ce49c6abb8eaf (patch)
tree8faff948fb1aa009f3c89e39c7a73b9284e79c9d /drivers/mmc/host
parent8fe801965faaaff258a188b553e2a0a11f41a247 (diff)
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 <werner@openmoko.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/s3cmci.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index 2038c93cfd9..bf4df3a82f8 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -289,8 +289,11 @@ static void do_pio_read(struct s3cmci_host *host)
* 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 @@ static void do_pio_write(struct s3cmci_host *host)
* 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;