diff options
author | Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com> | 2010-11-20 11:07:28 +0100 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 16:07:35 +0200 |
commit | 070828c78de86e22c05dcf3638a7c2c30bfaf31a (patch) | |
tree | e3e9d451306f021d5b00445e9ea833186ead38b0 /drivers | |
parent | ec1272eb00c6cc4666c9d24c336f6d87d8978fca (diff) |
MMCI: Fix bug in 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.
Change-Id: I31428aa14cdd7f756f8ff776e87ef65c02de3bb3
Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/9021
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Reviewed-by: Henrik CARLING <henrik.carling@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/9191
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30927
Reviewed-by: Ulf HANSSON <ulf.hansson@stericsson.com>
Tested-by: Ulf HANSSON <ulf.hansson@stericsson.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/host/mmci.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 56e9a416826..baf93a82c56 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -776,7 +776,24 @@ 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 we always read the last bytes + * out of the FIFO. + */ + switch (count) { + case 1: + case 3: + readsb(base + MMCIFIFO, ptr, count); + break; + case 2: + readsw(base + MMCIFIFO, ptr, 1); + break; + default: + readsl(base + MMCIFIFO, ptr, count >> 2); + break; + } ptr += count; remain -= count; |