aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2009-09-22 19:44:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:34 -0400
commit5e2ea6173d71cee81e53da00911dcab8cc092acc (patch)
treea94aee4db6354470ccaabc77ab83d9e297e2b083 /drivers
parentd900f7128cf73d77467209672db2dcf0ff02dde6 (diff)
omap_hsmmc: make use of new enable/disable interface
For the moment enable / disable just turns the fclk on and off. 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')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c68
1 files changed, 58 insertions, 10 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 259c07d61a81..7699f0aeb58d 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -605,7 +605,9 @@ static void mmc_omap_detect(struct work_struct *work)
605 if (host->carddetect) { 605 if (host->carddetect) {
606 mmc_detect_change(host->mmc, (HZ * 200) / 1000); 606 mmc_detect_change(host->mmc, (HZ * 200) / 1000);
607 } else { 607 } else {
608 mmc_host_enable(host->mmc);
608 mmc_omap_reset_controller_fsm(host, SRD); 609 mmc_omap_reset_controller_fsm(host, SRD);
610 mmc_host_lazy_disable(host->mmc);
609 mmc_detect_change(host->mmc, (HZ * 50) / 1000); 611 mmc_detect_change(host->mmc, (HZ * 50) / 1000);
610 } 612 }
611} 613}
@@ -818,6 +820,27 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
818 return 0; 820 return 0;
819} 821}
820 822
823static int omap_mmc_enable(struct mmc_host *mmc)
824{
825 struct mmc_omap_host *host = mmc_priv(mmc);
826 int err;
827
828 err = clk_enable(host->fclk);
829 if (err)
830 return err;
831 dev_dbg(mmc_dev(host->mmc), "mmc_fclk: enabled\n");
832 return 0;
833}
834
835static int omap_mmc_disable(struct mmc_host *mmc, int lazy)
836{
837 struct mmc_omap_host *host = mmc_priv(mmc);
838
839 clk_disable(host->fclk);
840 dev_dbg(mmc_dev(host->mmc), "mmc_fclk: disabled\n");
841 return 0;
842}
843
821/* 844/*
822 * Request function. for read/write operation 845 * Request function. for read/write operation
823 */ 846 */
@@ -841,6 +864,8 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
841 unsigned long timeout; 864 unsigned long timeout;
842 u32 con; 865 u32 con;
843 866
867 mmc_host_enable(host->mmc);
868
844 switch (ios->power_mode) { 869 switch (ios->power_mode) {
845 case MMC_POWER_OFF: 870 case MMC_POWER_OFF:
846 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0); 871 mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0);
@@ -919,6 +944,8 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
919 if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN) 944 if (ios->bus_mode == MMC_BUSMODE_OPENDRAIN)
920 OMAP_HSMMC_WRITE(host->base, CON, 945 OMAP_HSMMC_WRITE(host->base, CON,
921 OMAP_HSMMC_READ(host->base, CON) | OD); 946 OMAP_HSMMC_READ(host->base, CON) | OD);
947
948 mmc_host_lazy_disable(host->mmc);
922} 949}
923 950
924static int omap_hsmmc_get_cd(struct mmc_host *mmc) 951static int omap_hsmmc_get_cd(struct mmc_host *mmc)
@@ -969,6 +996,8 @@ static void omap_hsmmc_init(struct mmc_omap_host *host)
969} 996}
970 997
971static struct mmc_host_ops mmc_omap_ops = { 998static struct mmc_host_ops mmc_omap_ops = {
999 .enable = omap_mmc_enable,
1000 .disable = omap_mmc_disable,
972 .request = omap_mmc_request, 1001 .request = omap_mmc_request,
973 .set_ios = omap_mmc_set_ios, 1002 .set_ios = omap_mmc_set_ios,
974 .get_cd = omap_hsmmc_get_cd, 1003 .get_cd = omap_hsmmc_get_cd,
@@ -983,7 +1012,16 @@ static int mmc_regs_show(struct seq_file *s, void *data)
983 struct mmc_host *mmc = s->private; 1012 struct mmc_host *mmc = s->private;
984 struct mmc_omap_host *host = mmc_priv(mmc); 1013 struct mmc_omap_host *host = mmc_priv(mmc);
985 1014
986 seq_printf(s, "mmc%d regs:\n", mmc->index); 1015 seq_printf(s, "mmc%d:\n"
1016 " enabled:\t%d\n"
1017 " nesting_cnt:\t%d\n"
1018 "\nregs:\n",
1019 mmc->index, mmc->enabled ? 1 : 0, mmc->nesting_cnt);
1020
1021 if (clk_enable(host->fclk) != 0) {
1022 seq_printf(s, "can't read the regs\n");
1023 goto err;
1024 }
987 1025
988 seq_printf(s, "SYSCONFIG:\t0x%08x\n", 1026 seq_printf(s, "SYSCONFIG:\t0x%08x\n",
989 OMAP_HSMMC_READ(host->base, SYSCONFIG)); 1027 OMAP_HSMMC_READ(host->base, SYSCONFIG));
@@ -999,6 +1037,9 @@ static int mmc_regs_show(struct seq_file *s, void *data)
999 OMAP_HSMMC_READ(host->base, ISE)); 1037 OMAP_HSMMC_READ(host->base, ISE));
1000 seq_printf(s, "CAPA:\t\t0x%08x\n", 1038 seq_printf(s, "CAPA:\t\t0x%08x\n",
1001 OMAP_HSMMC_READ(host->base, CAPA)); 1039 OMAP_HSMMC_READ(host->base, CAPA));
1040
1041 clk_disable(host->fclk);
1042err:
1002 return 0; 1043 return 0;
1003} 1044}
1004 1045
@@ -1099,14 +1140,16 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1099 goto err1; 1140 goto err1;
1100 } 1141 }
1101 1142
1102 if (clk_enable(host->fclk) != 0) { 1143 mmc->caps |= MMC_CAP_DISABLE;
1144 mmc_set_disable_delay(mmc, 100);
1145 if (mmc_host_enable(host->mmc) != 0) {
1103 clk_put(host->iclk); 1146 clk_put(host->iclk);
1104 clk_put(host->fclk); 1147 clk_put(host->fclk);
1105 goto err1; 1148 goto err1;
1106 } 1149 }
1107 1150
1108 if (clk_enable(host->iclk) != 0) { 1151 if (clk_enable(host->iclk) != 0) {
1109 clk_disable(host->fclk); 1152 mmc_host_disable(host->mmc);
1110 clk_put(host->iclk); 1153 clk_put(host->iclk);
1111 clk_put(host->fclk); 1154 clk_put(host->fclk);
1112 goto err1; 1155 goto err1;
@@ -1197,6 +1240,8 @@ static int __init omap_mmc_probe(struct platform_device *pdev)
1197 OMAP_HSMMC_WRITE(host->base, ISE, INT_EN_MASK); 1240 OMAP_HSMMC_WRITE(host->base, ISE, INT_EN_MASK);
1198 OMAP_HSMMC_WRITE(host->base, IE, INT_EN_MASK); 1241 OMAP_HSMMC_WRITE(host->base, IE, INT_EN_MASK);
1199 1242
1243 mmc_host_lazy_disable(host->mmc);
1244
1200 mmc_add_host(mmc); 1245 mmc_add_host(mmc);
1201 1246
1202 if (host->pdata->slots[host->slot_id].name != NULL) { 1247 if (host->pdata->slots[host->slot_id].name != NULL) {
@@ -1225,7 +1270,7 @@ err_irq_cd:
1225err_irq_cd_init: 1270err_irq_cd_init:
1226 free_irq(host->irq, host); 1271 free_irq(host->irq, host);
1227err_irq: 1272err_irq:
1228 clk_disable(host->fclk); 1273 mmc_host_disable(host->mmc);
1229 clk_disable(host->iclk); 1274 clk_disable(host->iclk);
1230 clk_put(host->fclk); 1275 clk_put(host->fclk);
1231 clk_put(host->iclk); 1276 clk_put(host->iclk);
@@ -1250,6 +1295,7 @@ static int omap_mmc_remove(struct platform_device *pdev)
1250 struct resource *res; 1295 struct resource *res;
1251 1296
1252 if (host) { 1297 if (host) {
1298 mmc_host_enable(host->mmc);
1253 mmc_remove_host(host->mmc); 1299 mmc_remove_host(host->mmc);
1254 if (host->pdata->cleanup) 1300 if (host->pdata->cleanup)
1255 host->pdata->cleanup(&pdev->dev); 1301 host->pdata->cleanup(&pdev->dev);
@@ -1258,7 +1304,7 @@ static int omap_mmc_remove(struct platform_device *pdev)
1258 free_irq(mmc_slot(host).card_detect_irq, host); 1304 free_irq(mmc_slot(host).card_detect_irq, host);
1259 flush_scheduled_work(); 1305 flush_scheduled_work();
1260 1306
1261 clk_disable(host->fclk); 1307 mmc_host_disable(host->mmc);
1262 clk_disable(host->iclk); 1308 clk_disable(host->iclk);
1263 clk_put(host->fclk); 1309 clk_put(host->fclk);
1264 clk_put(host->iclk); 1310 clk_put(host->iclk);
@@ -1289,6 +1335,7 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state)
1289 return 0; 1335 return 0;
1290 1336
1291 if (host) { 1337 if (host) {
1338 mmc_host_enable(host->mmc);
1292 ret = mmc_suspend_host(host->mmc, state); 1339 ret = mmc_suspend_host(host->mmc, state);
1293 if (ret == 0) { 1340 if (ret == 0) {
1294 host->suspended = 1; 1341 host->suspended = 1;
@@ -1307,10 +1354,11 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state)
1307 1354
1308 OMAP_HSMMC_WRITE(host->base, HCTL, 1355 OMAP_HSMMC_WRITE(host->base, HCTL,
1309 OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); 1356 OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP);
1310 clk_disable(host->fclk); 1357 mmc_host_disable(host->mmc);
1311 clk_disable(host->iclk); 1358 clk_disable(host->iclk);
1312 clk_disable(host->dbclk); 1359 clk_disable(host->dbclk);
1313 } 1360 } else
1361 mmc_host_disable(host->mmc);
1314 1362
1315 } 1363 }
1316 return ret; 1364 return ret;
@@ -1327,13 +1375,12 @@ static int omap_mmc_resume(struct platform_device *pdev)
1327 1375
1328 if (host) { 1376 if (host) {
1329 1377
1330 ret = clk_enable(host->fclk); 1378 if (mmc_host_enable(host->mmc) != 0)
1331 if (ret)
1332 goto clk_en_err; 1379 goto clk_en_err;
1333 1380
1334 ret = clk_enable(host->iclk); 1381 ret = clk_enable(host->iclk);
1335 if (ret) { 1382 if (ret) {
1336 clk_disable(host->fclk); 1383 mmc_host_disable(host->mmc);
1337 clk_put(host->fclk); 1384 clk_put(host->fclk);
1338 goto clk_en_err; 1385 goto clk_en_err;
1339 } 1386 }
@@ -1355,6 +1402,7 @@ static int omap_mmc_resume(struct platform_device *pdev)
1355 ret = mmc_resume_host(host->mmc); 1402 ret = mmc_resume_host(host->mmc);
1356 if (ret == 0) 1403 if (ret == 0)
1357 host->suspended = 0; 1404 host->suspended = 0;
1405 mmc_host_lazy_disable(host->mmc);
1358 } 1406 }
1359 1407
1360 return ret; 1408 return ret;