Skip to contentSkip to conversation

mmc: sdio: add a delay to call sdio_irq_work when sdio bus resume

PATCH In review [email protected] 2 participants 3 messages Aug 19, 2020 – Aug 21, 2020 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc: sdio: add a delay to call sdio_irq_work when sdio bus resume

From: Haibo Chen <[email protected]>

Find this issue on i.MX7D-sdb board with broadcom sdio wifi. When system resume, sometimes this wifi meet the tuning fail issue. All tuning command get command timeout error. This is because sdio_irq_work on system_wq was executed before the broadcom wifi driver resume. Due to broadcom wifi driver set the wifi in Sleep sate in system suspend, need to set the wifi to Wake state first. So need to make sure wifi driver resume first, then do the sdio_irq_work.

Fixes 51133850bce2 ("mmc: core: Fixup processing of SDIO IRQs during system suspend/resume")
---
 drivers/mmc/core/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/sdio.c +1 -1
index 7b40553d3934..101632617f69 100644
@@ -1047,7 +1047,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
 		if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD))
 			wake_up_process(host->sdio_irq_thread);
 		else if (host->caps & MMC_CAP_SDIO_IRQ)
-			queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+			queue_delayed_work(system_wq, &host->sdio_irq_work, 1);
 	}
 
 out:
Signature · 1 line
2.17.1
#1 lore raw
Quoted 23 lines · On Wed, 19 Aug 2020 at 13:24, <[email protected]> wrote:

From: Haibo Chen <[email protected]>

Find this issue on i.MX7D-sdb board with broadcom sdio wifi. When system resume, sometimes this wifi meet the tuning fail issue. All tuning command get command timeout error. This is because sdio_irq_work on system_wq was executed before the broadcom wifi driver resume. Due to broadcom wifi driver set the wifi in Sleep sate in system suspend, need to set the wifi to Wake state first. So need to make sure wifi driver resume first, then do the sdio_irq_work.

Fixes 51133850bce2 ("mmc: core: Fixup processing of SDIO IRQs during system suspend/resume")
---
 drivers/mmc/core/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/sdio.c +0 -0
index 7b40553d3934..101632617f69 100644

drivers/mmc/core/sdio.c static int mmc_sdio_resume(struct mmc_host *host) · line 1050

Quoted 5 lines
drivers/mmc/core/sdio.c +1 -1
@@ -1047,7 +1047,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
                if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD))
                        wake_up_process(host->sdio_irq_thread);
                else if (host->caps & MMC_CAP_SDIO_IRQ)
-                       queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+                       queue_delayed_work(system_wq, &host->sdio_irq_work, 1);

This looks fragile, as there is really no guarantee that the WiFi driver is resumed prior to the SDIO irq work being executed.

Instead, it looks like you shouldn't keep the SDIO irqs enabled during system suspend, because those aren't system wakeup capable. Correct?

In other words, I think the WiFi driver should call sdio_release_irq() in the ->suspend() callback and sdio_claim_irq() in the ->resume() callback.

Quoted 6 lines
drivers/mmc/core/sdio.c +0 -1
        }
 
 out:
--

2.17.1

Kind regards
Uffe

author
#2 lore raw
Quoted 40 lines

-----Original Message-----
From: Ulf Hansson [mailto:[email protected]]
Sent: 2020年8月21日 15:59
To: Bough Chen <[email protected]>
Cc: Adrian Hunter <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; Matthias Kaehlcke <[email protected]>; [email protected]; Doug Anderson <[email protected]>; Pali Rohár <[email protected]>
Subject: Re: [PATCH v2] mmc: sdio: add a delay to call sdio_irq_work when sdio bus resume

drivers/mmc/core/sdio.c static int mmc_sdio_resume(struct mmc_host

Quoted 23 lines · On Wed, 19 Aug 2020 at 13:24, <[email protected]> wrote:

From: Haibo Chen <[email protected]>

Find this issue on i.MX7D-sdb board with broadcom sdio wifi. When system resume, sometimes this wifi meet the tuning fail issue. All tuning command get command timeout error. This is because sdio_irq_work on system_wq was executed before the broadcom wifi driver resume. Due to broadcom wifi driver set the wifi in Sleep sate in system suspend, need to set the wifi to Wake state first. So need to make sure wifi driver resume first, then do the sdio_irq_work.

Fixes 51133850bce2 ("mmc: core: Fixup processing of SDIO IRQs during

system suspend/resume")

---
 drivers/mmc/core/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/sdio.c index renamed from drivers/mmc/core/sdio.c +0 -0

7b40553d3934..101632617f69 100644

drivers/mmc/core/sdio.c +0 -0
@@ -1047,7 +1047,7 @@ static int mmc_sdio_resume(struct mmc_host

*host)

drivers/mmc/core/sdio.c static int mmc_sdio_resume(struct mmc_host *host)

Quoted 4 lines
drivers/mmc/core/sdio.c +0 -1
                if (!(host->caps2 & MMC_CAP2_SDIO_IRQ_NOTHREAD))
                        wake_up_process(host->sdio_irq_thread);
                else if (host->caps & MMC_CAP_SDIO_IRQ)
-                       queue_delayed_work(system_wq,
Quoted 6 lines

&host->sdio_irq_work, 0);

drivers/mmc/core/sdio.c static int mmc_sdio_resume(struct mmc_host · line 1051

Quoted 2 lines
drivers/mmc/core/sdio.c +2 -0
+                       queue_delayed_work(system_wq,
+ &host->sdio_irq_work, 1);

This looks fragile, as there is really no guarantee that the WiFi driver is resumed prior to the SDIO irq work being executed.

Yes, agree.

Quoted 6 lines

Instead, it looks like you shouldn't keep the SDIO irqs enabled during system suspend, because those aren't system wakeup capable. Correct?

In other words, I think the WiFi driver should call sdio_release_irq() in the ->suspend() callback and sdio_claim_irq() in the ->resume() callback.

Let me double check the WIFI driver. Thanks for the suggestion!

Best Regards
Haibo Chen

Quoted 10 lines
Quoted 7 lines
drivers/mmc/core/sdio.c +0 -1
        }
 
 out:
--

2.17.1

Kind regards
Uffe