summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Drake <drake@endlessm.com>2019-03-20 02:36:53 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2019-03-21 06:19:06 -0400
commit5ea47691bd99e1100707ec63364aff72324e2af4 (patch)
tree027b2aff667b33417d9c63ba0bf38923b2f0ce2e /drivers
parent031d2ccc16775c9531800979069e141fbedeb2f7 (diff)
mmc: alcor: fix DMA reads
Setting max_blk_count to 1 here was causing the mmc block layer to always use the MMC_READ_SINGLE_BLOCK command here, which the driver does not DMA-accelerate. Drop the max_blk_ settings here. The mmc host defaults suffice, along with the max_segs and max_seg_size settings, which I have now documented in more detail. Now each MMC command reads 4 512-byte blocks, using DMA instead of PIO. On my SD card, this increases read performance (measured with dd) from 167kb/sec to 4.6mb/sec. Link: http://lkml.kernel.org/r/CAD8Lp47L5T3jnAjBiPs1cQ+yFA3L6LJtgFvMETnBrY63-Zdi2g@mail.gmail.com Signed-off-by: Daniel Drake <drake@endlessm.com> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Fixes: c5413ad815a6 ("mmc: add new Alcor Micro Cardreader SD/MMC driver") Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/alcor.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/mmc/host/alcor.c b/drivers/mmc/host/alcor.c
index c712b7deb3a9..82a97866e0cf 100644
--- a/drivers/mmc/host/alcor.c
+++ b/drivers/mmc/host/alcor.c
@@ -1044,14 +1044,27 @@ static void alcor_init_mmc(struct alcor_sdmmc_host *host)
1044 mmc->caps2 = MMC_CAP2_NO_SDIO; 1044 mmc->caps2 = MMC_CAP2_NO_SDIO;
1045 mmc->ops = &alcor_sdc_ops; 1045 mmc->ops = &alcor_sdc_ops;
1046 1046
1047 /* Hardware cannot do scatter lists */ 1047 /* The hardware does DMA data transfer of 4096 bytes to/from a single
1048 * buffer address. Scatterlists are not supported, but upon DMA
1049 * completion (signalled via IRQ), the original vendor driver does
1050 * then immediately set up another DMA transfer of the next 4096
1051 * bytes.
1052 *
1053 * This means that we need to handle the I/O in 4096 byte chunks.
1054 * Lacking a way to limit the sglist entries to 4096 bytes, we instead
1055 * impose that only one segment is provided, with maximum size 4096,
1056 * which also happens to be the minimum size. This means that the
1057 * single-entry sglist handled by this driver can be handed directly
1058 * to the hardware, nice and simple.
1059 *
1060 * Unfortunately though, that means we only do 4096 bytes I/O per
1061 * MMC command. A future improvement would be to make the driver
1062 * accept sg lists and entries of any size, and simply iterate
1063 * through them 4096 bytes at a time.
1064 */
1048 mmc->max_segs = AU6601_MAX_DMA_SEGMENTS; 1065 mmc->max_segs = AU6601_MAX_DMA_SEGMENTS;
1049 mmc->max_seg_size = AU6601_MAX_DMA_BLOCK_SIZE; 1066 mmc->max_seg_size = AU6601_MAX_DMA_BLOCK_SIZE;
1050 1067 mmc->max_req_size = mmc->max_seg_size;
1051 mmc->max_blk_size = mmc->max_seg_size;
1052 mmc->max_blk_count = mmc->max_segs;
1053
1054 mmc->max_req_size = mmc->max_seg_size * mmc->max_segs;
1055} 1068}
1056 1069
1057static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev) 1070static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)