diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2017-10-19 23:12:41 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2017-10-20 05:24:58 -0400 |
commit | e90e8da72ad694a16a4ffa6e5adae3610208f73b (patch) | |
tree | fc0d836ca8f159fb9972d8bb9276688c0ab9d011 /drivers | |
parent | eb701ce16a45ed9880897c48f05ee608d77c72e3 (diff) |
mmc: tmio: fix swiotlb buffer is full
Since the commit de3ee99b097d ("mmc: Delete bounce buffer handling")
deletes the bounce buffer handling, a request data size will be referred
to max_{req,seg}_size instead of MMC_QUEUE_BOUNCESZ (64k bytes).
In other hand, renesas_sdhi_internal_dmac.c will set very big value of
max_{req,seg}_size because the max_blk_count is set to 0xffffffff.
And then, "swiotlb buffer is full" happens because swiotlb can handle
a memory size up to 256k bytes only (IO_TLB_SEGSIZE = 128 and
IO_TLB_SHIFT = 11).
So, as a workaround, this patch avoids the issue by setting
the max_{req,seg}_size up to 256k bytes if swiotlb is running.
Reported-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/host/tmio_mmc_core.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index a7293e186e03..9c4e6199b854 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/mmc/sdio.h> | 47 | #include <linux/mmc/sdio.h> |
48 | #include <linux/scatterlist.h> | 48 | #include <linux/scatterlist.h> |
49 | #include <linux/spinlock.h> | 49 | #include <linux/spinlock.h> |
50 | #include <linux/swiotlb.h> | ||
50 | #include <linux/workqueue.h> | 51 | #include <linux/workqueue.h> |
51 | 52 | ||
52 | #include "tmio_mmc.h" | 53 | #include "tmio_mmc.h" |
@@ -1215,6 +1216,18 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, | |||
1215 | mmc->max_blk_count = pdata->max_blk_count ? : | 1216 | mmc->max_blk_count = pdata->max_blk_count ? : |
1216 | (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs; | 1217 | (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs; |
1217 | mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; | 1218 | mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; |
1219 | /* | ||
1220 | * Since swiotlb has memory size limitation, this will calculate | ||
1221 | * the maximum size locally (because we don't have any APIs for it now) | ||
1222 | * and check the current max_req_size. And then, this will update | ||
1223 | * the max_req_size if needed as a workaround. | ||
1224 | */ | ||
1225 | if (swiotlb_max_segment()) { | ||
1226 | unsigned int max_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE; | ||
1227 | |||
1228 | if (mmc->max_req_size > max_size) | ||
1229 | mmc->max_req_size = max_size; | ||
1230 | } | ||
1218 | mmc->max_seg_size = mmc->max_req_size; | 1231 | mmc->max_seg_size = mmc->max_req_size; |
1219 | 1232 | ||
1220 | _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD || | 1233 | _host->native_hotplug = !(pdata->flags & TMIO_MMC_USE_GPIO_CD || |