Skip to contentSkip to conversation

dw_mmc: checking card busy with Status register

RFC PATCH In review Jaehoon Chung 2 participants 2 messages Mar 25, 2011

Subsystems (2)
lore
Share & tools
lore

Jaehoon Chung

author maintainer
#0 lore raw

cover dw_mmc: checking card busy with Status register

This RFC patch is applied checking card busy with status register.

In Status register, bit[9] indicate the card busy or not.
So, if we use this bit in status register, we can check the card busy or not.

Maybe, didn't increased the performance, but i think this approach is decreased the CPU usage.

Anyone, let me know how think about this patch.

---
 drivers/mmc/host/dw_mmc.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/mmc/host/dw_mmc.c +17 -0
index 87e1f57..882d004 100644
@@ -647,9 +647,26 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 {
 	struct dw_mci_slot *slot = mmc_priv(mmc);
 	struct dw_mci *host = slot->host;
+	unsigned int timeout = 0x100;
 
 	WARN_ON(slot->mrq);
 
+	while (timeout) {
+		if ((mrq->data && (mrq->data->flags == MMC_DATA_READ)) ||
+			!(mci_readl(host, STATUS) & (1 << 9)))
+			break;
+
+		if (timeout == 0) {
+			dev_err(&host->pdev->dev, "Card is busy!!\n");
+			return;
+		}
+
+		if (!need_resched())
+			usleep_range(10, 50);
+
+		timeout--;
+	}
+
 	if (!test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) {
 		mrq->cmd->error = -ENOMEDIUM;
 		mmc_request_done(mmc, mrq);
#1 lore raw
Quoted 9 lines · Jaehoon Chung

This RFC patch is applied checking card busy with status register.

In Status register, bit[9] indicate the card busy or not.
So, if we use this bit in status register, we can check the card busy or not.

Maybe, didn't increased the performance, but i think this approach is decreased the CPU usage.

Anyone, let me know how think about this patch.

Do you have any numbers to report how this patch altered CPU usage or card throughput for you? e.g. oprofile output or dd performance