aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-07-21 07:50:31 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-27 05:48:44 -0400
commitf5e2574e734650bbeb801a31cc99e628f9a027af (patch)
treee7705dae6e6be70cc7b20129471c2498f9def7ac /drivers
parent528320db013b687c5f0150fd77eb4dc02ca328d1 (diff)
ARM: 6239/1: mmci: let core poll for card detection
Use the MMC core's ability to poll for card detection. This also has the advantage of doing the gpio_get_value from a workqueue instead of timer, allowing the gpio to be on a sleeping gpiochip. Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/mmci.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index ddcfc4c7e6ac..3eaa0e9373cd 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -567,18 +567,6 @@ static const struct mmc_host_ops mmci_ops = {
567 .get_cd = mmci_get_cd, 567 .get_cd = mmci_get_cd,
568}; 568};
569 569
570static void mmci_check_status(unsigned long data)
571{
572 struct mmci_host *host = (struct mmci_host *)data;
573 unsigned int status = mmci_get_cd(host->mmc);
574
575 if (status ^ host->oldstat)
576 mmc_detect_change(host->mmc, 0);
577
578 host->oldstat = status;
579 mod_timer(&host->timer, jiffies + HZ);
580}
581
582static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) 570static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
583{ 571{
584 struct mmci_platform_data *plat = dev->dev.platform_data; 572 struct mmci_platform_data *plat = dev->dev.platform_data;
@@ -685,6 +673,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
685 if (host->vcc == NULL) 673 if (host->vcc == NULL)
686 mmc->ocr_avail = plat->ocr_mask; 674 mmc->ocr_avail = plat->ocr_mask;
687 mmc->caps = plat->capabilities; 675 mmc->caps = plat->capabilities;
676 mmc->caps |= MMC_CAP_NEEDS_POLL;
688 677
689 /* 678 /*
690 * We can do SGIO 679 * We can do SGIO
@@ -750,7 +739,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
750 writel(MCI_IRQENABLE, host->base + MMCIMASK0); 739 writel(MCI_IRQENABLE, host->base + MMCIMASK0);
751 740
752 amba_set_drvdata(dev, mmc); 741 amba_set_drvdata(dev, mmc);
753 host->oldstat = mmci_get_cd(host->mmc);
754 742
755 mmc_add_host(mmc); 743 mmc_add_host(mmc);
756 744
@@ -758,12 +746,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
758 mmc_hostname(mmc), amba_rev(dev), amba_config(dev), 746 mmc_hostname(mmc), amba_rev(dev), amba_config(dev),
759 (unsigned long long)dev->res.start, dev->irq[0], dev->irq[1]); 747 (unsigned long long)dev->res.start, dev->irq[0], dev->irq[1]);
760 748
761 init_timer(&host->timer);
762 host->timer.data = (unsigned long)host;
763 host->timer.function = mmci_check_status;
764 host->timer.expires = jiffies + HZ;
765 add_timer(&host->timer);
766
767 return 0; 749 return 0;
768 750
769 irq0_free: 751 irq0_free:
@@ -797,8 +779,6 @@ static int __devexit mmci_remove(struct amba_device *dev)
797 if (mmc) { 779 if (mmc) {
798 struct mmci_host *host = mmc_priv(mmc); 780 struct mmci_host *host = mmc_priv(mmc);
799 781
800 del_timer_sync(&host->timer);
801
802 mmc_remove_host(mmc); 782 mmc_remove_host(mmc);
803 783
804 writel(0, host->base + MMCIMASK0); 784 writel(0, host->base + MMCIMASK0);