aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-07-31 09:20:16 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-31 09:20:16 -0400
commit7b70c4275f28702b76b273c8534c38f8313812e9 (patch)
tree1df2229ca02466bd1adda814ac5c37aa0a597db1 /drivers/mmc
parentceb0885d3b01bb2e2f18765770e212914f2864be (diff)
parenta20df564d15bd28e3df24e1c65b885bd74d23f17 (diff)
Merge branch 'devel-stable' into devel
Conflicts: arch/arm/kernel/entry-armv.S arch/arm/kernel/setup.c arch/arm/mm/init.c
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/mxcmmc.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index d9d4a72e0ec7..350f78e86245 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -119,6 +119,7 @@ struct mxcmci_host {
119 int detect_irq; 119 int detect_irq;
120 int dma; 120 int dma;
121 int do_dma; 121 int do_dma;
122 int default_irq_mask;
122 int use_sdio; 123 int use_sdio;
123 unsigned int power_mode; 124 unsigned int power_mode;
124 struct imxmmc_platform_data *pdata; 125 struct imxmmc_platform_data *pdata;
@@ -228,7 +229,7 @@ static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data)
228static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, 229static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd,
229 unsigned int cmdat) 230 unsigned int cmdat)
230{ 231{
231 u32 int_cntr; 232 u32 int_cntr = host->default_irq_mask;
232 unsigned long flags; 233 unsigned long flags;
233 234
234 WARN_ON(host->cmd != NULL); 235 WARN_ON(host->cmd != NULL);
@@ -275,7 +276,7 @@ static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd,
275static void mxcmci_finish_request(struct mxcmci_host *host, 276static void mxcmci_finish_request(struct mxcmci_host *host,
276 struct mmc_request *req) 277 struct mmc_request *req)
277{ 278{
278 u32 int_cntr = 0; 279 u32 int_cntr = host->default_irq_mask;
279 unsigned long flags; 280 unsigned long flags;
280 281
281 spin_lock_irqsave(&host->lock, flags); 282 spin_lock_irqsave(&host->lock, flags);
@@ -585,6 +586,9 @@ static irqreturn_t mxcmci_irq(int irq, void *devid)
585 (stat & (STATUS_DATA_TRANS_DONE | STATUS_WRITE_OP_DONE))) 586 (stat & (STATUS_DATA_TRANS_DONE | STATUS_WRITE_OP_DONE)))
586 mxcmci_data_done(host, stat); 587 mxcmci_data_done(host, stat);
587#endif 588#endif
589 if (host->default_irq_mask &&
590 (stat & (STATUS_CARD_INSERTION | STATUS_CARD_REMOVAL)))
591 mmc_detect_change(host->mmc, msecs_to_jiffies(200));
588 return IRQ_HANDLED; 592 return IRQ_HANDLED;
589} 593}
590 594
@@ -809,6 +813,12 @@ static int mxcmci_probe(struct platform_device *pdev)
809 else 813 else
810 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; 814 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
811 815
816 if (host->pdata && host->pdata->dat3_card_detect)
817 host->default_irq_mask =
818 INT_CARD_INSERTION_EN | INT_CARD_REMOVAL_EN;
819 else
820 host->default_irq_mask = 0;
821
812 host->res = r; 822 host->res = r;
813 host->irq = irq; 823 host->irq = irq;
814 824
@@ -835,7 +845,7 @@ static int mxcmci_probe(struct platform_device *pdev)
835 /* recommended in data sheet */ 845 /* recommended in data sheet */
836 writew(0x2db4, host->base + MMC_REG_READ_TO); 846 writew(0x2db4, host->base + MMC_REG_READ_TO);
837 847
838 writel(0, host->base + MMC_REG_INT_CNTR); 848 writel(host->default_irq_mask, host->base + MMC_REG_INT_CNTR);
839 849
840#ifdef HAS_DMA 850#ifdef HAS_DMA
841 host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW); 851 host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW);
@@ -926,43 +936,47 @@ static int mxcmci_remove(struct platform_device *pdev)
926} 936}
927 937
928#ifdef CONFIG_PM 938#ifdef CONFIG_PM
929static int mxcmci_suspend(struct platform_device *dev, pm_message_t state) 939static int mxcmci_suspend(struct device *dev)
930{ 940{
931 struct mmc_host *mmc = platform_get_drvdata(dev); 941 struct mmc_host *mmc = dev_get_drvdata(dev);
942 struct mxcmci_host *host = mmc_priv(mmc);
932 int ret = 0; 943 int ret = 0;
933 944
934 if (mmc) 945 if (mmc)
935 ret = mmc_suspend_host(mmc); 946 ret = mmc_suspend_host(mmc);
947 clk_disable(host->clk);
936 948
937 return ret; 949 return ret;
938} 950}
939 951
940static int mxcmci_resume(struct platform_device *dev) 952static int mxcmci_resume(struct device *dev)
941{ 953{
942 struct mmc_host *mmc = platform_get_drvdata(dev); 954 struct mmc_host *mmc = dev_get_drvdata(dev);
943 struct mxcmci_host *host; 955 struct mxcmci_host *host = mmc_priv(mmc);
944 int ret = 0; 956 int ret = 0;
945 957
946 if (mmc) { 958 clk_enable(host->clk);
947 host = mmc_priv(mmc); 959 if (mmc)
948 ret = mmc_resume_host(mmc); 960 ret = mmc_resume_host(mmc);
949 }
950 961
951 return ret; 962 return ret;
952} 963}
953#else 964
954#define mxcmci_suspend NULL 965static const struct dev_pm_ops mxcmci_pm_ops = {
955#define mxcmci_resume NULL 966 .suspend = mxcmci_suspend,
956#endif /* CONFIG_PM */ 967 .resume = mxcmci_resume,
968};
969#endif
957 970
958static struct platform_driver mxcmci_driver = { 971static struct platform_driver mxcmci_driver = {
959 .probe = mxcmci_probe, 972 .probe = mxcmci_probe,
960 .remove = mxcmci_remove, 973 .remove = mxcmci_remove,
961 .suspend = mxcmci_suspend,
962 .resume = mxcmci_resume,
963 .driver = { 974 .driver = {
964 .name = DRIVER_NAME, 975 .name = DRIVER_NAME,
965 .owner = THIS_MODULE, 976 .owner = THIS_MODULE,
977#ifdef CONFIG_PM
978 .pm = &mxcmci_pm_ops,
979#endif
966 } 980 }
967}; 981};
968 982