]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mmc: atmel-mci: add vmmc-supply support
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 17 Oct 2013 10:46:48 +0000 (12:46 +0200)
committerChris Ball <chris@printf.net>
Mon, 13 Jan 2014 18:03:40 +0000 (13:03 -0500)
Other MMC hosts handle a regulator named vmmc-supply that allows to power
the MMC card or SDIO device before communicating on the bus.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/host/atmel-mci.c

index 945a31d7736441ce9bf381ca5b87c25358f5369a..42706ea0ba85407cdead6259756fd4ed1b898016 100644 (file)
@@ -1402,8 +1402,14 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
                clk_unprepare(host->mck);
 
        switch (ios->power_mode) {
+       case MMC_POWER_OFF:
+               if (!IS_ERR(mmc->supply.vmmc))
+                       mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
+               break;
        case MMC_POWER_UP:
                set_bit(ATMCI_CARD_NEED_INIT, &slot->flags);
+               if (!IS_ERR(mmc->supply.vmmc))
+                       mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
                break;
        default:
                /*
@@ -2215,6 +2221,7 @@ static int __init atmci_init_slot(struct atmel_mci *host,
        }
 
        host->slot[id] = slot;
+       mmc_regulator_get_supply(mmc);
        mmc_add_host(mmc);
 
        if (gpio_is_valid(slot->detect_pin)) {