Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b78d6c5f authored by Yusuke Goda's avatar Yusuke Goda Committed by Linus Torvalds
Browse files

tmio_mmc: don't clear unhandled pending interrupts



Previously, it was possible for ack_mmc_irqs() to clear pending interrupt
bits in the CTL_STATUS register, even though the interrupt handler had not
been called.  This was because of a race that existed when doing a
read-modify-write sequence on CTL_STATUS.  After the read step in this
sequence, if an interrupt occurred (causing one of the bits in CTL_STATUS
to be set) the write step would inadvertently clear it.

Observed with the TMIO_STAT_RXRDY bit together with CMD53 on AR6002 and
BCM4318 SDIO cards in polled mode.

This patch eliminates this race by only writing to CTL_STATUS and clearing
the interrupts that were passed as an argument to ack_mmc_irqs()."

[matt@console-pimps.org: rewrote changelog]
Signed-off-by: default avatarYusuke Goda <yusuke.goda.sx@renesas.com>
Acked-by: default avatarMagnus Damm <damm@opensource.se&gt;">
Tested-by: default avatarArnd Hannemann <arnd@arndnet.de&gt;">
Acked-by: default avatarIan Molton <ian@mnementh.co.uk>
Cc: Matt Fleming <matt@console-pimps.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: <linux-mmc@vger.kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 31583bb0
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -82,10 +82,7 @@

#define ack_mmc_irqs(host, i) \
	do { \
		u32 mask;\
		mask  = sd_ctrl_read32((host), CTL_STATUS); \
		mask &= ~((i) & TMIO_MASK_IRQ); \
		sd_ctrl_write32((host), CTL_STATUS, mask); \
		sd_ctrl_write32((host), CTL_STATUS, ~(i)); \
	} while (0)