Greetings. I've been chasing down a problem with the SDIO-attached wifi card in the GTA04 (www.gta04.org). The problem seems very similar to that described in http://www.mail-archive.com/linux-mmc@xxxxxxxxxxxxxxx/msg04289.html as referenced in: commit 08da834a24312157f512224691ad1fddd11c1073 Author: Daniel Drake <dsd@xxxxxxxxxx> Date: Wed Jul 20 17:39:22 2011 +0100 mmc: enable runtime PM by default and if I revert that commit so that runtime PM is not enabled the problem goes away. (The wifi chip is a libertas_sdio supported chip connected to an mmc interface on an omap3, and has a separate regulator for power supply, plus a GPIO pin for reset, just like in the email thread. The problem is exemplified by: [ 64.643981] libertas_sdio: probe of mmc1:0001:1 failed with error -16 ). I finally managed to track down exactly what was happening - runtime PM was putting the interface to sleep before the SDIO functions were probed so initialising them failed. This patch fixes it and seem to be 'correct'. Please consider applying. Thanks, NeilBrown From: NeilBrown <neilb@xxxxxxx> Date: Mon, 5 Dec 2011 11:34:47 +1100 Subject: [PATCH] mmc/sdio: don't allow interface to runtime-suspend until probe is finished. mmc_attach_sdio currently enables runtime power management on the mmc interface before it completes the probe of functions. This means that it might be asleep during the probe and the probe will fail. In particular, if 'drivers_autoprobe' is enabled on the mmc bus, then device_attach() will be called by bus_probe_device() from device_add() and it will pm_runtime_get_noresume()/pm_runtime_put_sync(). As runtime power management this the device is running (pm_runtime_set_active() in mmc_attach_sdio()) and rtpm is enabled (pm_runtime_enable()), the pm_runtime_put_sync() call puts the mmc interface to sleep, so function probing fails. So this patch moves the call to pm_runtime_enable to after all the calls to sdio_add_func. Signed-off-by: NeilBrown <neilb@xxxxxxx> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 3ab565e..c0c83f6 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -811,11 +811,6 @@ int mmc_attach_sdio(struct mmc_host *host) err = pm_runtime_set_active(&card->dev); if (err) goto remove; - - /* - * Enable runtime PM for this card - */ - pm_runtime_enable(&card->dev); } /* @@ -858,6 +853,12 @@ int mmc_attach_sdio(struct mmc_host *host) } mmc_claim_host(host); + if (host->caps & MMC_CAP_POWER_OFF_CARD) { + /* + * Enable runtime PM for this card + */ + pm_runtime_enable(&card->dev); + } return 0;
Attachment:
signature.asc
Description: PGP signature