Toggle card insert/remove interrupt enable bits on events

Some controllers (namely Freescale's eSDHC, tested) will continue to assert
the card removed or card insert interrupts even after being handled.  To work
around this, disable watching the interrupt that just occurred until the
opposite interrupt is triggered.

Linux has a similar change in its driver to address the same problem.
This commit is contained in:
Justin Hibbits 2016-11-02 00:54:39 +00:00
parent 3d9df07abf
commit 2b96b955e9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=308187

View File

@ -1309,7 +1309,7 @@ sdhci_acmd_irq(struct sdhci_slot *slot)
void
sdhci_generic_intr(struct sdhci_slot *slot)
{
uint32_t intmask;
uint32_t intmask, present;
SDHCI_LOCK(slot);
/* Read slot interrupt status. */
@ -1323,6 +1323,13 @@ sdhci_generic_intr(struct sdhci_slot *slot)
/* Handle card presence interrupts. */
if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
present = RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT;
slot->intmask &=
~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE);
slot->intmask |= present ? SDHCI_INT_CARD_REMOVE :
SDHCI_INT_CARD_INSERT;
WR4(slot, SDHCI_INT_ENABLE, slot->intmask);
WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask);
WR4(slot, SDHCI_INT_STATUS, intmask &
(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE));