diff options
author | Andrew Lunn <andrew@lunn.ch> | 2014-11-12 17:10:08 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-11-26 08:31:00 -0500 |
commit | 3c583f70a8e2feda03db77d2c8e9a41d302ac657 (patch) | |
tree | 50ff085de42363bf2e2d37ed910bfe3e1b988021 /drivers/mmc/host/mvsdio.c | |
parent | a26eba614afff0e39594101bcb73014a9a22fb33 (diff) |
mmc: mvsdio: Work around broken TX DMA
In order to use the mvsdio driver for sdio, it has been necessary to
use a module parameter to disable DMA so to force PIO is used. It is
then possible to use wireless LAN devices like mwifiex found on
topkick and mirabox. However, accessing an MMC SD card does work with
DMA.
Investigation has shown that MMC block device accesses are always
aligned to 64 byte boundaries, where as transfers from mwifiex are
rarely more than word aligned. It has also been determined that card
to host transfers work with DMA for SDIO devices, but host to card
transfers with DMA have problems.
This patch extends the current checks for buffers which are not word
aligned or multiple of words. All host to card transfers which are not
64 byte aligned are now also performed via PIO. This should not affect
the performance of SD cards, but allow sdio devices to work out of the
box, and they are likely to be more efficient since DMA will be used
for card to host transfers.
Tested on mirabox for wifi via mwifiex
Tested on 370 RD for file systems on an SD card.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/mvsdio.c')
-rw-r--r-- | drivers/mmc/host/mvsdio.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 6b4c5ad3b393..4f8618f4522d 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c | |||
@@ -111,10 +111,15 @@ static int mvsd_setup_data(struct mvsd_host *host, struct mmc_data *data) | |||
111 | mvsd_write(MVSD_BLK_COUNT, data->blocks); | 111 | mvsd_write(MVSD_BLK_COUNT, data->blocks); |
112 | mvsd_write(MVSD_BLK_SIZE, data->blksz); | 112 | mvsd_write(MVSD_BLK_SIZE, data->blksz); |
113 | 113 | ||
114 | if (nodma || (data->blksz | data->sg->offset) & 3) { | 114 | if (nodma || (data->blksz | data->sg->offset) & 3 || |
115 | ((!(data->flags & MMC_DATA_READ) && data->sg->offset & 0x3f))) { | ||
115 | /* | 116 | /* |
116 | * We cannot do DMA on a buffer which offset or size | 117 | * We cannot do DMA on a buffer which offset or size |
117 | * is not aligned on a 4-byte boundary. | 118 | * is not aligned on a 4-byte boundary. |
119 | * | ||
120 | * It also appears the host to card DMA can corrupt | ||
121 | * data when the buffer is not aligned on a 64 byte | ||
122 | * boundary. | ||
118 | */ | 123 | */ |
119 | host->pio_size = data->blocks * data->blksz; | 124 | host->pio_size = data->blocks * data->blksz; |
120 | host->pio_ptr = sg_virt(data->sg); | 125 | host->pio_ptr = sg_virt(data->sg); |