aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mmc/host/sh_mmcif.c18
-rw-r--r--include/linux/mmc/sh_mmcif.h2
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 68b31f7c290b..b2af7136cd27 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -54,6 +54,7 @@
54#include <linux/mmc/mmc.h> 54#include <linux/mmc/mmc.h>
55#include <linux/mmc/sdio.h> 55#include <linux/mmc/sdio.h>
56#include <linux/mmc/sh_mmcif.h> 56#include <linux/mmc/sh_mmcif.h>
57#include <linux/mmc/slot-gpio.h>
57#include <linux/mod_devicetable.h> 58#include <linux/mod_devicetable.h>
58#include <linux/pagemap.h> 59#include <linux/pagemap.h>
59#include <linux/platform_device.h> 60#include <linux/platform_device.h>
@@ -1000,6 +1001,10 @@ static int sh_mmcif_get_cd(struct mmc_host *mmc)
1000{ 1001{
1001 struct sh_mmcif_host *host = mmc_priv(mmc); 1002 struct sh_mmcif_host *host = mmc_priv(mmc);
1002 struct sh_mmcif_plat_data *p = host->pd->dev.platform_data; 1003 struct sh_mmcif_plat_data *p = host->pd->dev.platform_data;
1004 int ret = mmc_gpio_get_cd(mmc);
1005
1006 if (ret >= 0)
1007 return ret;
1003 1008
1004 if (!p || !p->get_cd) 1009 if (!p || !p->get_cd)
1005 return -ENOSYS; 1010 return -ENOSYS;
@@ -1372,6 +1377,12 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1372 goto ereqirq1; 1377 goto ereqirq1;
1373 } 1378 }
1374 1379
1380 if (pd && pd->use_cd_gpio) {
1381 ret = mmc_gpio_request_cd(mmc, pd->cd_gpio);
1382 if (ret < 0)
1383 goto erqcd;
1384 }
1385
1375 clk_disable(host->hclk); 1386 clk_disable(host->hclk);
1376 ret = mmc_add_host(mmc); 1387 ret = mmc_add_host(mmc);
1377 if (ret < 0) 1388 if (ret < 0)
@@ -1385,6 +1396,9 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
1385 return ret; 1396 return ret;
1386 1397
1387emmcaddh: 1398emmcaddh:
1399 if (pd && pd->use_cd_gpio)
1400 mmc_gpio_free_cd(mmc);
1401erqcd:
1388 free_irq(irq[1], host); 1402 free_irq(irq[1], host);
1389ereqirq1: 1403ereqirq1:
1390 free_irq(irq[0], host); 1404 free_irq(irq[0], host);
@@ -1405,6 +1419,7 @@ ealloch:
1405static int __devexit sh_mmcif_remove(struct platform_device *pdev) 1419static int __devexit sh_mmcif_remove(struct platform_device *pdev)
1406{ 1420{
1407 struct sh_mmcif_host *host = platform_get_drvdata(pdev); 1421 struct sh_mmcif_host *host = platform_get_drvdata(pdev);
1422 struct sh_mmcif_plat_data *pd = pdev->dev.platform_data;
1408 int irq[2]; 1423 int irq[2];
1409 1424
1410 host->dying = true; 1425 host->dying = true;
@@ -1413,6 +1428,9 @@ static int __devexit sh_mmcif_remove(struct platform_device *pdev)
1413 1428
1414 dev_pm_qos_hide_latency_limit(&pdev->dev); 1429 dev_pm_qos_hide_latency_limit(&pdev->dev);
1415 1430
1431 if (pd && pd->use_cd_gpio)
1432 mmc_gpio_free_cd(host->mmc);
1433
1416 mmc_remove_host(host->mmc); 1434 mmc_remove_host(host->mmc);
1417 sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL); 1435 sh_mmcif_writel(host->addr, MMCIF_CE_INT_MASK, MASK_ALL);
1418 1436
diff --git a/include/linux/mmc/sh_mmcif.h b/include/linux/mmc/sh_mmcif.h
index 05f0e3db1c12..c2f73cbb4d5c 100644
--- a/include/linux/mmc/sh_mmcif.h
+++ b/include/linux/mmc/sh_mmcif.h
@@ -44,6 +44,8 @@ struct sh_mmcif_plat_data {
44 struct sh_mmcif_dma *dma; /* Deprecated. Instead */ 44 struct sh_mmcif_dma *dma; /* Deprecated. Instead */
45 unsigned int slave_id_tx; /* use embedded slave_id_[tr]x */ 45 unsigned int slave_id_tx; /* use embedded slave_id_[tr]x */
46 unsigned int slave_id_rx; 46 unsigned int slave_id_rx;
47 bool use_cd_gpio : 1;
48 unsigned int cd_gpio;
47 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */ 49 u8 sup_pclk; /* 1 :SH7757, 0: SH7724/SH7372 */
48 unsigned long caps; 50 unsigned long caps;
49 u32 ocr; 51 u32 ocr;