Message ID | 20211006171605.6861-1-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mmc: renesas_sdhi: Fix internal cd irq miss with hard reset | expand |
On Wed, 6 Oct 2021 at 19:16, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com> 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 >
On Wed, Oct 06, 2021 at 06:16:05PM +0100, Biju Das 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@bp.renesas.com> IIUC, the following should be the apropriate fix. Can you please test it? If it works, then I'll make a proper patch out of it. diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 7dfc26f48c18..9416245a7b56 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -195,6 +195,10 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host) sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask_all); host->sdcard_irq_mask = host->sdcard_irq_mask_all; + if (host->native_hotplug) + tmio_mmc_enable_mmc_irqs(host, + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); + tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width); if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) { @@ -1185,10 +1189,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) _host->set_clock(_host, 0); tmio_mmc_reset(_host); - if (_host->native_hotplug) - tmio_mmc_enable_mmc_irqs(_host, - TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); - spin_lock_init(&_host->lock); mutex_init(&_host->ios_lock);
Hi Wolfram, Thanks for the patch. > -----Original Message----- > From: Wolfram Sang <wsa+renesas@sang-engineering.com> > Sent: 22 October 2021 14:22 > To: Biju Das <biju.das.jz@bp.renesas.com> > Cc: Ulf Hansson <ulf.hansson@linaro.org>; Yoshihiro Shimoda > <yoshihiro.shimoda.uh@renesas.com>; linux-mmc@vger.kernel.org; Geert > Uytterhoeven <geert+renesas@glider.be>; Chris Paterson > <Chris.Paterson2@renesas.com>; Biju Das <biju.das@bp.renesas.com>; > Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>; linux- > renesas-soc@vger.kernel.org > Subject: Re: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with hard > reset > > On Wed, Oct 06, 2021 at 06:16:05PM +0100, Biju Das 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@bp.renesas.com> > > IIUC, the following should be the apropriate fix. Can you please test it? > If it works, then I'll make a proper patch out of it. It is much better. I will test and let you know the results. Regards, Biju > > diff --git a/drivers/mmc/host/tmio_mmc_core.c > b/drivers/mmc/host/tmio_mmc_core.c > index 7dfc26f48c18..9416245a7b56 100644 > --- a/drivers/mmc/host/tmio_mmc_core.c > +++ b/drivers/mmc/host/tmio_mmc_core.c > @@ -195,6 +195,10 @@ static void tmio_mmc_reset(struct tmio_mmc_host > *host) > sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host- > >sdcard_irq_mask_all); > host->sdcard_irq_mask = host->sdcard_irq_mask_all; > > + if (host->native_hotplug) > + tmio_mmc_enable_mmc_irqs(host, > + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > + > tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width); > > if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) { @@ -1185,10 +1189,6 @@ > int tmio_mmc_host_probe(struct tmio_mmc_host *_host) > _host->set_clock(_host, 0); > tmio_mmc_reset(_host); > > - if (_host->native_hotplug) > - tmio_mmc_enable_mmc_irqs(_host, > - TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > - > spin_lock_init(&_host->lock); > mutex_init(&_host->ios_lock); >
Hi Wolfram, > Subject: Re: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with hard > reset > > On Wed, Oct 06, 2021 at 06:16:05PM +0100, Biju Das 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@bp.renesas.com> > > IIUC, the following should be the apropriate fix. Can you please test it? > If it works, then I'll make a proper patch out of it. I have tested and it doesn't work. This addresses issue from tmio_mmc_reset call from tmio_mmc_core. But tmio_mmc_reset is called from multiple places in renesas sdhi core driver. I guess that could be the reason this patch didn't work. Regards, Biju > > diff --git a/drivers/mmc/host/tmio_mmc_core.c > b/drivers/mmc/host/tmio_mmc_core.c > index 7dfc26f48c18..9416245a7b56 100644 > --- a/drivers/mmc/host/tmio_mmc_core.c > +++ b/drivers/mmc/host/tmio_mmc_core.c > @@ -195,6 +195,10 @@ static void tmio_mmc_reset(struct tmio_mmc_host > *host) > sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host- > >sdcard_irq_mask_all); > host->sdcard_irq_mask = host->sdcard_irq_mask_all; > > + if (host->native_hotplug) > + tmio_mmc_enable_mmc_irqs(host, > + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > + > tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width); > > if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) { @@ -1185,10 +1189,6 @@ > int tmio_mmc_host_probe(struct tmio_mmc_host *_host) > _host->set_clock(_host, 0); > tmio_mmc_reset(_host); > > - if (_host->native_hotplug) > - tmio_mmc_enable_mmc_irqs(_host, > - TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > - > spin_lock_init(&_host->lock); > mutex_init(&_host->ios_lock); >
Hi Wolfram, > Subject: RE: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with hard > reset > > Hi Wolfram, > > > Subject: Re: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with > > hard reset > > > > On Wed, Oct 06, 2021 at 06:16:05PM +0100, Biju Das 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@bp.renesas.com> > > > > IIUC, the following should be the apropriate fix. Can you please test > it? > > If it works, then I'll make a proper patch out of it. > > I have tested and it doesn't work. This addresses issue from > tmio_mmc_reset call from tmio_mmc_core. > Just to add, It could be related to timing issue, with your patch, if I put some print message, It works. Regards, Biju > > Regards, > Biju > > > > > diff --git a/drivers/mmc/host/tmio_mmc_core.c > > b/drivers/mmc/host/tmio_mmc_core.c > > index 7dfc26f48c18..9416245a7b56 100644 > > --- a/drivers/mmc/host/tmio_mmc_core.c > > +++ b/drivers/mmc/host/tmio_mmc_core.c > > @@ -195,6 +195,10 @@ static void tmio_mmc_reset(struct tmio_mmc_host > > *host) > > sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host- > > >sdcard_irq_mask_all); > > host->sdcard_irq_mask = host->sdcard_irq_mask_all; > > > > + if (host->native_hotplug) > > + tmio_mmc_enable_mmc_irqs(host, > > + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > > + > > tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width); > > > > if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) { @@ -1185,10 +1189,6 @@ > > int tmio_mmc_host_probe(struct tmio_mmc_host *_host) > > _host->set_clock(_host, 0); > > tmio_mmc_reset(_host); > > > > - if (_host->native_hotplug) > > - tmio_mmc_enable_mmc_irqs(_host, > > - TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > > - > > spin_lock_init(&_host->lock); > > mutex_init(&_host->ios_lock); > >
Hi Wolfram, > Subject: RE: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with hard > reset > > Hi Wolfram, > > > Subject: RE: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with > > hard reset > > > > Hi Wolfram, > > > > > Subject: Re: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss > > > with hard reset > > > > > > On Wed, Oct 06, 2021 at 06:16:05PM +0100, Biju Das 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@bp.renesas.com> > > > > > > IIUC, the following should be the apropriate fix. Can you please > > > test > > it? > > > If it works, then I'll make a proper patch out of it. > > > > I have tested and it doesn't work. This addresses issue from > > tmio_mmc_reset call from tmio_mmc_core. > > > > Just to add, It could be related to timing issue, with your patch, if I > put some print message, It works. Finally found the issue. There is one more patch for host->reset in tmio_mmc_core.c. please see below. If you add this code, then it works. Can you please add this as well in your proper patch? @ -958,6 +963,11 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) /* For R-Car Gen2+, we need to reset SDHI specific SCC */ if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) host->reset(host); + + if (host->native_hotplug) + tmio_mmc_enable_mmc_irqs(host, + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); + Regards, Biju > > > > > > > > diff --git a/drivers/mmc/host/tmio_mmc_core.c > > > b/drivers/mmc/host/tmio_mmc_core.c > > > index 7dfc26f48c18..9416245a7b56 100644 > > > --- a/drivers/mmc/host/tmio_mmc_core.c > > > +++ b/drivers/mmc/host/tmio_mmc_core.c > > > @@ -195,6 +195,10 @@ static void tmio_mmc_reset(struct tmio_mmc_host > > > *host) > > > sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host- > > > >sdcard_irq_mask_all); > > > host->sdcard_irq_mask = host->sdcard_irq_mask_all; > > > > > > + if (host->native_hotplug) > > > + tmio_mmc_enable_mmc_irqs(host, > > > + TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > > > + > > > tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width); > > > > > > if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) { @@ -1185,10 +1189,6 > > > @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) > > > _host->set_clock(_host, 0); > > > tmio_mmc_reset(_host); > > > > > > - if (_host->native_hotplug) > > > - tmio_mmc_enable_mmc_irqs(_host, > > > - TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > > > - > > > spin_lock_init(&_host->lock); > > > mutex_init(&_host->ios_lock); > > >
Hi Biju, > Finally found the issue. There is one more patch for host->reset in tmio_mmc_core.c. please see below. > If you add this code, then it works. Thanks for finding the culprit! To get this hopefully into v5.15 still, I will simply add this chunk like you suggested. However, I really wonder if we shouldn't just replace this: > /* For R-Car Gen2+, we need to reset SDHI specific SCC */ > if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) > host->reset(host); > > if (host->native_hotplug) > tmio_mmc_enable_mmc_irqs(host, > TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); > with a simple call to tmio_mmc_reset(host) (with tmio_mmc_reset() still updated to set the card interrupts, of course)? I have to admit I haven't checked all paths for side-effects yet, but maybe you can already test if this change also works (instead of adding the second chunk)? If so, we could change it incrementally for 5.16. Anyhow, will send the patch for 5.15 in some minutes. Thanks and all the best, Wolfram
Hi Wolfram, Thanks for the feedback. > Subject: Re: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with hard > reset > > Hi Biju, > > > Finally found the issue. There is one more patch for host->reset in > tmio_mmc_core.c. please see below. > > If you add this code, then it works. > > Thanks for finding the culprit! To get this hopefully into v5.15 still, I > will simply add this chunk like you suggested. However, I really wonder if > we shouldn't just replace this: > > > /* For R-Car Gen2+, we need to reset SDHI specific SCC > */ > > if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) > > host->reset(host); > > > > if (host->native_hotplug) > > tmio_mmc_enable_mmc_irqs(host, > > TMIO_STAT_CARD_REMOVE | > > TMIO_STAT_CARD_INSERT); > > > > with a simple call to > > tmio_mmc_reset(host) > > (with tmio_mmc_reset() still updated to set the card interrupts, of > course)? I have to admit I haven't checked all paths for side-effects yet, > but maybe you can already test if this change also works (instead of > adding the second chunk)? If so, we could change it incrementally for > 5.16. Agreed. Will test and provide you feedback. Regards, Biju > > Anyhow, will send the patch for 5.15 in some minutes. > > Thanks and all the best, > > Wolfram
Hi Wolfram, > Subject: RE: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with hard > reset > > Hi Wolfram, > > Thanks for the feedback. > > > Subject: Re: [PATCH] mmc: renesas_sdhi: Fix internal cd irq miss with > > hard reset > > > > Hi Biju, > > > > > Finally found the issue. There is one more patch for host->reset in > > tmio_mmc_core.c. please see below. > > > If you add this code, then it works. > > > > Thanks for finding the culprit! To get this hopefully into v5.15 > > still, I will simply add this chunk like you suggested. However, I > > really wonder if we shouldn't just replace this: > > > > > /* For R-Car Gen2+, we need to reset SDHI specific > > > SCC > > */ > > > if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) > > > host->reset(host); > > > > > > if (host->native_hotplug) > > > tmio_mmc_enable_mmc_irqs(host, > > > TMIO_STAT_CARD_REMOVE | > > > TMIO_STAT_CARD_INSERT); > > > > > > > with a simple call to > > > > tmio_mmc_reset(host) > > > > (with tmio_mmc_reset() still updated to set the card interrupts, of > > course)? I have to admit I haven't checked all paths for side-effects > > yet, but maybe you can already test if this change also works (instead > > of adding the second chunk)? If so, we could change it incrementally > > for 5.16. > > Agreed. Will test and provide you feedback. I have tested and it works ok on RZ/G2L platform. Looking at the code, further optimization is possible. Can you please check below and If it is ok, please add to the new patch for 5.16. diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index e2affa52ef46..e8add010bd7d 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -960,14 +960,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_OFF: tmio_mmc_power_off(host); /* For R-Car Gen2+, we need to reset SDHI specific SCC */ - if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) { - host->reset(host); - - if (host->native_hotplug) - tmio_mmc_enable_mmc_irqs(host, - TMIO_STAT_CARD_REMOVE | - TMIO_STAT_CARD_INSERT); - } + if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) + tmio_mmc_reset(host); host->set_clock(host, 0); break; @@ -1295,10 +1289,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev) if (host->clk_cache) host->set_clock(host, host->clk_cache); - if (host->native_hotplug) - tmio_mmc_enable_mmc_irqs(host, - TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT); - tmio_mmc_enable_dma(host, true); return 0; Regards, Biju
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)
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@bp.renesas.com> --- 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(+)