aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorBen Dooks <ben@simtec.co.uk>2009-10-01 18:44:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-10-01 19:11:15 -0400
commit00acfaeead211562cc5f88882c47bf1cb16c041a (patch)
tree3190a145fb984c06b0f6fccf3186f40b6d723bf3 /drivers/mmc
parent5a2c4fe04dca1ee801d20fa07f347a9d6b7ec521 (diff)
s3cmci: add better support for no card detect or write protect available
Add better support for omitting either the card detect or the write protect GPIOs if the board does not support it. Add the fields no_wprotect and no_detect to the platform data which when set indicate the absence of the respective GPIOs. Note, this also fixes a minor bug where it tries to free IRQ0 if there is no detect gpio available. Signed-off-by: Ben Dooks <ben@simtec.co.uk> 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/mmc')
-rw-r--r--drivers/mmc/host/s3cmci.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
index 4b627ca16cca..99b74a351020 100644
--- a/drivers/mmc/host/s3cmci.c
+++ b/drivers/mmc/host/s3cmci.c
@@ -1299,7 +1299,7 @@ static int s3cmci_get_ro(struct mmc_host *mmc)
1299 struct s3c24xx_mci_pdata *pdata = host->pdata; 1299 struct s3c24xx_mci_pdata *pdata = host->pdata;
1300 int ret; 1300 int ret;
1301 1301
1302 if (pdata->gpio_wprotect == 0) 1302 if (pdata->no_wprotect)
1303 return 0; 1303 return 0;
1304 1304
1305 ret = s3c2410_gpio_getpin(pdata->gpio_wprotect); 1305 ret = s3c2410_gpio_getpin(pdata->gpio_wprotect);
@@ -1647,30 +1647,34 @@ static int __devinit s3cmci_probe(struct platform_device *pdev)
1647 disable_irq(host->irq); 1647 disable_irq(host->irq);
1648 host->irq_state = false; 1648 host->irq_state = false;
1649 1649
1650 if (host->pdata->gpio_detect) { 1650 if (!host->pdata->no_detect) {
1651 ret = gpio_request(host->pdata->gpio_detect, "s3cmci detect"); 1651 ret = gpio_request(host->pdata->gpio_detect, "s3cmci detect");
1652 if (ret) { 1652 if (ret) {
1653 dev_err(&pdev->dev, "failed to get detect gpio\n"); 1653 dev_err(&pdev->dev, "failed to get detect gpio\n");
1654 goto probe_free_irq; 1654 goto probe_free_irq;
1655 } 1655 }
1656 }
1657
1658 host->irq_cd = s3c2410_gpio_getirq(host->pdata->gpio_detect);
1659 1656
1660 if (host->irq_cd >= 0) { 1657 host->irq_cd = s3c2410_gpio_getirq(host->pdata->gpio_detect);
1661 if (request_irq(host->irq_cd, s3cmci_irq_cd, 1658
1662 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, 1659 if (host->irq_cd >= 0) {
1663 DRIVER_NAME, host)) { 1660 if (request_irq(host->irq_cd, s3cmci_irq_cd,
1664 dev_err(&pdev->dev, "can't get card detect irq.\n"); 1661 IRQF_TRIGGER_RISING |
1665 ret = -ENOENT; 1662 IRQF_TRIGGER_FALLING,
1666 goto probe_free_gpio_cd; 1663 DRIVER_NAME, host)) {
1664 dev_err(&pdev->dev,
1665 "can't get card detect irq.\n");
1666 ret = -ENOENT;
1667 goto probe_free_gpio_cd;
1668 }
1669 } else {
1670 dev_warn(&pdev->dev,
1671 "host detect has no irq available\n");
1672 gpio_direction_input(host->pdata->gpio_detect);
1667 } 1673 }
1668 } else { 1674 } else
1669 dev_warn(&pdev->dev, "host detect has no irq available\n"); 1675 host->irq_cd = -1;
1670 gpio_direction_input(host->pdata->gpio_detect);
1671 }
1672 1676
1673 if (host->pdata->gpio_wprotect) { 1677 if (!host->pdata->no_wprotect) {
1674 ret = gpio_request(host->pdata->gpio_wprotect, "s3cmci wp"); 1678 ret = gpio_request(host->pdata->gpio_wprotect, "s3cmci wp");
1675 if (ret) { 1679 if (ret) {
1676 dev_err(&pdev->dev, "failed to get writeprotect\n"); 1680 dev_err(&pdev->dev, "failed to get writeprotect\n");
@@ -1774,11 +1778,11 @@ static int __devinit s3cmci_probe(struct platform_device *pdev)
1774 s3c2410_dma_free(host->dma, &s3cmci_dma_client); 1778 s3c2410_dma_free(host->dma, &s3cmci_dma_client);
1775 1779
1776 probe_free_gpio_wp: 1780 probe_free_gpio_wp:
1777 if (host->pdata->gpio_wprotect) 1781 if (!host->pdata->no_wprotect)
1778 gpio_free(host->pdata->gpio_wprotect); 1782 gpio_free(host->pdata->gpio_wprotect);
1779 1783
1780 probe_free_gpio_cd: 1784 probe_free_gpio_cd:
1781 if (host->pdata->gpio_detect) 1785 if (!host->pdata->no_detect)
1782 gpio_free(host->pdata->gpio_detect); 1786 gpio_free(host->pdata->gpio_detect);
1783 1787
1784 probe_free_irq_cd: 1788 probe_free_irq_cd:
@@ -1837,10 +1841,10 @@ static int __devexit s3cmci_remove(struct platform_device *pdev)
1837 1841
1838 free_irq(host->irq, host); 1842 free_irq(host->irq, host);
1839 1843
1840 if (pd->gpio_wprotect) 1844 if (!pd->no_wprotect)
1841 gpio_free(pd->gpio_wprotect); 1845 gpio_free(pd->gpio_wprotect);
1842 1846
1843 if (pd->gpio_detect) 1847 if (!pd->no_detect)
1844 gpio_free(pd->gpio_detect); 1848 gpio_free(pd->gpio_detect);
1845 1849
1846 for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) 1850 for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++)