7686472f52d424216c1c1a7538be7b4e643c08d9
[openwrt/staging/pepe2k.git] /
1 From 22b6295e3b0818583bf523d4b14ca7e0308d6861 Mon Sep 17 00:00:00 2001
2 From: Jonathan Bell <jonathan@raspberrypi.com>
3 Date: Thu, 13 Jun 2024 15:05:40 +0100
4 Subject: [PATCH 1134/1135] drivers: mmc: core: handle card-removal when
5 running CQE recovery
6
7 Recovery claims the MMC card so the card-detect work gets significantly
8 delayed - leading to lots of error recovery loops that can never do
9 anything but fail.
10
11 Explicitly detect the card after CQE has halted and bail if it's not
12 there.
13
14 Also ratelimit a not-very-descriptive warning - one occurrence in dmesg
15 is enough to signal that something is amiss.
16
17 Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
18 ---
19 drivers/mmc/core/core.c | 10 +++++++++-
20 1 file changed, 9 insertions(+), 1 deletion(-)
21
22 --- a/drivers/mmc/core/core.c
23 +++ b/drivers/mmc/core/core.c
24 @@ -543,10 +543,18 @@ int mmc_cqe_recovery(struct mmc_host *ho
25 * Recovery is expected seldom, if at all, but it reduces performance,
26 * so make sure it is not completely silent.
27 */
28 - pr_warn("%s: running CQE recovery\n", mmc_hostname(host));
29 + pr_warn_ratelimited("%s: running CQE recovery\n", mmc_hostname(host));
30
31 host->cqe_ops->cqe_recovery_start(host);
32
33 + err = mmc_detect_card_removed(host);
34 + if (err) {
35 + host->cqe_ops->cqe_recovery_finish(host);
36 + host->cqe_ops->cqe_off(host);
37 + mmc_retune_release(host);
38 + return err;
39 + }
40 +
41 memset(&cmd, 0, sizeof(cmd));
42 cmd.opcode = MMC_STOP_TRANSMISSION;
43 cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;