public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [RFT PATCH] mmc: tmio: make sure SDIO gets reinitialized after resume
@ 2017-05-19 12:30 Wolfram Sang
  2017-05-23 12:15 ` Yoshihiro Shimoda
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2017-05-19 12:30 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Yoshihiro Shimoda, Yasushi SHOJI, Wolfram Sang

To achieve that, we set the registers in the generic HW reset routine
which gets called at both, init and resume. We also make sure to move
SDIO initialization before reset gets called in probe().

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

This patch addresses a report I got from Shimoda-san. I can't really test it
because the SDIO cards I have all require MMC_PM_KEEP_POWER to suspend and
that we don't support. So, I send this out to ask for testing. At least it
didn't cause regressions for the setup I used. To make testing easier, this
is *not* put on top of Simon's SDHI DMA rework patches, so it should apply
on current upstream and development branches.

 drivers/mmc/host/tmio_mmc_pio.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index a2d92f10501bdd..5e87fcaa99d430 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -229,6 +229,12 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
 	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
 		sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
 	msleep(10);
+
+	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);
+	}
+
 }
 
 static void tmio_mmc_reset_work(struct work_struct *work)
@@ -1221,6 +1227,10 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 	if (_host->native_hotplug)
 		pm_runtime_get_noresume(&pdev->dev);
 
+	_host->sdio_irq_enabled = false;
+	if (pdata->flags & TMIO_MMC_SDIO_IRQ)
+		_host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
+
 	tmio_mmc_clk_stop(_host);
 	tmio_mmc_reset(_host);
 
@@ -1237,13 +1247,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 
 	_host->sdcard_irq_mask &= ~irq_mask;
 
-	_host->sdio_irq_enabled = false;
-	if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
-		_host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
-		sd_ctrl_write16(_host, CTL_SDIO_IRQ_MASK, _host->sdio_irq_mask);
-		sd_ctrl_write16(_host, CTL_TRANSACTION_CTL, 0x0001);
-	}
-
 	spin_lock_init(&_host->lock);
 	mutex_init(&_host->ios_lock);
 
-- 
2.11.0


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

* RE: [RFT PATCH] mmc: tmio: make sure SDIO gets reinitialized after resume
  2017-05-19 12:30 [RFT PATCH] mmc: tmio: make sure SDIO gets reinitialized after resume Wolfram Sang
@ 2017-05-23 12:15 ` Yoshihiro Shimoda
  2017-05-23 12:23   ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Yoshihiro Shimoda @ 2017-05-23 12:15 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc@vger.kernel.org
  Cc: linux-renesas-soc@vger.kernel.org, Yasushi SHOJI,
	Masaharu Hayakawa

Hi Wolfram-san,

> From: Wolfram Sang
> Sent: Friday, May 19, 2017 9:31 PM
> 
> To achieve that, we set the registers in the generic HW reset routine
> which gets called at both, init and resume. We also make sure to move
> SDIO initialization before reset gets called in probe().
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> This patch addresses a report I got from Shimoda-san. I can't really test it
> because the SDIO cards I have all require MMC_PM_KEEP_POWER to suspend and
> that we don't support. So, I send this out to ask for testing. At least it
> didn't cause regressions for the setup I used. To make testing easier, this
> is *not* put on top of Simon's SDHI DMA rework patches, so it should apply
> on current upstream and development branches.

Thank you for the patch!
Hayakawa-san tested this patch on both H3/Salvator-X and E2/ALT.

So,
Tested-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

Best regards,
Yoshihiro Shimoda

>  drivers/mmc/host/tmio_mmc_pio.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index a2d92f10501bdd..5e87fcaa99d430 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
> @@ -229,6 +229,12 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
>  	if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
>  		sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
>  	msleep(10);
> +
> +	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);
> +	}
> +
>  }
> 
>  static void tmio_mmc_reset_work(struct work_struct *work)
> @@ -1221,6 +1227,10 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
>  	if (_host->native_hotplug)
>  		pm_runtime_get_noresume(&pdev->dev);
> 
> +	_host->sdio_irq_enabled = false;
> +	if (pdata->flags & TMIO_MMC_SDIO_IRQ)
> +		_host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
> +
>  	tmio_mmc_clk_stop(_host);
>  	tmio_mmc_reset(_host);
> 
> @@ -1237,13 +1247,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
> 
>  	_host->sdcard_irq_mask &= ~irq_mask;
> 
> -	_host->sdio_irq_enabled = false;
> -	if (pdata->flags & TMIO_MMC_SDIO_IRQ) {
> -		_host->sdio_irq_mask = TMIO_SDIO_MASK_ALL;
> -		sd_ctrl_write16(_host, CTL_SDIO_IRQ_MASK, _host->sdio_irq_mask);
> -		sd_ctrl_write16(_host, CTL_TRANSACTION_CTL, 0x0001);
> -	}
> -
>  	spin_lock_init(&_host->lock);
>  	mutex_init(&_host->ios_lock);
> 
> --
> 2.11.0

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

* Re: [RFT PATCH] mmc: tmio: make sure SDIO gets reinitialized after resume
  2017-05-23 12:15 ` Yoshihiro Shimoda
@ 2017-05-23 12:23   ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2017-05-23 12:23 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: Wolfram Sang, linux-mmc@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, Yasushi SHOJI,
	Masaharu Hayakawa

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

Shimoda-san,

> > This patch addresses a report I got from Shimoda-san. I can't really test it
> > because the SDIO cards I have all require MMC_PM_KEEP_POWER to suspend and
> > that we don't support. So, I send this out to ask for testing. At least it
> > didn't cause regressions for the setup I used. To make testing easier, this
> > is *not* put on top of Simon's SDHI DMA rework patches, so it should apply
> > on current upstream and development branches.
> 
> Thank you for the patch!
> Hayakawa-san tested this patch on both H3/Salvator-X and E2/ALT.
> 
> So,
> Tested-by: Masaharu Hayakawa <masaharu.hayakawa.ry@renesas.com>

Very good, thanks, also to Hayakawa-san! I'll rebase this patch and
resubmit with the tag added!

Regards,

   Wolfram


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

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

end of thread, other threads:[~2017-05-23 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-19 12:30 [RFT PATCH] mmc: tmio: make sure SDIO gets reinitialized after resume Wolfram Sang
2017-05-23 12:15 ` Yoshihiro Shimoda
2017-05-23 12:23   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox