All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] mmc: tmio: use SDIO master interrupt bit only when allowed
@ 2016-12-01 15:08 Wolfram Sang
  2016-12-02  5:57 ` Yasushi SHOJI
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfram Sang @ 2016-12-01 15:08 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Yasushi SHOJI, Wolfram Sang

The master bit to enable SDIO interrupts can only be accessed if
SCLKDIVEN bit allows that. However, the core uses the SDIO enable
callback at times when SCLKDIVEN forbids the change. This leads to
"timeout waiting for SD bus idle" messages.

We now activate the master bit in probe once if SDIO is supported. IRQ
en-/disabling will be done now by the individual IRQ enablement bits
only.

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

Compile tested only, due to no testcase.

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

diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 700567603107a0..476c4e1094a014 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -140,12 +140,10 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
 
 		host->sdio_irq_mask = TMIO_SDIO_MASK_ALL &
 					~TMIO_SDIO_STAT_IOIRQ;
-		sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0001);
 		sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
 	} else if (!enable && host->sdio_irq_enabled) {
 		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, 0x0000);
 
 		host->sdio_irq_enabled = false;
 		pm_runtime_mark_last_busy(mmc_dev(mmc));
@@ -1137,7 +1135,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 	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, 0x0000);
+		sd_ctrl_write16(_host, CTL_TRANSACTION_CTL, 0x0001);
 	}
 
 	spin_lock_init(&_host->lock);
@@ -1185,6 +1183,9 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
 	struct platform_device *pdev = host->pdev;
 	struct mmc_host *mmc = host->mmc;
 
+	if (host->pdata->flags & TMIO_MMC_SDIO_IRQ)
+		sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000);
+
 	if (!host->native_hotplug)
 		pm_runtime_get_sync(&pdev->dev);
 
-- 
2.10.2

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

* Re: [RFC] mmc: tmio: use SDIO master interrupt bit only when allowed
  2016-12-01 15:08 [RFC] mmc: tmio: use SDIO master interrupt bit only when allowed Wolfram Sang
@ 2016-12-02  5:57 ` Yasushi SHOJI
  0 siblings, 0 replies; 2+ messages in thread
From: Yasushi SHOJI @ 2016-12-02  5:57 UTC (permalink / raw)
  To: wsa+renesas; +Cc: linux-mmc, linux-renesas-soc

On Fri, 02 Dec 2016 00:08:13 +0900,
Wolfram Sang wrote:
> 
> The master bit to enable SDIO interrupts can only be accessed if
> SCLKDIVEN bit allows that. However, the core uses the SDIO enable
> callback at times when SCLKDIVEN forbids the change. This leads to
> "timeout waiting for SD bus idle" messages.
> 
> We now activate the master bit in probe once if SDIO is supported. IRQ
> en-/disabling will be done now by the individual IRQ enablement bits
> only.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Compile tested only, due to no testcase.

We've reviewed and tested your patch.  It looks good and works fine
under the condition we had.

Reviewed-by: Yasushi SHOJI <yashi@atmark-techno.com>

Cc: stable@vger.kernel.org if other boards with the same controller
can confirm.

Thanks you Wolfram for your quick response and the rfc.
-- 
           yashi

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

end of thread, other threads:[~2016-12-02  5:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-01 15:08 [RFC] mmc: tmio: use SDIO master interrupt bit only when allowed Wolfram Sang
2016-12-02  5:57 ` Yasushi SHOJI

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.