iMX28 SDIO suspend fails on a 802.11n module

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX28 SDIO suspend fails on a 802.11n module

Jump to solution
4,041 Views
ArtyomKamshilin
Contributor II

Hello everyone,

I'm trying to suspend/resume a 802.11n SDIO module I have connected to mmc1 slot of the IMX28EVK board. The module is externally powered and requires no power from SDIO except for communications. I run Freescale Linux distribution with 2.6.35 kernel, all latest patches applied. When I press "Power" button on the host to suspend the system, it suspends OK, but once I press that button again to resume, I get the following in my terminal (starting from the moment I suspended):

-------------------------------------

pswitch goto suspend

PM: Syncing filesystems ... done.

Freezing user space processes ... (elapsed 0.01 seconds) done.

Freezing remaining freezable tasks ... (elapsed 0.01 seconds) done.

Suspending console(s) (use no_console_suspend to debug)


<...PRESSING POWER TO RESUME NOW...>


mmc1:0001:1: cannot remain alive while host is suspended

mmc1: card 0001 removed

PM: suspend of devices complete after 793.252 msecs

PM: late suspend of devices complete after 0.687 msecs

wakeup irq = 6

PM: early resume of devices complete after 0.531 msecs

mmc1: new high speed SDIO card at address 0001

mmc mmc1:0001: parent mmc1 should not be sleeping

PM: resume of devices complete after 461.624 msecs

Restarting tasks ... done.

PHY: 0:00 - Link is Up - 100/Full

wlan_sdio_poll_card_status failed, tries = 100, cs = 0xc

WLAN: FW download with helper poll status timeout @ 0

wlan_dnld_fw fail ret=0xffffffff

WLAN: Download FW with nowwait: 0

Firmware Init Failed

woal_add_card failed

wlan_sdio: probe of mmc1:0001:1 failed with error -1

---------------------------


The 802.11n module then never recovers from suspend and does not work until I reinsert it. The 802.11 module is capable of suspend/resume, and vendor says the board should power down the VDD_SDIO rail - on my board, it does not happen with this module, and VDD_SDIO of 3.3V remains applied to the 802.11n SDIO interface. Interestingly, when I suspend my system, I measure the VDD_SDIO on mmc0 which has my SD card I'm booting from - and in suspend that VDD_SDIO goes down to 3.12V, and comes back to 3.3V on resume. Card obviously continues to work.

Any ideas on what can be wrong with the system? Perhaps some configuration issues with the kernel?


Thanks a lot.


Arty

Labels (2)
1 Solution
1,784 Views
YS
Contributor IV

This could be very complex. I've spend several weeks to track down suspend/resume issue with SDIO WiFi (Qualcomm-Atheros AR6003). I don't know which make / model of your "802.11n module" so I'm not sure if my issue was same as yours.

In my case, the WiFi driver did not expect to cut SDIO power off while suspend but SDIO driver didn't know this, so SDIO driver tried to re-initialize the SDIO card on resume, resulting error. To long story short, I applied two patches (see RED lines).

(1) mmc_sdio_resume() fuinction in drivers/mmc/core/sdio.c

Check MMC_PM_KEEP_POWER flag and NOT to call initialization sequence (mmc_sdio_init) but only initialize IRQ if the capability flag is set.

static int mmc_sdio_resume(struct mmc_host *host)

{

        int i, err = 0;

        BUG_ON(!host);

        BUG_ON(!host->card);

        /* Basic card reinitialization. */

        mmc_claim_host(host);

        if (host->pm_flags & MMC_PM_KEEP_POWER) {

                if ((host->sdio_irqs) && (host->pm_flags & MMC_PM_WAKE_SDIO_IRQ)) {

                        mmc_signal_sdio_irq(host);

                }

        }

        else {

                err = mmc_sdio_init_card(host, host->ocr, host->card,

                                         (host->pm_flags & MMC_PM_KEEP_POWER));

                if (!err)

                        /* We may have switched to 1-bit mode during suspend. */

                        err = sdio_enable_wide(host->card);

                if (!err && host->sdio_irqs)

                        mmc_signal_sdio_irq(host);

        }

        mmc_release_host(host);

(2) function mxs_mmc_probe() in drivers/mmc/host/mxs-mmc.c

To add MMC_PM_KEEP_POWER and MMC_PM_WAKE_SDIO_IRQ flags in MMC power management capability flags (mmc->pm_caps).

static int __init mxs_mmc_probe(struct platform_device *pdev)

{

        .

        .

        .

        mmc->ops = &mxs_mmc_ops;

        mmc->f_min = mmc_data->min_clk;

        mmc->f_max = mmc_data->max_clk;

        mmc->caps = mmc_data->caps;

        mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

        mmc->caps |= MMC_CAP_SDIO_IRQ;

        mmc->pm_caps |= MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ;

As I wrote above, I don't know what exactly going on in your WiFi driver so I don't know my fix will work for your case.

View solution in original post

5 Replies
1,785 Views
YS
Contributor IV

This could be very complex. I've spend several weeks to track down suspend/resume issue with SDIO WiFi (Qualcomm-Atheros AR6003). I don't know which make / model of your "802.11n module" so I'm not sure if my issue was same as yours.

In my case, the WiFi driver did not expect to cut SDIO power off while suspend but SDIO driver didn't know this, so SDIO driver tried to re-initialize the SDIO card on resume, resulting error. To long story short, I applied two patches (see RED lines).

(1) mmc_sdio_resume() fuinction in drivers/mmc/core/sdio.c

Check MMC_PM_KEEP_POWER flag and NOT to call initialization sequence (mmc_sdio_init) but only initialize IRQ if the capability flag is set.

static int mmc_sdio_resume(struct mmc_host *host)

{

        int i, err = 0;

        BUG_ON(!host);

        BUG_ON(!host->card);

        /* Basic card reinitialization. */

        mmc_claim_host(host);

        if (host->pm_flags & MMC_PM_KEEP_POWER) {

                if ((host->sdio_irqs) && (host->pm_flags & MMC_PM_WAKE_SDIO_IRQ)) {

                        mmc_signal_sdio_irq(host);

                }

        }

        else {

                err = mmc_sdio_init_card(host, host->ocr, host->card,

                                         (host->pm_flags & MMC_PM_KEEP_POWER));

                if (!err)

                        /* We may have switched to 1-bit mode during suspend. */

                        err = sdio_enable_wide(host->card);

                if (!err && host->sdio_irqs)

                        mmc_signal_sdio_irq(host);

        }

        mmc_release_host(host);

(2) function mxs_mmc_probe() in drivers/mmc/host/mxs-mmc.c

To add MMC_PM_KEEP_POWER and MMC_PM_WAKE_SDIO_IRQ flags in MMC power management capability flags (mmc->pm_caps).

static int __init mxs_mmc_probe(struct platform_device *pdev)

{

        .

        .

        .

        mmc->ops = &mxs_mmc_ops;

        mmc->f_min = mmc_data->min_clk;

        mmc->f_max = mmc_data->max_clk;

        mmc->caps = mmc_data->caps;

        mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;

        mmc->caps |= MMC_CAP_SDIO_IRQ;

        mmc->pm_caps |= MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ;

As I wrote above, I don't know what exactly going on in your WiFi driver so I don't know my fix will work for your case.

1,784 Views
ArtyomKamshilin
Contributor II

Thanks for the patch! I've tried it, but looks like my WiFi driver does expect SDIO power to go down in suspend - and guess what, that does NOT happen on the IMX28EVK. I talked to WiFi module manufacturer (Taiyo Yuden), and they confirmed SDIO power is supposed to be disabled in suspend - then the module works correctly.

How do I patch Freescale's BSP to make that happen? Again, I need kernel to disable VDD_SDIO in suspend and re-enable it when out of suspend. I'm not sure what effect will that have on the SSP0 though - that's where I have an SD card I'm booting from, and if that goes down as well, so will my root FS (at least until card is reinitialized). Thoughts? Any help is really appreciated.


Arty


0 Kudos
1,784 Views
YS
Contributor IV

I'm sorry I don't have immediate answer for that. My iMX28 target is our own design (silex SX-580) which boot from SPI Flash memory, and SSP0 is directly wired to on-board WiFi module.

0 Kudos
1,784 Views
jimmychan
NXP TechSupport
NXP TechSupport

There are many patches on the i.MX28EVK's Downloads web page. Do you apply all the patches for your BSP?

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MCIMX28EVKJ

0 Kudos
1,784 Views
ArtyomKamshilin
Contributor II

Certainly - I applied all the patches available to date.

0 Kudos