Skip to content

Commit 63624d1

Browse files
shimodayUlf Hansson
authored andcommitted
mmc: tmio: Use dma_max_mapping_size() instead of a workaround
Since the commit 133d624 ("dma: Introduce dma_max_mapping_size()") provides a helper function to get the max mapping size, we can use the function instead of the workaround code for swiotlb. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 4aaaf3a commit 63624d1

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

‎drivers/mmc/host/tmio_mmc_core.c‎

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <linux/delay.h>
2828
#include <linux/device.h>
29+
#include <linux/dma-mapping.h>
2930
#include <linux/highmem.h>
3031
#include <linux/interrupt.h>
3132
#include <linux/io.h>
@@ -45,7 +46,6 @@
4546
#include <linux/scatterlist.h>
4647
#include <linux/sizes.h>
4748
#include <linux/spinlock.h>
48-
#include <linux/swiotlb.h>
4949
#include <linux/workqueue.h>
5050

5151
#include "tmio_mmc.h"
@@ -1199,19 +1199,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
11991199
mmc->max_blk_size = TMIO_MAX_BLK_SIZE;
12001200
mmc->max_blk_count = pdata->max_blk_count ? :
12011201
(PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs;
1202-
mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count;
1203-
/*
1204-
* Since swiotlb has memory size limitation, this will calculate
1205-
* the maximum size locally (because we don't have any APIs for it now)
1206-
* and check the current max_req_size. And then, this will update
1207-
* the max_req_size if needed as a workaround.
1208-
*/
1209-
if (swiotlb_max_segment()) {
1210-
unsigned int max_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE;
1211-
1212-
if (mmc->max_req_size > max_size)
1213-
mmc->max_req_size = max_size;
1214-
}
1202+
mmc->max_req_size = min_t(size_t,
1203+
mmc->max_blk_size * mmc->max_blk_count,
1204+
dma_max_mapping_size(&pdev->dev));
12151205
mmc->max_seg_size = mmc->max_req_size;
12161206

12171207
if (mmc_can_gpio_ro(mmc))

0 commit comments

Comments
 (0)