RE: [PATCH] mmc: renesas_sdhi: fix regression with hard reset on old SDHIs

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

 



Hi All,

I have reproduced this issue on RZ/G2M pin by configuring cd using SDHI instead of gpio irq. 
After applying the patch card detection/removal works as expected.

Looks like the issue is present on R-Car Gen3 boards with cd as pin(ie, card detection/removal using SDHI IRQ).
I will post a patch to fixing this issue.

Please find the logs

With IRQ fix on reset function
-----------------------------------
    3.090956] renesas_sdhi_internal_dmac ee100000.mmc: mmc1 base at 0x00000000ee100000, max clock rate 200 MHz
[    4.855266] mmc1: new ultra high speed SDR104 SDHC card at address aaaa
[    4.865396] mmcblk1: mmc1:aaaa SP32G 29.7 GiB
[    4.885474]  mmcblk1: p1


root@hihope-rzg2m:~# [   60.220648] mmc1: card aaaa removed
[   61.613520] mmc1: new ultra high speed SDR104 SDHC card at address aaaa
[   61.626103] mmcblk1: mmc1:aaaa SP32G 29.7 GiB
[   61.647925]  mmcblk1: p1

root@hihope-rzg2m:~# cat /proc/interrupts | grep ee100000.mmc
162:       2158          0          0          0          0          0     GIC-0 197 Level     ee100000.mmc


without IRQ fix.
-----------------

renesas_sdhi_internal_dmac ee140000.mmc: mmc2 base at 0x00000000ee140000, max clock rate 200 MHz

But there is no card detection during boot.
it is not detecting card removal/removal at all

root@hihope-rzg2m:~# cat /proc/interrupts | grep ee100000.mmc
162:          0          0          0          0          0          0     GIC-0 197 Level     ee100000.mmc
root@hihope-rzg2m:~#


regards,
Biju



> -----Original Message-----
> From: Biju Das
> Sent: 05 October 2021 18:03
> To: 'Wolfram Sang' <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>; linux-
> mmc@xxxxxxxxxxxxxxx
> Cc: linux-renesas-soc@xxxxxxxxxxxxxxx; Geert Uytterhoeven
> <geert+renesas@xxxxxxxxx>; Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@xxxxxxxxxxx>; Geert Uytterhoeven
> <geert+renesas@xxxxxxxxx>
> Subject: RE: [PATCH] mmc: renesas_sdhi: fix regression with hard reset on
> old SDHIs
> 
> Hi Wolfram,
> 
> On my RZ/G2L board, if I configure card detection irq from SDHI, instead
> of card detection using gpio interrupt, then it is missing card detection
> interrupt after reset.
> 
> Just wondering, does it work on R-Car with CD irq from SDHI instead of
> card detection using gpio interrupt?
> 
> With the below changes, I am getting cd interrupts from SDHI after reset.
> 
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c
> b/drivers/mmc/host/renesas_sdhi_core.c
> index a4407f391f66..32f34de1a2a6 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -561,6 +561,8 @@ 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);
> +
> +               tmio_mmc_enable_mmc_irqs(host, TMIO_MASK_CMD);
>                 /* At least SDHI_VER_GEN2_SDR50 needs manual release of
> reset */
> 
> 
> Regards,
> Biju
> 
> 
> > -----Original Message-----
> > From: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> > Sent: 26 August 2021 09:21
> > To: linux-mmc@xxxxxxxxxxxxxxx
> > Cc: linux-renesas-soc@xxxxxxxxxxxxxxx; Geert Uytterhoeven
> > <geert+renesas@xxxxxxxxx>; Yoshihiro Shimoda
> > <yoshihiro.shimoda.uh@xxxxxxxxxxx>; Wolfram Sang <wsa+renesas@sang-
> > engineering.com>
> > Subject: [PATCH] mmc: renesas_sdhi: fix regression with hard reset on
> > old SDHIs
> >
> > Old SDHI instances have a default value for the reset register which
> > keeps it in reset state by default. So, when applying a hard reset we
> > need to manually leave the soft reset state as well. Later SDHI
> > instances have a different default value, the one we write manually now.
> >
> > Fixes: b4d86f37eacb ("mmc: renesas_sdhi: do hard reset if possible")
> > Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
> > ---
> >
> > Geez, typical SDHI nastiness here...
> >
> > Geert: I think this fixes the issue you saw on Koelsch. It works fine
> > on my Lager now at least. Can you please test and tag if all goes well?
> > It would be great to have this in 5.14 but it definately needs Geert's
> > confirmation first.
> >
> >  drivers/mmc/host/renesas_sdhi_core.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/mmc/host/renesas_sdhi_core.c
> > b/drivers/mmc/host/renesas_sdhi_core.c
> > index 6fc4cf3c9dce..a4407f391f66 100644
> > --- a/drivers/mmc/host/renesas_sdhi_core.c
> > +++ b/drivers/mmc/host/renesas_sdhi_core.c
> > @@ -561,6 +561,8 @@ 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);
> > +		/* At least SDHI_VER_GEN2_SDR50 needs manual release of reset
> > */
> > +		sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
> >  		priv->needs_adjust_hs400 = false;
> >  		renesas_sdhi_set_clock(host, host->clk_cache);
> >  	} else if (priv->scc_ctl) {
> > --
> > 2.30.2





[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