From: stefan.xk.nilsson@stericsson.com (Stefan Nilsson XK)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] mmc: mmci: Fix PIO read for small SDIO packets
Date: Wed, 26 Oct 2011 10:45:27 +0200 [thread overview]
Message-ID: <1319618727-16969-1-git-send-email-stefan.xk.nilsson@stericsson.com> (raw)
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 <stefan.xk.nilsson@stericsson.com>
Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/mmc/host/mmci.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 56e9a41..5c3a517 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -776,7 +776,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 send 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;
--
1.7.7
next reply other threads:[~2011-10-26 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-26 8:45 Stefan Nilsson XK [this message]
2011-11-14 16:38 ` [PATCH] mmc: mmci: Fix PIO read for small SDIO packets Stefan Nilsson XK
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319618727-16969-1-git-send-email-stefan.xk.nilsson@stericsson.com \
--to=stefan.xk.nilsson@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).