diff options
author | Ido Yariv <ido@wizery.com> | 2011-07-28 16:49:09 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2011-09-17 06:23:23 -0400 |
commit | 4a9de8ad2cea3c952e8b1cff8aa9289cd9d66c62 (patch) | |
tree | aeda6998868a604d0bac882206f18dab598b5cbc /drivers/mmc/host/davinci_mmc.c | |
parent | 6836989c35b285b566b932fdbb8402edf8fcc887 (diff) |
mmc: davinci: Add support for set_power callback
Some devices connected to the MMC bus are power controlled by external
means. For instance, an SDIO device may be powered down/up by an
external gpio line.
In order to avoid toggling power from within the MMC host driver, add a
set_power callback function, which will be called by set_ios upon
powering down/up.
Signed-off-by: Ido Yariv <ido@wizery.com>
CC: Chris Ball <cjb@laptop.org>
Acked-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'drivers/mmc/host/davinci_mmc.c')
-rw-r--r-- | drivers/mmc/host/davinci_mmc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c index 0076c7448fe6..64a8325a4a8a 100644 --- a/drivers/mmc/host/davinci_mmc.c +++ b/drivers/mmc/host/davinci_mmc.c | |||
@@ -807,12 +807,25 @@ static void calculate_clk_divider(struct mmc_host *mmc, struct mmc_ios *ios) | |||
807 | static void mmc_davinci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | 807 | static void mmc_davinci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
808 | { | 808 | { |
809 | struct mmc_davinci_host *host = mmc_priv(mmc); | 809 | struct mmc_davinci_host *host = mmc_priv(mmc); |
810 | struct platform_device *pdev = to_platform_device(mmc->parent); | ||
811 | struct davinci_mmc_config *config = pdev->dev.platform_data; | ||
810 | 812 | ||
811 | dev_dbg(mmc_dev(host->mmc), | 813 | dev_dbg(mmc_dev(host->mmc), |
812 | "clock %dHz busmode %d powermode %d Vdd %04x\n", | 814 | "clock %dHz busmode %d powermode %d Vdd %04x\n", |
813 | ios->clock, ios->bus_mode, ios->power_mode, | 815 | ios->clock, ios->bus_mode, ios->power_mode, |
814 | ios->vdd); | 816 | ios->vdd); |
815 | 817 | ||
818 | switch (ios->power_mode) { | ||
819 | case MMC_POWER_OFF: | ||
820 | if (config && config->set_power) | ||
821 | config->set_power(pdev->id, false); | ||
822 | break; | ||
823 | case MMC_POWER_UP: | ||
824 | if (config && config->set_power) | ||
825 | config->set_power(pdev->id, true); | ||
826 | break; | ||
827 | } | ||
828 | |||
816 | switch (ios->bus_width) { | 829 | switch (ios->bus_width) { |
817 | case MMC_BUS_WIDTH_8: | 830 | case MMC_BUS_WIDTH_8: |
818 | dev_dbg(mmc_dev(host->mmc), "Enabling 8 bit mode\n"); | 831 | dev_dbg(mmc_dev(host->mmc), "Enabling 8 bit mode\n"); |