lede/target/linux/bcm27xx/patches-6.12/950-0437-mmc-sdhci-extend-maximum-ADMA-transfer-length-to-4Mi.patch
=?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= d81c03f05e bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-06-20 17:01:06 +08:00

47 lines
1.6 KiB
Diff

From c0b9523ee9a6c3f2cc42529f18b33b0606413abc Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Tue, 4 Jun 2024 13:45:37 +0100
Subject: [PATCH] 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 <jonathan@raspberrypi.com>
---
drivers/mmc/host/sdhci.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1081,7 +1081,7 @@ static void sdhci_initialize_data(struct
WARN_ON(host->data);
/* Sanity checks */
- BUG_ON(data->blksz * data->blocks > 524288);
+ BUG_ON(data->blksz * data->blocks > host->mmc->max_req_size);
BUG_ON(data->blksz > host->mmc->max_blk_size);
BUG_ON(data->blocks > 65535);
@@ -4714,11 +4714,16 @@ int sdhci_setup_host(struct sdhci_host *
spin_lock_init(&host->lock);
/*
- * Maximum number of sectors in one transfer. Limited by SDMA boundary
- * size (512KiB). Note some tuning modes impose a 4MiB limit, but this
- * is less anyway.
+ * Maximum number of sectors in one transfer.
+ * 4MiB is preferred for multi-descriptor DMA as a) card sequential
+ * write speeds are only guaranteed with a 4MiB write length and
+ * b) most tuning modes require a 4MiB limit.
+ * SDMA has a 512KiB boundary size.
*/
- mmc->max_req_size = 524288;
+ if (host->flags & SDHCI_USE_ADMA)
+ mmc->max_req_size = SZ_4M;
+ else
+ mmc->max_req_size = SZ_512K;
/*
* Maximum number of segments. Depends on if the hardware