mmc: msm_sdcc: reset wait_for_auto_prog_done flag in case of an error

"wait_for_auto_prog_done" flag is set when CMD53, single block write
(CMD24) or pre-defined (prefixed with CMD23) multi block write
(CMD25) need to be sent to card. This flag tells the
msmsdcc_start_data() to set the AUTO_PROG_DONE bit in MCI_DATA_CTL
register. If AUTO_PROG_DONE bit is set, SDCC controller will raise
the PROG_DONE at the end of above mentioned write transfers
(command + data) and "wait_for_auto_prog_done" gets cleared at
the end of transfer.

But if we get the error during the command transfer phase itself,
there is a chance that "wait_for_auto_prog_done" remains set which
means it remains sticky during next SDCC transfer request as well.
And if next data transfer is data read operation, having this
"wait_for_auto_prog_done" flag set will not allow the transfer to
end which may cause SDCC driver to raise request timeout.

Following is one such error condition:
<6>[  667.001892] mmc1: CMD6: Request timeout
<6>[  667.004700] mmc1: SDCC PWR is ON
<6>[  667.007904] mmc1: SDCC clks are ON, MCLK rate=400000
<6>[  667.012848] mmc1: SDCC irq is enabled
<6>[  667.067633] mmc1: SPS mode: busy=0
<6>[  667.071020] mmc1: xfer_size=64, data_xfered=64, xfer_remain=0
<6>[  667.076758] mmc1: got_dataend=1, prog_enable=0,
			wait_for_auto_prog_done=1, got_auto_prog_done=0

This patch ensures that "wait_for_auto_prog_done" gets cleared even when
error is seen during command transfer phase itself.

CRs-fixed: 342901
Change-Id: I27f635775ca488826fb46995784b544772fd8e16
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
1 file changed