Re: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with hard reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 6 Oct 2021 at 19:16, Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote:
>
>
> This patch fixes internal cd irq miss after hard reset by enabling
> internal card insertion/removal interrupts.
>
> Fixes: b4d86f37eacb ("mmc: renesas_sdhi: do hard reset if possible")
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>

Wolfram, would you mind having a look at this?

Kind regards
Uffe

> ---
> Hi All,
>
> On RZ/G2M board, if i enable internal cd, then it is missing irq after hard reset.
> Please find my test logs with card inserted during boot,
>
> case 1:- current case (no internal cd interrupt)
> root@hihope-rzg2m:~# cat /proc/interrupts | grep mmc
> 162:          0          0          0          0          0          0     GIC-0 197 Level     ee100000.mmc
> 163:        151          0          0          0          0          0     GIC-0 199 Level     ee140000.mmc
> 164:       1500          0          0          0          0          0     GIC-0 200 Level     ee160000.mmc
> root@hihope-rzg2m:~#
>
>
> case 2:- current case + patch
> root@hihope-rzg2m:~# cat /proc/interrupts | grep mmc
> 162:       1107          0          0          0          0          0     GIC-0 197 Level     ee100000.mmc
> 163:        151          0          0          0          0          0     GIC-0 199 Level     ee140000.mmc
> 164:       1106          0          0          0          0          0     GIC-0 200 Level     ee160000.mmc
> root@hihope-rzg2m:~#
>
> case 3:- with cd nterrupt as gpio
> root@hihope-rzg2m:~# cat /proc/interrupts | grep mmc
> 162:        796          0          0          0          0          0     GIC-0 197 Level     ee100000.mmc
> 163:        151          0          0          0          0          0     GIC-0 199 Level     ee140000.mmc
> 164:       1010          0          0          0          0          0     GIC-0 200 Level     ee160000.mmc
> 197:          0          0          0          0          0          0  gpio-rcar  12 Edge      ee100000.mmc cd
> root@hihope-rzg2m:~#
> ---
>  drivers/mmc/host/renesas_sdhi.h      | 1 +
>  drivers/mmc/host/renesas_sdhi_core.c | 9 +++++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
> index 0c45e82ff0de..1199693690da 100644
> --- a/drivers/mmc/host/renesas_sdhi.h
> +++ b/drivers/mmc/host/renesas_sdhi.h
> @@ -68,6 +68,7 @@ struct renesas_sdhi {
>         u32 scc_tappos_hs400;
>         const u8 *adjust_hs400_calib_table;
>         bool needs_adjust_hs400;
> +       bool internal_cd;
>
>         /* Tuning values: 1 for success, 0 for failure */
>         DECLARE_BITMAP(taps, BITS_PER_LONG);
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index a4407f391f66..9d828094169a 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -561,6 +561,11 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host)
>                 /* Unknown why but without polling reset status, it will hang */
>                 read_poll_timeout(reset_control_status, ret, ret == 0, 1, 100,
>                                   false, priv->rstc);
> +
> +               if (priv->internal_cd)
> +                       tmio_mmc_enable_mmc_irqs(host, TMIO_STAT_CARD_REMOVE |
> +                                                TMIO_STAT_CARD_INSERT);
> +
>                 /* At least SDHI_VER_GEN2_SDR50 needs manual release of reset */
>                 sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
>                 priv->needs_adjust_hs400 = false;
> @@ -1017,6 +1022,10 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>         if (IS_ERR(priv->rstc))
>                 return PTR_ERR(priv->rstc);
>
> +       if (priv->rstc && !(host->mmc->caps & MMC_CAP_NONREMOVABLE) &&
> +           !mmc_can_gpio_cd(host->mmc))
> +               priv->internal_cd = true;
> +
>         ver = sd_ctrl_read16(host, CTL_VERSION);
>         /* GEN2_SDR104 is first known SDHI to use 32bit block count */
>         if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
> --
> 2.17.1
>



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux