mmc: core: hpi in TRAN state error handling

There could be a race condition in the stop transmission request.
1. Urgent read request comes in.
2. Stop the ongoing write request by calling stop_request MMC host op.
3. Send the stop command (CMD12) to move the card from the receive state
   to programming state.
4. Send the status command (CMD13) to know if the card is in programming
   state or not. If yes, then go to step.5 or else go to step.6.
5. Send the HPI command to bring the card out of programming state.
6. Now send the urgent read request.

In above sequence in step.4, we check if the card is in programming or
not and if it is then we go ahead and send the HPI in step.5 but what if
after step.4 is completed and before the step.5, card moves out of the
programming state so in that case HPI command would timeout as we are
sending it in the wrong state. In that case no command response (by eMMC
protocol) causes mmc_send_hpi_cmd to fail (with -ETIMEOUT error).  In
case the card indeed in TRAN state, no error is reported.

Change-Id: Ia6f81f6cc4ec933f2e8423029f7236401aea04df
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
This commit is contained in:
Konstantin Dorfman 2013-07-04 14:06:18 +03:00 committed by Subhash Jadavani
parent aaa56f8a93
commit 392f2d1389
2 changed files with 1 additions and 3 deletions

View file

@ -718,8 +718,6 @@ int mmc_interrupt_hpi(struct mmc_card *card)
} }
err = mmc_send_hpi_cmd(card, &status); err = mmc_send_hpi_cmd(card, &status);
if (err)
goto out;
prg_wait = jiffies + msecs_to_jiffies(card->ext_csd.out_of_int_time); prg_wait = jiffies + msecs_to_jiffies(card->ext_csd.out_of_int_time);
do { do {

View file

@ -779,7 +779,7 @@ int mmc_send_hpi_cmd(struct mmc_card *card, u32 *status)
err = mmc_wait_for_cmd(card->host, &cmd, 0); err = mmc_wait_for_cmd(card->host, &cmd, 0);
if (err) { if (err) {
pr_warn("%s: error %d interrupting operation. " pr_debug("%s: error %d interrupting operation. "
"HPI command response %#x\n", mmc_hostname(card->host), "HPI command response %#x\n", mmc_hostname(card->host),
err, cmd.resp[0]); err, cmd.resp[0]);
return err; return err;