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>
This commit is contained in:
committed by
Russell King
parent
528320db01
commit
f5e2574e73
@@ -567,18 +567,6 @@ static const struct mmc_host_ops mmci_ops = {
|
|||||||
.get_cd = mmci_get_cd,
|
.get_cd = mmci_get_cd,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void mmci_check_status(unsigned long data)
|
|
||||||
{
|
|
||||||
struct mmci_host *host = (struct mmci_host *)data;
|
|
||||||
unsigned int status = mmci_get_cd(host->mmc);
|
|
||||||
|
|
||||||
if (status ^ host->oldstat)
|
|
||||||
mmc_detect_change(host->mmc, 0);
|
|
||||||
|
|
||||||
host->oldstat = status;
|
|
||||||
mod_timer(&host->timer, jiffies + HZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
|
static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
|
||||||
{
|
{
|
||||||
struct mmci_platform_data *plat = dev->dev.platform_data;
|
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)
|
|||||||
if (host->vcc == NULL)
|
if (host->vcc == NULL)
|
||||||
mmc->ocr_avail = plat->ocr_mask;
|
mmc->ocr_avail = plat->ocr_mask;
|
||||||
mmc->caps = plat->capabilities;
|
mmc->caps = plat->capabilities;
|
||||||
|
mmc->caps |= MMC_CAP_NEEDS_POLL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can do SGIO
|
* We can do SGIO
|
||||||
@@ -750,7 +739,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
|
|||||||
writel(MCI_IRQENABLE, host->base + MMCIMASK0);
|
writel(MCI_IRQENABLE, host->base + MMCIMASK0);
|
||||||
|
|
||||||
amba_set_drvdata(dev, mmc);
|
amba_set_drvdata(dev, mmc);
|
||||||
host->oldstat = mmci_get_cd(host->mmc);
|
|
||||||
|
|
||||||
mmc_add_host(mmc);
|
mmc_add_host(mmc);
|
||||||
|
|
||||||
@@ -758,12 +746,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
|
|||||||
mmc_hostname(mmc), amba_rev(dev), amba_config(dev),
|
mmc_hostname(mmc), amba_rev(dev), amba_config(dev),
|
||||||
(unsigned long long)dev->res.start, dev->irq[0], dev->irq[1]);
|
(unsigned long long)dev->res.start, dev->irq[0], dev->irq[1]);
|
||||||
|
|
||||||
init_timer(&host->timer);
|
|
||||||
host->timer.data = (unsigned long)host;
|
|
||||||
host->timer.function = mmci_check_status;
|
|
||||||
host->timer.expires = jiffies + HZ;
|
|
||||||
add_timer(&host->timer);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
irq0_free:
|
irq0_free:
|
||||||
@@ -797,8 +779,6 @@ static int __devexit mmci_remove(struct amba_device *dev)
|
|||||||
if (mmc) {
|
if (mmc) {
|
||||||
struct mmci_host *host = mmc_priv(mmc);
|
struct mmci_host *host = mmc_priv(mmc);
|
||||||
|
|
||||||
del_timer_sync(&host->timer);
|
|
||||||
|
|
||||||
mmc_remove_host(mmc);
|
mmc_remove_host(mmc);
|
||||||
|
|
||||||
writel(0, host->base + MMCIMASK0);
|
writel(0, host->base + MMCIMASK0);
|
||||||
|
Reference in New Issue
Block a user