提交 148b8b39 编写于 作者: R Rabin Vincent 提交者: Russell King

ARM: 6308/1: mmci: support card detection interrupts

If an IRQ can be requested on the card detected GPIO, use it instead of
polling.
Acked-by: NLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: NRabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 8301bb68
...@@ -601,6 +601,15 @@ static int mmci_get_cd(struct mmc_host *mmc) ...@@ -601,6 +601,15 @@ static int mmci_get_cd(struct mmc_host *mmc)
return status; return status;
} }
static irqreturn_t mmci_cd_irq(int irq, void *dev_id)
{
struct mmci_host *host = dev_id;
mmc_detect_change(host->mmc, msecs_to_jiffies(500));
return IRQ_HANDLED;
}
static const struct mmc_host_ops mmci_ops = { static const struct mmc_host_ops mmci_ops = {
.request = mmci_request, .request = mmci_request,
.set_ios = mmci_set_ios, .set_ios = mmci_set_ios,
...@@ -637,6 +646,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) ...@@ -637,6 +646,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
host->gpio_wp = -ENOSYS; host->gpio_wp = -ENOSYS;
host->gpio_cd = -ENOSYS; host->gpio_cd = -ENOSYS;
host->gpio_cd_irq = -1;
host->hw_designer = amba_manf(dev); host->hw_designer = amba_manf(dev);
host->hw_revision = amba_rev(dev); host->hw_revision = amba_rev(dev);
...@@ -716,7 +726,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) ...@@ -716,7 +726,6 @@ 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
...@@ -761,6 +770,12 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) ...@@ -761,6 +770,12 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
host->gpio_cd = plat->gpio_cd; host->gpio_cd = plat->gpio_cd;
else if (ret != -ENOSYS) else if (ret != -ENOSYS)
goto err_gpio_cd; goto err_gpio_cd;
ret = request_any_context_irq(gpio_to_irq(plat->gpio_cd),
mmci_cd_irq, 0,
DRIVER_NAME " (cd)", host);
if (ret >= 0)
host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd);
} }
if (gpio_is_valid(plat->gpio_wp)) { if (gpio_is_valid(plat->gpio_wp)) {
ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)");
...@@ -772,6 +787,9 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) ...@@ -772,6 +787,9 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
goto err_gpio_wp; goto err_gpio_wp;
} }
if (host->gpio_cd_irq < 0)
mmc->caps |= MMC_CAP_NEEDS_POLL;
ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host); ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host);
if (ret) if (ret)
goto unmap; goto unmap;
...@@ -798,6 +816,8 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) ...@@ -798,6 +816,8 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
if (host->gpio_wp != -ENOSYS) if (host->gpio_wp != -ENOSYS)
gpio_free(host->gpio_wp); gpio_free(host->gpio_wp);
err_gpio_wp: err_gpio_wp:
if (host->gpio_cd_irq >= 0)
free_irq(host->gpio_cd_irq, host);
if (host->gpio_cd != -ENOSYS) if (host->gpio_cd != -ENOSYS)
gpio_free(host->gpio_cd); gpio_free(host->gpio_cd);
err_gpio_cd: err_gpio_cd:
...@@ -836,6 +856,8 @@ static int __devexit mmci_remove(struct amba_device *dev) ...@@ -836,6 +856,8 @@ static int __devexit mmci_remove(struct amba_device *dev)
if (host->gpio_wp != -ENOSYS) if (host->gpio_wp != -ENOSYS)
gpio_free(host->gpio_wp); gpio_free(host->gpio_wp);
if (host->gpio_cd_irq >= 0)
free_irq(host->gpio_cd_irq, host);
if (host->gpio_cd != -ENOSYS) if (host->gpio_cd != -ENOSYS)
gpio_free(host->gpio_cd); gpio_free(host->gpio_cd);
......
...@@ -147,6 +147,7 @@ struct mmci_host { ...@@ -147,6 +147,7 @@ struct mmci_host {
struct clk *clk; struct clk *clk;
int gpio_cd; int gpio_cd;
int gpio_wp; int gpio_wp;
int gpio_cd_irq;
unsigned int data_xfered; unsigned int data_xfered;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册