Skip to content

Commit 2a92ed4

Browse files
P33Mpopcornmix
authored andcommitted
mmc: sdhci: extend maximum ADMA transfer length to 4MiB
This gains about 8-12% sequential write speed with the fastest SD/eMMC cards, and Class A1/A2 card sequential performance is only assured with a 4MiB write length. Signed-off-by: Jonathan Bell <[email protected]>
1 parent 2714b19 commit 2a92ed4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ static void sdhci_initialize_data(struct sdhci_host *host,
10811081
WARN_ON(host->data);
10821082

10831083
/* Sanity checks */
1084-
BUG_ON(data->blksz * data->blocks > 524288);
1084+
BUG_ON(data->blksz * data->blocks > host->mmc->max_req_size);
10851085
BUG_ON(data->blksz > host->mmc->max_blk_size);
10861086
BUG_ON(data->blocks > 65535);
10871087

@@ -4728,11 +4728,16 @@ int sdhci_setup_host(struct sdhci_host *host)
47284728
spin_lock_init(&host->lock);
47294729

47304730
/*
4731-
* Maximum number of sectors in one transfer. Limited by SDMA boundary
4732-
* size (512KiB). Note some tuning modes impose a 4MiB limit, but this
4733-
* is less anyway.
4731+
* Maximum number of sectors in one transfer.
4732+
* 4MiB is preferred for multi-descriptor DMA as a) card sequential
4733+
* write speeds are only guaranteed with a 4MiB write length and
4734+
* b) most tuning modes require a 4MiB limit.
4735+
* SDMA has a 512KiB boundary size.
47344736
*/
4735-
mmc->max_req_size = 524288;
4737+
if (host->flags & SDHCI_USE_ADMA)
4738+
mmc->max_req_size = SZ_4M;
4739+
else
4740+
mmc->max_req_size = SZ_512K;
47364741

47374742
/*
47384743
* Maximum number of segments. Depends on if the hardware

0 commit comments

Comments
 (0)