@@ -80,8 +80,9 @@ static int sdio_init_func(struct mmc_card *card, unsigned int fn)
return ret;
/* For each SDIO function initialized, increase the power claim
- * reference count of the card */
- atomic_inc(&card->power_claims);
+ * reference count of the card, unless explicitly requested not to */
+ if (!(card->host->caps & MMC_CAP_DONT_POWER_CARD))
+ atomic_inc(&card->power_claims);
return 0;
@@ -607,6 +608,16 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
mmc_release_host(host);
/*
+ * If power is not required for this card, power it off.
+ * The sdio function will need to call sdio_claim_power.
+ */
+ if (!atomic_read(&card->power_claims)) {
+ pr_info("%s: power is not claimed, releasing\n",
+ mmc_hostname(host));
+ mmc_release_power(host);
+ }
+
+ /*
* First add the card to the driver model...
*/
err = mmc_add_card(host->card);
@@ -155,6 +155,7 @@ struct mmc_host {
#define MMC_CAP_DISABLE (1 << 7) /* Can the host be disabled */
#define MMC_CAP_NONREMOVABLE (1 << 8) /* Nonremovable e.g. eMMC */
#define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
+#define MMC_CAP_DONT_POWER_CARD (1 << 10) /* Keep the card powered off */
mmc_pm_flag_t pm_caps; /* supported pm features */