aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap_hsmmc.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2009-09-22 19:44:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:34 -0400
commita3621465b4fd91b7f8560f394afc494a57b77501 (patch)
treeb99ffb25d8720d7fa50d878fd65c1573d88de04d /drivers/mmc/host/omap_hsmmc.c
parent1887bde391a3216789c9a03ac111d5f6ebfb0c00 (diff)
omap_hsmmc: keep track of power mode
This patch is preparation for adding context save and restore support. Keep track of the current power mode so that the context restore function can avoid restoring the context for a card if the power has been switched off. If the power is off, the card must be reinitialized anyway which will re-establish the context. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Acked-by: Matt Fleming <matt@console-pimps.org> Cc: Ian Molton <ian@mnementh.co.uk> Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com> Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com> Cc: Denis Karpov <ext-denis.2.karpov@nokia.com> Cc: Pierre Ossman <pierre@ossman.eu> Cc: Philip Langdale <philipl@overt.org> Cc: "Madhusudhan" <madhu.cr@ti.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 7699f0aeb58d..30b863b2c510 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -143,6 +143,7 @@ struct mmc_omap_host {
143 unsigned int dma_len; 143 unsigned int dma_len;
144 unsigned int dma_sg_idx; 144 unsigned int dma_sg_idx;
145 unsigned char bus_mode; 145 unsigned char bus_mode;
146 unsigned char power_mode;
146 u32 *buffer; 147 u32 *buffer;
147 u32 bytesleft; 148 u32 bytesleft;
148 int suspended; 149 int suspended;
@@ -863,16 +864,25 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
863 unsigned long regval; 864 unsigned long regval;
864 unsigned long timeout; 865 unsigned long timeout;
865 u32 con; 866 u32 con;
867 int do_send_init_stream = 0;
866 868
867 mmc_host_enable(host->mmc); 869 mmc_host_enable(host->mmc);
868 870
869 switch (ios->power_mode) { 871 if (ios->power_mode != host->power_mode) {
870 case MMC_POWER_OFF: 872 switch (ios->power_mode) {
871 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); 873 case MMC_POWER_OFF:
872 break; 874 mmc_slot(host).set_power(host->dev, host->slot_id,
873 case MMC_POWER_UP: 875 0, 0);
874 mmc_slot(host).set_power(host->dev, host->slot_id, 1, ios->vdd); 876 break;
875 break; 877 case MMC_POWER_UP:
878 mmc_slot(host).set_power(host->dev, host->slot_id,
879 1, ios->vdd);
880 break;
881 case MMC_POWER_ON:
882 do_send_init_stream = 1;
883 break;
884 }
885 host->power_mode = ios->power_mode;
876 } 886 }
877 887
878 con = OMAP_HSMMC_READ(host->base, CON); 888 con = OMAP_HSMMC_READ(host->base, CON);
@@ -938,7 +948,7 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
938 OMAP_HSMMC_WRITE(host->base, SYSCTL, 948 OMAP_HSMMC_WRITE(host->base, SYSCTL,
939 OMAP_HSMMC_READ(host->base, SYSCTL) | CEN); 949 OMAP_HSMMC_READ(host->base, SYSCTL) | CEN);
940 950
941 if (ios->power_mode == MMC_POWER_ON) 951 if (do_send_init_stream)
942 send_init_stream(host); 952 send_init_stream(host);
943 953
944 if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) 954 if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
@@ -1116,6 +1126,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1116 host->slot_id = 0; 1126 host->slot_id = 0;
1117 host->mapbase = res->start; 1127 host->mapbase = res->start;
1118 host->base = ioremap(host->mapbase, SZ_4K); 1128 host->base = ioremap(host->mapbase, SZ_4K);
1129 host->power_mode = -1;
1119 1130
1120 platform_set_drvdata(pdev, host); 1131 platform_set_drvdata(pdev, host);
1121 INIT_WORK(&host->mmc_carddetect_work, mmc_omap_detect); 1132 INIT_WORK(&host->mmc_carddetect_work, mmc_omap_detect);