Date: Wed, 2 Nov 2016 00:54:39 +0000 (UTC) From: Justin Hibbits <jhibbits@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308187 - head/sys/dev/sdhci Message-ID: <201611020054.uA20sdnK025975@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhibbits Date: Wed Nov 2 00:54:39 2016 New Revision: 308187 URL: https://svnweb.freebsd.org/changeset/base/308187 Log: 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. Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Wed Nov 2 00:51:09 2016 (r308186) +++ head/sys/dev/sdhci/sdhci.c Wed Nov 2 00:54:39 2016 (r308187) @@ -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 *sl /* 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201611020054.uA20sdnK025975>