difos/target/linux/bcm27xx/patches-6.12/950-0439-drivers-mmc-core-handle-card-removal-when-running-CQ.patch
Álvaro Fernández Rojas 8f9e91ad03 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-05-21 11:32:18 +02:00

43 lines
1.4 KiB
Diff

From 62640cd5ffe0cc3986c24faa1f8b92d848bab4e4 Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Thu, 13 Jun 2024 15:05:40 +0100
Subject: [PATCH] drivers: mmc: core: handle card-removal when running CQE
recovery
Recovery claims the MMC card so the card-detect work gets significantly
delayed - leading to lots of error recovery loops that can never do
anything but fail.
Explicitly detect the card after CQE has halted and bail if it's not
there.
Also ratelimit a not-very-descriptive warning - one occurrence in dmesg
is enough to signal that something is amiss.
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
---
drivers/mmc/core/core.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -543,10 +543,18 @@ int mmc_cqe_recovery(struct mmc_host *ho
* Recovery is expected seldom, if at all, but it reduces performance,
* so make sure it is not completely silent.
*/
- pr_warn("%s: running CQE recovery\n", mmc_hostname(host));
+ pr_warn_ratelimited("%s: running CQE recovery\n", mmc_hostname(host));
host->cqe_ops->cqe_recovery_start(host);
+ err = mmc_detect_card_removed(host);
+ if (err) {
+ host->cqe_ops->cqe_recovery_finish(host);
+ host->cqe_ops->cqe_off(host);
+ mmc_retune_release(host);
+ return err;
+ }
+
memset(&cmd, 0, sizeof(cmd));
cmd.opcode = MMC_STOP_TRANSMISSION;
cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;