Skip to content

Commit

Permalink
ARM: 7551/1: mmc: mmci: Fix incorrect handling of HW flow control for…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Ulf Hansson authored and Russell King committed Oct 18, 2012
1 parent ddffeb8 commit 06c1a12
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions drivers/mmc/host/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,29 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)

/* The ST Micro variants has a special bit to enable SDIO */
if (variant->sdio && host->mmc->card)
if (mmc_card_sdio(host->mmc->card))
if (mmc_card_sdio(host->mmc->card)) {
/*
* The ST Micro variants has a special bit
* to enable SDIO.
*/
u32 clk;

datactrl |= MCI_ST_DPSM_SDIOEN;

/*
* The ST Micro variant for SDIO transfer sizes
* less then 8 bytes should have clock H/W flow
* control disabled.
*/
if ((host->size < 8) &&
(data->flags & MMC_DATA_WRITE))
clk = host->clk_reg & ~variant->clkreg_enable;
else
clk = host->clk_reg | variant->clkreg_enable;

mmci_write_clkreg(host, clk);
}

/*
* Attempt to use DMA operation mode, if this
* should fail, fall back to PIO mode
Expand Down Expand Up @@ -876,22 +896,6 @@ static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int rem
variant->fifosize : variant->fifohalfsize;
count = min(remain, maxcnt);

/*
* The ST Micro variant for SDIO transfer sizes
* less then 8 bytes should have clock H/W flow
* control disabled.
*/
if (variant->sdio &&
mmc_card_sdio(host->mmc->card)) {
u32 clk;
if (count < 8)
clk = host->clk_reg & ~variant->clkreg_enable;
else
clk = host->clk_reg | variant->clkreg_enable;

mmci_write_clkreg(host, clk);
}

/*
* SDIO especially may want to send something that is
* not divisible by 4 (as opposed to card sectors
Expand Down

0 comments on commit 06c1a12

Please sign in to comment.