diff mbox series

[RESEND,v2] mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set

Message ID 816cba9f-ff92-31a2-60f0-aca542d1d13e@gmail.com (mailing list archive)
State New, archived
Headers show
Series [RESEND,v2] mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set | expand

Commit Message

Heiner Kallweit Feb. 13, 2023, 8:55 p.m. UTC
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: 066ecde6d826 ("mmc: meson-gx: add SDIO interrupt support")
Reported-by: Geraldo Nascimento <geraldogabriel@gmail.com>
Tested-by: Geraldo Nascimento <geraldogabriel@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- fix printf type issue
---
 drivers/mmc/host/meson-gx-mmc.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

Comments

Ulf Hansson Feb. 13, 2023, 11:48 p.m. UTC | #1
On Mon, 13 Feb 2023 at 21:55, Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> 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: 066ecde6d826 ("mmc: meson-gx: add SDIO interrupt support")
> Reported-by: Geraldo Nascimento <geraldogabriel@gmail.com>
> Tested-by: Geraldo Nascimento <geraldogabriel@gmail.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied for fixes, thanks!

Kind regards
Uffe


> ---
> v2:
> - fix printf type issue
> ---
>  drivers/mmc/host/meson-gx-mmc.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 6e5ea0213..5c94ad466 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -435,7 +435,8 @@ static int meson_mmc_clk_init(struct meson_host *host)
>         clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180);
>         clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0);
>         clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0);
> -       clk_reg |= CLK_IRQ_SDIO_SLEEP(host);
> +       if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
> +               clk_reg |= CLK_IRQ_SDIO_SLEEP(host);
>         writel(clk_reg, host->regs + SD_EMMC_CLOCK);
>
>         /* get the mux parents */
> @@ -948,16 +949,18 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
>  {
>         struct meson_host *host = dev_id;
>         struct mmc_command *cmd;
> -       u32 status, raw_status;
> +       u32 status, raw_status, irq_mask = IRQ_EN_MASK;
>         irqreturn_t ret = IRQ_NONE;
>
> +       if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
> +               irq_mask |= IRQ_SDIO;
>         raw_status = readl(host->regs + SD_EMMC_STATUS);
> -       status = raw_status & (IRQ_EN_MASK | IRQ_SDIO);
> +       status = raw_status & irq_mask;
>
>         if (!status) {
>                 dev_dbg(host->dev,
> -                       "Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n",
> -                        IRQ_EN_MASK | IRQ_SDIO, raw_status);
> +                       "Unexpected IRQ! irq_en 0x%08x - status 0x%08x\n",
> +                        irq_mask, raw_status);
>                 return IRQ_NONE;
>         }
>
> @@ -1204,6 +1207,11 @@ static int meson_mmc_probe(struct platform_device *pdev)
>                 goto free_host;
>         }
>
> +       mmc->caps |= MMC_CAP_CMD23;
> +
> +       if (mmc->caps & MMC_CAP_SDIO_IRQ)
> +               mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
> +
>         host->data = (struct meson_mmc_data *)
>                 of_device_get_match_data(&pdev->dev);
>         if (!host->data) {
> @@ -1277,11 +1285,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
>
>         spin_lock_init(&host->lock);
>
> -       mmc->caps |= MMC_CAP_CMD23;
> -
> -       if (mmc->caps & MMC_CAP_SDIO_IRQ)
> -               mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
> -
>         if (host->dram_access_quirk) {
>                 /* Limit segments to 1 due to low available sram memory */
>                 mmc->max_segs = 1;
> --
> 2.39.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 6e5ea0213..5c94ad466 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -435,7 +435,8 @@  static int meson_mmc_clk_init(struct meson_host *host)
 	clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180);
 	clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, CLK_PHASE_0);
 	clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, CLK_PHASE_0);
-	clk_reg |= CLK_IRQ_SDIO_SLEEP(host);
+	if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
+		clk_reg |= CLK_IRQ_SDIO_SLEEP(host);
 	writel(clk_reg, host->regs + SD_EMMC_CLOCK);
 
 	/* get the mux parents */
@@ -948,16 +949,18 @@  static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 {
 	struct meson_host *host = dev_id;
 	struct mmc_command *cmd;
-	u32 status, raw_status;
+	u32 status, raw_status, irq_mask = IRQ_EN_MASK;
 	irqreturn_t ret = IRQ_NONE;
 
+	if (host->mmc->caps & MMC_CAP_SDIO_IRQ)
+		irq_mask |= IRQ_SDIO;
 	raw_status = readl(host->regs + SD_EMMC_STATUS);
-	status = raw_status & (IRQ_EN_MASK | IRQ_SDIO);
+	status = raw_status & irq_mask;
 
 	if (!status) {
 		dev_dbg(host->dev,
-			"Unexpected IRQ! irq_en 0x%08lx - status 0x%08x\n",
-			 IRQ_EN_MASK | IRQ_SDIO, raw_status);
+			"Unexpected IRQ! irq_en 0x%08x - status 0x%08x\n",
+			 irq_mask, raw_status);
 		return IRQ_NONE;
 	}
 
@@ -1204,6 +1207,11 @@  static int meson_mmc_probe(struct platform_device *pdev)
 		goto free_host;
 	}
 
+	mmc->caps |= MMC_CAP_CMD23;
+
+	if (mmc->caps & MMC_CAP_SDIO_IRQ)
+		mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
+
 	host->data = (struct meson_mmc_data *)
 		of_device_get_match_data(&pdev->dev);
 	if (!host->data) {
@@ -1277,11 +1285,6 @@  static int meson_mmc_probe(struct platform_device *pdev)
 
 	spin_lock_init(&host->lock);
 
-	mmc->caps |= MMC_CAP_CMD23;
-
-	if (mmc->caps & MMC_CAP_SDIO_IRQ)
-		mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD;
-
 	if (host->dram_access_quirk) {
 		/* Limit segments to 1 due to low available sram memory */
 		mmc->max_segs = 1;