Skip to content

Commit 27d2f9b

Browse files
TobleMinerAlone0316
authored andcommitted
mmc: atmel-mci: fix race between stop command and start of next command
[ Upstream commit eca5bd666b0aa7dc0bca63292e4778968241134e ] This commit fixes a race between completion of stop command and start of a new command. Previously the command ready interrupt was enabled before stop command was written to the command register. This caused the command ready interrupt to fire immediately since the CMDRDY flag is asserted constantly while there is no command in progress. Consequently the command state machine will immediately advance to the next state when the tasklet function is executed again, no matter actual completion state of the stop command. Thus a new command can then be dispatched immediately, interrupting and corrupting the stop command on the CMD line. Fix that by dropping the command ready interrupt enable before calling atmci_send_stop_cmd. atmci_send_stop_cmd does already enable the command ready interrupt, no further writes to ATMCI_IER are necessary. Signed-off-by: Tobias Schramm <[email protected]> Acked-by: Ludovic Desroches <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent a3169b5 commit 27d2f9b

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

drivers/mmc/host/atmel-mci.c

-3
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,6 @@ static void atmci_tasklet_func(unsigned long priv)
18871887
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
18881888
state = STATE_WAITING_NOTBUSY;
18891889
} else if (host->mrq->stop) {
1890-
atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY);
18911890
atmci_send_stop_cmd(host, data);
18921891
state = STATE_SENDING_STOP;
18931892
} else {
@@ -1920,8 +1919,6 @@ static void atmci_tasklet_func(unsigned long priv)
19201919
* command to send.
19211920
*/
19221921
if (host->mrq->stop) {
1923-
atmci_writel(host, ATMCI_IER,
1924-
ATMCI_CMDRDY);
19251922
atmci_send_stop_cmd(host, data);
19261923
state = STATE_SENDING_STOP;
19271924
} else {

0 commit comments

Comments
 (0)