summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorUlf Hansson <(address hidden)>2011-11-08 10:59:25 +0100
committerLee Jones <lee.jones@linaro.org>2012-01-05 10:15:57 +0000
commit67ea931cbee44bdfaedec70fbe70b005393cd2f4 (patch)
treefc6236f5b4488a4ccb4380fdb7d313960b0292ee /drivers/mmc
parentd48f255d2dd3f06ca0ee3fb181d03cc870db9caa (diff)
mmci: Fix PIO read for small SDIO packets
Corrects a bug in MMCI host driver which silently causes small reads (< 4 bytes as only used in SDIO) from PL-18X to fail. Signed-off-by: Stefan Nilsson XK <(address hidden)> Signed-off-by: Ulf Hansson <(address hidden)> Acked-by: Linus Walleij <(address hidden)>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/mmci.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 470a3d571ac..0105030eece 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -862,7 +862,18 @@ static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int rema
if (count <= 0)
break;
- readsl(base + MMCIFIFO, ptr, count >> 2);
+ /*
+ * SDIO especially may want to receive something that is
+ * not divisible by 4 (as opposed to card sectors
+ * etc). Therefore make sure to to always read the last bytes
+ * while only doing full 32-bit reads towards the FIFO.
+ */
+ if (count < 4) {
+ unsigned char buf[4];
+ readsl(base + MMCIFIFO, buf, 1);
+ memcpy(ptr, buf, count);
+ } else
+ readsl(base + MMCIFIFO, ptr, count >> 2);
ptr += count;
remain -= count;