From: Peter Suti <peter.suti@streamunlimited.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Peter Suti <peter.suti@streamunlimited.com>,
linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: [PATCH v3] mmc: meson-gx: fix SDIO interrupt handling
Date: Wed, 14 Dec 2022 14:46:21 +0100 [thread overview]
Message-ID: <20221214134620.3028726-1-peter.suti@streamunlimited.com> (raw)
In-Reply-To: <52861a84-0fe2-37f0-d66a-145f2ebe1d79@gmail.com>
With the interrupt support introduced in commit 066ecde sometimes the
Marvell-8987 wifi chip got stuck using the marvell-sd-uapsta-8987
vendor driver. The cause seems to be that after sending ack to all interrupts
the IRQ_SDIO still happens, but it is ignored.
To work around this, recheck the IRQ_SDIO after meson_mmc_request_done().
Inspired by 9e2582e ("mmc: mediatek: fix SDIO irq issue") which used a
similar fix to handle lost interrupts.
Fixes: 066ecde ("mmc: meson-gx: add SDIO interrupt support")
Signed-off-by: Peter Suti <peter.suti@streamunlimited.com>
---
Changes in v2:
- use spin_lock instead of spin_lock_irqsave
- only reenable interrupts if they were enabled already
Changes in v3:
- Rework the patch based on feedback from Heiner Kallweit.
The IRQ does not happen on 2 CPUs and the hard IRQ is not re-entrant.
But still one SDIO IRQ is lost without this change.
After the ack, reading the SD_EMMC_STATUS BIT(15) is set, but
meson_mmc_irq() is never called again.
The fix is similar to Mediatek msdc_recheck_sdio_irq().
That platform also loses an IRQ in some cases it seems.
drivers/mmc/host/meson-gx-mmc.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 6e5ea0213b47..7d3ee2f9a7f6 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1023,6 +1023,22 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
if (ret == IRQ_HANDLED)
meson_mmc_request_done(host->mmc, cmd->mrq);
+ /*
+ * Sometimes after we ack all raised interrupts,
+ * an IRQ_SDIO can still be pending, which can get lost.
+ *
+ * To prevent this, recheck the IRQ_SDIO here and schedule
+ * it to be processed.
+ */
+ raw_status = readl(host->regs + SD_EMMC_STATUS);
+ status = raw_status & (IRQ_EN_MASK | IRQ_SDIO);
+ if (status & IRQ_SDIO) {
+ spin_lock(&host->lock);
+ __meson_mmc_enable_sdio_irq(host->mmc, 0);
+ sdio_signal_irq(host->mmc);
+ spin_unlock(&host->lock);
+ }
+
return ret;
}
--
2.25.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-12-14 13:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-14 9:38 [PATCH] mmc: meson-gx: fix SDIO interrupt handling Peter Suti
2022-11-14 21:33 ` Heiner Kallweit
2022-11-16 16:13 ` Ulf Hansson
2022-11-22 13:23 ` [PATCH v2] " Peter Suti
2022-11-22 15:19 ` Ulf Hansson
2022-11-22 21:41 ` Heiner Kallweit
2022-12-14 13:46 ` Peter Suti [this message]
2022-12-14 21:33 ` [PATCH v3] " Heiner Kallweit
2023-01-09 11:52 ` Peter Suti
2023-01-12 21:27 ` Heiner Kallweit
2023-01-18 13:32 ` Peter Suti
2023-01-19 7:53 ` Heiner Kallweit
2023-01-19 19:37 ` Heiner Kallweit
2023-01-24 7:29 ` Peter Suti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221214134620.3028726-1-peter.suti@streamunlimited.com \
--to=peter.suti@streamunlimited.com \
--cc=hkallweit1@gmail.com \
--cc=jbrunet@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=matthias.bgg@gmail.com \
--cc=neil.armstrong@linaro.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox