mmc: dw_mmc-rockchip: use a tighter per-command tuning timeout

dw_mmc-rockchip's execute_tuning() scans the tuning window phase by phase
through mmc_send_tuning(), which applied the whole-sequence 150 ms
bound as the data timeout of every single CMD19/CMD21.  With HS200
eMMC the TMOUT register saturates at ~112 ms for the requested
150 ms, so every phase that misses the window stalls that long, and
multi-second boot slowdowns have been reported[1].

Use 5 ms per tuning command via mmc_send_tuning_timeout() instead:
~1.3x the spec-implied per-execution device budget (150 ms / 40 =
3.75 ms, excluding host overhead), 30x below the 150 ms ceiling, and
the reporter verified that tuning keeps passing with it.  A wrong
sampling phase normally fails fast with a CRC error anyway, so the
timeout only catches devices which never return the tuning block at
all.  This also bounds the cost of runtime re-tuning.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=221781 [1]
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
This commit is contained in:
Shawn Lin 2026-09-24 16:50:23 +08:00 committed by Ulf Hansson
parent ccf7f7a9a4
commit 8761866e5a

View File

@ -327,7 +327,7 @@ static int dw_mci_rk3288_execute_tuning(struct dw_mci *host, u32 opcode)
i,
priv->num_phases));
v = !mmc_send_tuning(mmc, opcode, NULL);
v = !mmc_send_tuning_timeout(mmc, opcode, NULL, 5);
if (i == 0)
first_v = v;