aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorSahitya Tummala <stummala@codeaurora.org>2010-12-08 04:33:06 -0500
committerDavid Brown <davidb@codeaurora.org>2010-12-20 15:28:31 -0500
commit71dd9106af54de0f758875fa4b595af42a327448 (patch)
treec695aa16ad30d59cb04a0f3dd7073a0a196df957 /drivers/mmc
parentb08bb35d1a5ee5426198eb3a2861008c2e9e6fc4 (diff)
mmc: msm_sdcc: Fix bug in PIO mode when data size is not word aligned
The current code for PIO doesn't transfer whole data when data size is not in multiple of 4 bytes. The last few bytes are not written to the card resulting in no DATAEND interrupt from SDCC. This patch allows data transfer for non-aligned data size in PIO mode. Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/msm_sdcc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 81ed16fb42b5..9badc51bc4db 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -613,6 +613,9 @@ msmsdcc_pio_read(struct msmsdcc_host *host, char *buffer, unsigned int remain)
613 uint32_t *ptr = (uint32_t *) buffer; 613 uint32_t *ptr = (uint32_t *) buffer;
614 int count = 0; 614 int count = 0;
615 615
616 if (remain % 4)
617 remain = ((remain >> 2) + 1) << 2;
618
616 while (msmsdcc_readl(host, MMCISTATUS) & MCI_RXDATAAVLBL) { 619 while (msmsdcc_readl(host, MMCISTATUS) & MCI_RXDATAAVLBL) {
617 *ptr = msmsdcc_readl(host, MMCIFIFO + (count % MCI_FIFOSIZE)); 620 *ptr = msmsdcc_readl(host, MMCIFIFO + (count % MCI_FIFOSIZE));
618 ptr++; 621 ptr++;
@@ -633,13 +636,14 @@ msmsdcc_pio_write(struct msmsdcc_host *host, char *buffer,
633 char *ptr = buffer; 636 char *ptr = buffer;
634 637
635 do { 638 do {
636 unsigned int count, maxcnt; 639 unsigned int count, maxcnt, sz;
637 640
638 maxcnt = status & MCI_TXFIFOEMPTY ? MCI_FIFOSIZE : 641 maxcnt = status & MCI_TXFIFOEMPTY ? MCI_FIFOSIZE :
639 MCI_FIFOHALFSIZE; 642 MCI_FIFOHALFSIZE;
640 count = min(remain, maxcnt); 643 count = min(remain, maxcnt);
641 644
642 writesl(base + MMCIFIFO, ptr, count >> 2); 645 sz = count % 4 ? (count >> 2) + 1 : (count >> 2);
646 writesl(base + MMCIFIFO, ptr, sz);
643 ptr += count; 647 ptr += count;
644 remain -= count; 648 remain -= count;
645 649