[PATCH RESEND v2] mmc: meson-gx: fix SDIO mode if cap_sdio_irq isn't set
Ulf Hansson
ulf.hansson at linaro.org
Mon Feb 13 15:48:08 PST 2023
On Mon, 13 Feb 2023 at 21:55, Heiner Kallweit <hkallweit1 at 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 at gmail.com>
> Tested-by: Geraldo Nascimento <geraldogabriel at gmail.com>
> Cc: stable at vger.kernel.org
> Signed-off-by: Heiner Kallweit <hkallweit1 at 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
>
More information about the linux-amlogic
mailing list