aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2008-06-17 10:17:15 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-07-15 08:14:41 -0400
commit28f52482b41edc88cdf575aa6ed414c6e116ce10 (patch)
tree541acd881953e43113f3653ac482a83ab7afa017 /drivers/mmc
parent150a55683b6b0ccb66aae75a10a3a514340c7c03 (diff)
mmc: add support for card-detection polling
Some hosts (and boards that use mmc_spi) do not use interrupts on the CD line, so they can't trigger mmc_detect_change. We want to poll the card and see if there was a change. 1 second poll interval seems resonable. This patch also implements .get_cd() host operation, that could be used by the hosts that are able to report card-detect status without need to talk MMC. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/core.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 01ced4c5a61d..ede5d1e2e20d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -638,6 +638,9 @@ void mmc_rescan(struct work_struct *work)
638 */ 638 */
639 mmc_bus_put(host); 639 mmc_bus_put(host);
640 640
641 if (host->ops->get_cd && host->ops->get_cd(host) == 0)
642 goto out;
643
641 mmc_claim_host(host); 644 mmc_claim_host(host);
642 645
643 mmc_power_up(host); 646 mmc_power_up(host);
@@ -652,7 +655,7 @@ void mmc_rescan(struct work_struct *work)
652 if (!err) { 655 if (!err) {
653 if (mmc_attach_sdio(host, ocr)) 656 if (mmc_attach_sdio(host, ocr))
654 mmc_power_off(host); 657 mmc_power_off(host);
655 return; 658 goto out;
656 } 659 }
657 660
658 /* 661 /*
@@ -662,7 +665,7 @@ void mmc_rescan(struct work_struct *work)
662 if (!err) { 665 if (!err) {
663 if (mmc_attach_sd(host, ocr)) 666 if (mmc_attach_sd(host, ocr))
664 mmc_power_off(host); 667 mmc_power_off(host);
665 return; 668 goto out;
666 } 669 }
667 670
668 /* 671 /*
@@ -672,7 +675,7 @@ void mmc_rescan(struct work_struct *work)
672 if (!err) { 675 if (!err) {
673 if (mmc_attach_mmc(host, ocr)) 676 if (mmc_attach_mmc(host, ocr))
674 mmc_power_off(host); 677 mmc_power_off(host);
675 return; 678 goto out;
676 } 679 }
677 680
678 mmc_release_host(host); 681 mmc_release_host(host);
@@ -683,6 +686,9 @@ void mmc_rescan(struct work_struct *work)
683 686
684 mmc_bus_put(host); 687 mmc_bus_put(host);
685 } 688 }
689out:
690 if (host->caps & MMC_CAP_NEEDS_POLL)
691 mmc_schedule_delayed_work(&host->detect, HZ);
686} 692}
687 693
688void mmc_start_host(struct mmc_host *host) 694void mmc_start_host(struct mmc_host *host)