68702978e8a92cbd92d5ee6d0aea09421f3a60a3
[openwrt/staging/neocturne.git] /
1 From 2862884dd5281299433d641c00d419640bb03d7f Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Tue, 4 Jun 2024 13:45:37 +0100
4 Subject: [PATCH 1116/1135] mmc: sdhci: extend maximum ADMA transfer length to
5 4MiB
6
7 This gains about 8-12% sequential write speed with the fastest SD/eMMC
8 cards, and Class A1/A2 card sequential performance is only assured with
9 a 4MiB write length.
10
11 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
12 ---
13 drivers/mmc/host/sdhci.c | 15 ++++++++++-----
14 1 file changed, 10 insertions(+), 5 deletions(-)
15
16 --- a/drivers/mmc/host/sdhci.c
17 +++ b/drivers/mmc/host/sdhci.c
18 @@ -1081,7 +1081,7 @@ static void sdhci_initialize_data(struct
19 WARN_ON(host->data);
20
21 /* Sanity checks */
22 - BUG_ON(data->blksz * data->blocks > 524288);
23 + BUG_ON(data->blksz * data->blocks > host->mmc->max_req_size);
24 BUG_ON(data->blksz > host->mmc->max_blk_size);
25 BUG_ON(data->blocks > 65535);
26
27 @@ -4718,11 +4718,16 @@ int sdhci_setup_host(struct sdhci_host *
28 spin_lock_init(&host->lock);
29
30 /*
31 - * Maximum number of sectors in one transfer. Limited by SDMA boundary
32 - * size (512KiB). Note some tuning modes impose a 4MiB limit, but this
33 - * is less anyway.
34 + * Maximum number of sectors in one transfer.
35 + * 4MiB is preferred for multi-descriptor DMA as a) card sequential
36 + * write speeds are only guaranteed with a 4MiB write length and
37 + * b) most tuning modes require a 4MiB limit.
38 + * SDMA has a 512KiB boundary size.
39 */
40 - mmc->max_req_size = 524288;
41 + if (host->flags & SDHCI_USE_ADMA)
42 + mmc->max_req_size = SZ_4M;
43 + else
44 + mmc->max_req_size = SZ_512K;
45
46 /*
47 * Maximum number of segments. Depends on if the hardware