Skip to content

Commit e5fe281

Browse files
TobleMinerSasha Levin
authored andcommitted
mmc: atmel-mci: fix race between stop command and start of next command
[ Upstream commit eca5bd6 ] 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 <t.schramm@manjaro.org> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20221230194315.809903-2-t.schramm@manjaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 52aca27 commit e5fe281

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

drivers/mmc/host/atmel-mci.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,6 @@ static void atmci_tasklet_func(unsigned long priv)
18571857
atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY);
18581858
state = STATE_WAITING_NOTBUSY;
18591859
} else if (host->mrq->stop) {
1860-
atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY);
18611860
atmci_send_stop_cmd(host, data);
18621861
state = STATE_SENDING_STOP;
18631862
} else {
@@ -1890,8 +1889,6 @@ static void atmci_tasklet_func(unsigned long priv)
18901889
* command to send.
18911890
*/
18921891
if (host->mrq->stop) {
1893-
atmci_writel(host, ATMCI_IER,
1894-
ATMCI_CMDRDY);
18951892
atmci_send_stop_cmd(host, data);
18961893
state = STATE_SENDING_STOP;
18971894
} else {

0 commit comments

Comments
 (0)