[PATCH] mmc: Throttle calls to MMC_SEND_STATUS during mmc_do_erase()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




This drastically reduces the rate at which the MMC_SEND_STATUS cmd polls
for completion of the MMC Erase operation.  On my embedded ARM platform
the interrupt rates drop from ~45000/s to ~1000/s, which prevents the
system from being very sluggish to respond during Erase operations.

Signed-off-by: Martin Hicks <mort@xxxxxxxx>
---
 drivers/mmc/core/core.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index db1bf63..5e37276 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2284,8 +2284,14 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from,
 			goto out;
 		}
 
-	} while (!(cmd.resp[0] & R1_READY_FOR_DATA) ||
-		 (R1_CURRENT_STATE(cmd.resp[0]) == R1_STATE_PRG));
+		if ((cmd.resp[0] & R1_READY_FOR_DATA) &&
+		    R1_CURRENT_STATE(cmd.resp[0]) != R1_STATE_PRG)
+			break;
+
+		/* Throttle the calls to MMC_SEND_STATUS */
+		usleep_range(1000, 2000);
+	} while (1);
+
 out:
 	mmc_retune_release(card->host);
 	return err;
-- 
1.9.1


-- 
Martin Hicks P.Eng.    |      mort@xxxxxxxx
Bork Consulting Inc.   |  +1 (613) 266-2296
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux