aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2012-10-12 09:01:50 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-10-18 06:06:22 -0400
commit06c1a121805d7870abbf037d3ccd9a609a5219f2 (patch)
tree879cd938b4de49158bd6141ef5f193298a04bc7d /drivers/mmc
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
ARM: 7551/1: mmc: mmci: Fix incorrect handling of HW flow control for SDIO
For data writes <= 8 bytes, HW flow control was disabled but never re-enabled when the transfer was completed. This meant that a following read request would give buffer overrun errors. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Johan Rudholm <johan.rudholm@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/mmci.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index edc3e9baf0e7..877079e778cd 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -654,9 +654,29 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
654 654
655 /* The ST Micro variants has a special bit to enable SDIO */ 655 /* The ST Micro variants has a special bit to enable SDIO */
656 if (variant->sdio && host->mmc->card) 656 if (variant->sdio && host->mmc->card)
657 if (mmc_card_sdio(host->mmc->card)) 657 if (mmc_card_sdio(host->mmc->card)) {
658 /*
659 * The ST Micro variants has a special bit
660 * to enable SDIO.
661 */
662 u32 clk;
663
658 datactrl |= MCI_ST_DPSM_SDIOEN; 664 datactrl |= MCI_ST_DPSM_SDIOEN;
659 665
666 /*
667 * The ST Micro variant for SDIO transfer sizes
668 * less then 8 bytes should have clock H/W flow
669 * control disabled.
670 */
671 if ((host->size < 8) &&
672 (data->flags & MMC_DATA_WRITE))
673 clk = host->clk_reg & ~variant->clkreg_enable;
674 else
675 clk = host->clk_reg | variant->clkreg_enable;
676
677 mmci_write_clkreg(host, clk);
678 }
679
660 /* 680 /*
661 * Attempt to use DMA operation mode, if this 681 * Attempt to use DMA operation mode, if this
662 * should fail, fall back to PIO mode 682 * should fail, fall back to PIO mode
@@ -877,22 +897,6 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem
877 count = min(remain, maxcnt); 897 count = min(remain, maxcnt);
878 898
879 /* 899 /*
880 * The ST Micro variant for SDIO transfer sizes
881 * less then 8 bytes should have clock H/W flow
882 * control disabled.
883 */
884 if (variant->sdio &&
885 mmc_card_sdio(host->mmc->card)) {
886 u32 clk;
887 if (count < 8)
888 clk = host->clk_reg & ~variant->clkreg_enable;
889 else
890 clk = host->clk_reg | variant->clkreg_enable;
891
892 mmci_write_clkreg(host, clk);
893 }
894
895 /*
896 * SDIO especially may want to send something that is 900 * SDIO especially may want to send something that is
897 * not divisible by 4 (as opposed to card sectors 901 * not divisible by 4 (as opposed to card sectors
898 * etc), and the FIFO only accept full 32-bit writes. 902 * etc), and the FIFO only accept full 32-bit writes.