diff mbox series

[11/13] mmc: mmci: mmci_card_busy() from state machine

Message ID 20230405-pl180-busydetect-fix-v1-11-28ac19a74e5e@linaro.org (mailing list archive)
State New, archived
Headers show
Series Fix busydetect on Ux500 PL180/MMCI | expand

Commit Message

Linus Walleij April 5, 2023, 6:50 a.m. UTC
If we have a .busy_complete() callback, then the state
machine triggered from the busy detect interrupts will
determine if the busy is complete or not.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mmc/host/mmci.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 92a49726cf83..2779d4985b63 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -339,6 +339,14 @@  static int mmci_card_busy(struct mmc_host *mmc)
 	unsigned long flags;
 	int busy = 0;
 
+	if (host->ops->busy_complete) {
+		if ((host->busy_state == MMCI_BUSY_IDLE) ||
+		    (host->busy_state == MMCI_BUSY_DONE))
+			return 0;
+		else
+			return 1;
+	}
+
 	spin_lock_irqsave(&host->lock, flags);
 	if (readl(host->base + MMCISTATUS) & host->variant->busy_detect_flag)
 		busy = 1;