Skip to content

Commit 6ea6b95

Browse files
hkallweitstorulf
authored andcommitted
mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set
Some SDIO WiFi modules stopped working after SDIO interrupt mode was added if cap_sdio_irq isn't set in device tree. This patch was confirmed to fix the issue. Fixes: 066ecde ("mmc: meson-gx: add SDIO interrupt support") Reported-by: Geraldo Nascimento <[email protected]> Tested-by: Geraldo Nascimento <[email protected]> Cc: [email protected] Signed-off-by: Heiner Kallweit <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 2241ab5 commit 6ea6b95

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

drivers/mmc/host/meson-gx-mmc.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,8 @@ static int meson_mmc_clk_init(struct meson_host *host)
435435
clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180);
436436
clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0);
437437
clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0);
438-
clk_reg |= CLK_IRQ_SDIO_SLEEP(host);
438+
if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
439+
clk_reg |= CLK_IRQ_SDIO_SLEEP(host);
439440
writel(clk_reg, host->regs + SD_EMMC_CLOCK);
440441

441442
/* get the mux parents */
@@ -948,16 +949,18 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
948949
{
949950
struct meson_host *host = dev_id;
950951
struct mmc_command *cmd;
951-
u32 status, raw_status;
952+
u32 status, raw_status, irq_mask = IRQ_EN_MASK;
952953
irqreturn_t ret = IRQ_NONE;
953954

955+
if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
956+
irq_mask |= IRQ_SDIO;
954957
raw_status = readl(host->regs + SD_EMMC_STATUS);
955-
status = raw_status & (IRQ_EN_MASK | IRQ_SDIO);
958+
status = raw_status & irq_mask;
956959

957960
if (!status) {
958961
dev_dbg(host->dev,
959-
"Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n",
960-
IRQ_EN_MASK | IRQ_SDIO, raw_status);
962+
"Unexpected IRQ! irq_en 0x%08x - status 0x%08x\n",
963+
irq_mask, raw_status);
961964
return IRQ_NONE;
962965
}
963966

@@ -1204,6 +1207,11 @@ static int meson_mmc_probe(struct platform_device *pdev)
12041207
goto free_host;
12051208
}
12061209

1210+
mmc->caps |= MMC_CAP_CMD23;
1211+
1212+
if (mmc->caps & MMC_CAP_SDIO_IRQ)
1213+
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
1214+
12071215
host->data = (struct meson_mmc_data *)
12081216
of_device_get_match_data(&pdev->dev);
12091217
if (!host->data) {
@@ -1277,11 +1285,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
12771285

12781286
spin_lock_init(&host->lock);
12791287

1280-
mmc->caps |= MMC_CAP_CMD23;
1281-
1282-
if (mmc->caps & MMC_CAP_SDIO_IRQ)
1283-
mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
1284-
12851288
if (host->dram_access_quirk) {
12861289
/* Limit segments to 1 due to low available sram memory */
12871290
mmc->max_segs = 1;

0 commit comments

Comments
 (0)