All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] tmio/sdhi: fix workaround for a regression
@ 2020-11-06  7:25 Wolfram Sang
  2020-11-06  7:25 ` [PATCH 1/3] mmc: tmio: when resetting, reset DMA controller, too Wolfram Sang
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-11-06  7:25 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

After some refactoring, I had to insert a workaround because a
regression was discovered when re-inserting SD cards. Now, this series
implements the proper fixes and finally reverts the workaround.

This has been tested on Salvator-XS (M3N and H3 ES2.0). These patches
were already discussed with Shimoda-san and the BSP team internally.
However, I'd appreciate Shimoda-san's tags be given here to make sure
the patches are exactly that what we discussed.

Thanks and happy hacking!


Wolfram Sang (3):
  mmc: tmio: when resetting, reset DMA controller, too
  mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF
  Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD
    cards"

 drivers/mmc/host/renesas_sdhi_core.c | 13 -------------
 drivers/mmc/host/tmio_mmc_core.c     |  7 +++++--
 2 files changed, 5 insertions(+), 15 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] mmc: tmio: when resetting, reset DMA controller, too
  2020-11-06  7:25 [PATCH 0/3] tmio/sdhi: fix workaround for a regression Wolfram Sang
@ 2020-11-06  7:25 ` Wolfram Sang
  2020-11-06  7:25 ` [PATCH 2/3] mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF Wolfram Sang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-11-06  7:25 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

When applying a revert, the assumption that DMA only needs to be cleared
in specific cases was wrong. We want to reset the DMA controller every
time the rest of the HW gets reset, too.

Fixes: 34e3211e5492 ("Revert "mmc: tmio: fix reset operation"")
Reported-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index 2fce0518632d..cfb53d7c63d7 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -175,6 +175,8 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
 	if (host->reset)
 		host->reset(host);
 
+	tmio_mmc_abort_dma(host);
+
 	if (host->pdata->flags & TMIO_MMC_SDIO_IRQ) {
 		sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
 		sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001);
@@ -223,8 +225,6 @@ static void tmio_mmc_reset_work(struct work_struct *work)
 
 	/* Ready for new calls */
 	host->mrq = NULL;
-
-	tmio_mmc_abort_dma(host);
 	mmc_request_done(host->mmc, mrq);
 }
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF
  2020-11-06  7:25 [PATCH 0/3] tmio/sdhi: fix workaround for a regression Wolfram Sang
  2020-11-06  7:25 ` [PATCH 1/3] mmc: tmio: when resetting, reset DMA controller, too Wolfram Sang
@ 2020-11-06  7:25 ` Wolfram Sang
  2020-11-06  7:25 ` [PATCH 3/3] Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD cards" Wolfram Sang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-11-06  7:25 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang, Takeshi Saito

When powering off a card, we need to disable the tuning HW (like SCC for
the Renesas SDHI) to get to a sane state and allow for re-tuning new
cards. This was hidden before because we wrongly did that in hw_reset()
before which was an unintended use of hw_reset(). Now that we corrected
the use of hw_reset() meanwhile, we revealed this shortcoming and need
to fix it properly by explicitly calling the downgrade callback.

Fixes: 6e7d4de10890 ("mmc: renesas_sdhi: move wrong 'hw_reset' to 'reset'")
Suggested-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
Reviewed-by: Takeshi Saito <takeshi.saito.xv@renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index cfb53d7c63d7..cb4149fd12e0 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -927,6 +927,9 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	switch (ios->power_mode) {
 	case MMC_POWER_OFF:
 		tmio_mmc_power_off(host);
+		/* Downgrade ensures a sane state for tuning HW (e.g. SCC) */
+		if (host->mmc->ops->hs400_downgrade)
+			host->mmc->ops->hs400_downgrade(host->mmc);
 		host->set_clock(host, 0);
 		break;
 	case MMC_POWER_UP:
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD cards"
  2020-11-06  7:25 [PATCH 0/3] tmio/sdhi: fix workaround for a regression Wolfram Sang
  2020-11-06  7:25 ` [PATCH 1/3] mmc: tmio: when resetting, reset DMA controller, too Wolfram Sang
  2020-11-06  7:25 ` [PATCH 2/3] mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF Wolfram Sang
@ 2020-11-06  7:25 ` Wolfram Sang
  2020-11-06 12:02 ` [PATCH 0/3] tmio/sdhi: fix workaround for a regression Niklas Söderlund
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-11-06  7:25 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yoshihiro Shimoda, Wolfram Sang

This reverts commit db1af1e9712920f47b5dc6a995fca3eec05ea85e. It was
only a workaround to hide a regression. We now have proper fixes.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 414314151d0a..20e5eb63caf8 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -572,17 +572,6 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host)
 					     TMIO_MASK_INIT_RCAR2);
 }
 
-/*
- * This is a temporary workaround! This driver used 'hw_reset' wrongly and the
- * fix for that showed a regression. So, we mimic the old behaviour until the
- * proper solution is found.
- */
-static void renesas_sdhi_hw_reset(struct mmc_host *mmc)
-{
-	struct tmio_mmc_host *host = mmc_priv(mmc);
-	renesas_sdhi_reset(host);
-}
-
 #define SH_MOBILE_SDHI_MIN_TAP_ROW 3
 
 static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
@@ -1020,8 +1009,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 		if (of_data && of_data->scc_offset) {
 			priv->scc_ctl = host->ctl + of_data->scc_offset;
 			host->reset = renesas_sdhi_reset;
-			host->ops.hw_reset = renesas_sdhi_hw_reset;
-			host->mmc->caps |= MMC_CAP_HW_RESET;
 		}
 	}
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] tmio/sdhi: fix workaround for a regression
  2020-11-06  7:25 [PATCH 0/3] tmio/sdhi: fix workaround for a regression Wolfram Sang
                   ` (2 preceding siblings ...)
  2020-11-06  7:25 ` [PATCH 3/3] Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD cards" Wolfram Sang
@ 2020-11-06 12:02 ` Niklas Söderlund
  2020-11-09 11:04 ` Yoshihiro Shimoda
  2020-11-10 12:26 ` Ulf Hansson
  5 siblings, 0 replies; 10+ messages in thread
From: Niklas Söderlund @ 2020-11-06 12:02 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, Yoshihiro Shimoda

Hi Wolfram,

Thanks for your work.

On 2020-11-06 08:25:46 +0100, Wolfram Sang wrote:
> After some refactoring, I had to insert a workaround because a
> regression was discovered when re-inserting SD cards. Now, this series
> implements the proper fixes and finally reverts the workaround.

Nice.

> 
> This has been tested on Salvator-XS (M3N and H3 ES2.0). These patches
> were already discussed with Shimoda-san and the BSP team internally.
> However, I'd appreciate Shimoda-san's tags be given here to make sure
> the patches are exactly that what we discussed.
> 
> Thanks and happy hacking!

Tested on M3-N and for the whole series,

Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> 
> 
> Wolfram Sang (3):
>   mmc: tmio: when resetting, reset DMA controller, too
>   mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF
>   Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD
>     cards"
> 
>  drivers/mmc/host/renesas_sdhi_core.c | 13 -------------
>  drivers/mmc/host/tmio_mmc_core.c     |  7 +++++--
>  2 files changed, 5 insertions(+), 15 deletions(-)
> 
> -- 
> 2.28.0
> 

-- 
Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 0/3] tmio/sdhi: fix workaround for a regression
  2020-11-06  7:25 [PATCH 0/3] tmio/sdhi: fix workaround for a regression Wolfram Sang
                   ` (3 preceding siblings ...)
  2020-11-06 12:02 ` [PATCH 0/3] tmio/sdhi: fix workaround for a regression Niklas Söderlund
@ 2020-11-09 11:04 ` Yoshihiro Shimoda
  2020-11-10 12:26 ` Ulf Hansson
  5 siblings, 0 replies; 10+ messages in thread
From: Yoshihiro Shimoda @ 2020-11-09 11:04 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc

Hi Wolfram-san,

> From: Wolfram Sang, Sent: Friday, November 6, 2020 4:26 PM
> 
> After some refactoring, I had to insert a workaround because a
> regression was discovered when re-inserting SD cards. Now, this series
> implements the proper fixes and finally reverts the workaround.
> 
> This has been tested on Salvator-XS (M3N and H3 ES2.0). These patches
> were already discussed with Shimoda-san and the BSP team internally.
> However, I'd appreciate Shimoda-san's tags be given here to make sure
> the patches are exactly that what we discussed.

Thank you for the patches!

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

And, I tested on the R-Car H3 ES3.0 Salvator-XS. So,

Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Best regards,
Yoshihiro Shimoda


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] tmio/sdhi: fix workaround for a regression
  2020-11-06  7:25 [PATCH 0/3] tmio/sdhi: fix workaround for a regression Wolfram Sang
                   ` (4 preceding siblings ...)
  2020-11-09 11:04 ` Yoshihiro Shimoda
@ 2020-11-10 12:26 ` Ulf Hansson
  2020-11-10 12:40   ` Wolfram Sang
  5 siblings, 1 reply; 10+ messages in thread
From: Ulf Hansson @ 2020-11-10 12:26 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, Linux-Renesas, Yoshihiro Shimoda

On Fri, 6 Nov 2020 at 08:26, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> After some refactoring, I had to insert a workaround because a
> regression was discovered when re-inserting SD cards. Now, this series
> implements the proper fixes and finally reverts the workaround.
>
> This has been tested on Salvator-XS (M3N and H3 ES2.0). These patches
> were already discussed with Shimoda-san and the BSP team internally.
> However, I'd appreciate Shimoda-san's tags be given here to make sure
> the patches are exactly that what we discussed.
>
> Thanks and happy hacking!
>
>
> Wolfram Sang (3):
>   mmc: tmio: when resetting, reset DMA controller, too
>   mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF
>   Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD
>     cards"
>
>  drivers/mmc/host/renesas_sdhi_core.c | 13 -------------
>  drivers/mmc/host/tmio_mmc_core.c     |  7 +++++--
>  2 files changed, 5 insertions(+), 15 deletions(-)
>

Applied for next, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] tmio/sdhi: fix workaround for a regression
  2020-11-10 12:26 ` Ulf Hansson
@ 2020-11-10 12:40   ` Wolfram Sang
  2020-11-10 13:00     ` Ulf Hansson
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2020-11-10 12:40 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Linux-Renesas, Yoshihiro Shimoda

[-- Attachment #1: Type: text/plain, Size: 1197 bytes --]

On Tue, Nov 10, 2020 at 01:26:08PM +0100, Ulf Hansson wrote:
> On Fri, 6 Nov 2020 at 08:26, Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
> >
> > After some refactoring, I had to insert a workaround because a
> > regression was discovered when re-inserting SD cards. Now, this series
> > implements the proper fixes and finally reverts the workaround.
> >
> > This has been tested on Salvator-XS (M3N and H3 ES2.0). These patches
> > were already discussed with Shimoda-san and the BSP team internally.
> > However, I'd appreciate Shimoda-san's tags be given here to make sure
> > the patches are exactly that what we discussed.
> >
> > Thanks and happy hacking!
> >
> >
> > Wolfram Sang (3):
> >   mmc: tmio: when resetting, reset DMA controller, too
> >   mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF
> >   Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD
> >     cards"
> >
> >  drivers/mmc/host/renesas_sdhi_core.c | 13 -------------
> >  drivers/mmc/host/tmio_mmc_core.c     |  7 +++++--
> >  2 files changed, 5 insertions(+), 15 deletions(-)
> >
> 
> Applied for next, thanks!

Can we have this in 5.10, too?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] tmio/sdhi: fix workaround for a regression
  2020-11-10 12:40   ` Wolfram Sang
@ 2020-11-10 13:00     ` Ulf Hansson
  2020-11-10 13:07       ` Wolfram Sang
  0 siblings, 1 reply; 10+ messages in thread
From: Ulf Hansson @ 2020-11-10 13:00 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-mmc, Linux-Renesas, Yoshihiro Shimoda

On Tue, 10 Nov 2020 at 13:40, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> On Tue, Nov 10, 2020 at 01:26:08PM +0100, Ulf Hansson wrote:
> > On Fri, 6 Nov 2020 at 08:26, Wolfram Sang
> > <wsa+renesas@sang-engineering.com> wrote:
> > >
> > > After some refactoring, I had to insert a workaround because a
> > > regression was discovered when re-inserting SD cards. Now, this series
> > > implements the proper fixes and finally reverts the workaround.
> > >
> > > This has been tested on Salvator-XS (M3N and H3 ES2.0). These patches
> > > were already discussed with Shimoda-san and the BSP team internally.
> > > However, I'd appreciate Shimoda-san's tags be given here to make sure
> > > the patches are exactly that what we discussed.
> > >
> > > Thanks and happy hacking!
> > >
> > >
> > > Wolfram Sang (3):
> > >   mmc: tmio: when resetting, reset DMA controller, too
> > >   mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF
> > >   Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD
> > >     cards"
> > >
> > >  drivers/mmc/host/renesas_sdhi_core.c | 13 -------------
> > >  drivers/mmc/host/tmio_mmc_core.c     |  7 +++++--
> > >  2 files changed, 5 insertions(+), 15 deletions(-)
> > >
> >
> > Applied for next, thanks!
>
> Can we have this in 5.10, too?

Of course, thanks for the reminder! I have moved these to my fixes branch.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] tmio/sdhi: fix workaround for a regression
  2020-11-10 13:00     ` Ulf Hansson
@ 2020-11-10 13:07       ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2020-11-10 13:07 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, Linux-Renesas, Yoshihiro Shimoda

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]


> > Can we have this in 5.10, too?
> 
> Of course, thanks for the reminder! I have moved these to my fixes branch.

Thanks for your support, as always, Ulf!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-11-10 13:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06  7:25 [PATCH 0/3] tmio/sdhi: fix workaround for a regression Wolfram Sang
2020-11-06  7:25 ` [PATCH 1/3] mmc: tmio: when resetting, reset DMA controller, too Wolfram Sang
2020-11-06  7:25 ` [PATCH 2/3] mmc: tmio: bring tuning HW to a sane state with MMC_POWER_OFF Wolfram Sang
2020-11-06  7:25 ` [PATCH 3/3] Revert "mmc: renesas_sdhi: workaround a regression when reinserting SD cards" Wolfram Sang
2020-11-06 12:02 ` [PATCH 0/3] tmio/sdhi: fix workaround for a regression Niklas Söderlund
2020-11-09 11:04 ` Yoshihiro Shimoda
2020-11-10 12:26 ` Ulf Hansson
2020-11-10 12:40   ` Wolfram Sang
2020-11-10 13:00     ` Ulf Hansson
2020-11-10 13:07       ` Wolfram Sang

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.