All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: "linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: RE: [PATCH] mmc: renesas_sdhi: fix regression with hard reset on old SDHIs
Date: Wed, 6 Oct 2021 12:45:32 +0000	[thread overview]
Message-ID: <OS0PR01MB59224A73CA29E3D07CD2F0C486B09@OS0PR01MB5922.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <OS0PR01MB5922BA32F4FB02E3390781DD86AF9@OS0PR01MB5922.jpnprd01.prod.outlook.com>

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@sang-engineering.com>; linux-
> mmc@vger.kernel.org
> Cc: linux-renesas-soc@vger.kernel.org; Geert Uytterhoeven
> <geert+renesas@glider.be>; Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com>; Geert Uytterhoeven
> <geert+renesas@glider.be>
> 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@sang-engineering.com>
> > Sent: 26 August 2021 09:21
> > To: linux-mmc@vger.kernel.org
> > Cc: linux-renesas-soc@vger.kernel.org; Geert Uytterhoeven
> > <geert+renesas@glider.be>; Yoshihiro Shimoda
> > <yoshihiro.shimoda.uh@renesas.com>; 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@sang-engineering.com>
> > ---
> >
> > 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


  reply	other threads:[~2021-10-06 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26  8:21 [PATCH] mmc: renesas_sdhi: fix regression with hard reset on old SDHIs Wolfram Sang
2021-08-26 14:25 ` Geert Uytterhoeven
2021-08-26 14:31   ` Wolfram Sang
2021-09-06 17:09     ` Ulf Hansson
2021-09-09 12:56       ` Wolfram Sang
2021-09-27  7:57       ` Wolfram Sang
2021-09-27 11:55         ` Ulf Hansson
2021-09-27 12:02           ` Wolfram Sang
2021-08-26 16:34   ` Wolfram Sang
2021-09-09  9:33   ` Geert Uytterhoeven
2021-09-09 12:55     ` Wolfram Sang
2021-10-05 17:02 ` Biju Das
2021-10-06 12:45   ` Biju Das [this message]
2021-10-06 12:53     ` Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OS0PR01MB59224A73CA29E3D07CD2F0C486B09@OS0PR01MB5922.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.