aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-imx/mx1ads.c2
-rw-r--r--drivers/mmc/host/imxmmc.c16
-rw-r--r--include/asm-arm/arch-imx/mmc.h5
3 files changed, 19 insertions, 4 deletions
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index da893c80d471..a9778c1587ab 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -116,7 +116,7 @@ static struct platform_device *devices[] __initdata = {
116}; 116};
117 117
118#ifdef CONFIG_MMC_IMX 118#ifdef CONFIG_MMC_IMX
119static int mx1ads_mmc_card_present(void) 119static int mx1ads_mmc_card_present(struct device *dev)
120{ 120{
121 /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */ 121 /* MMC/SD Card Detect is PB 20 on MX1ADS V1.0.7 */
122 return (SSR(1) & (1 << 20) ? 0 : 1); 122 return (SSR(1) & (1 << 20) ? 0 : 1);
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index e33c123c7027..6ebc41e7592c 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -884,9 +884,21 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
884 } 884 }
885} 885}
886 886
887static int imxmci_get_ro(struct mmc_host *mmc)
888{
889 struct imxmci_host *host = mmc_priv(mmc);
890
891 if (host->pdata && host->pdata->get_ro)
892 return host->pdata->get_ro(mmc_dev(mmc));
893 /* Host doesn't support read only detection so assume writeable */
894 return 0;
895}
896
897
887static const struct mmc_host_ops imxmci_ops = { 898static const struct mmc_host_ops imxmci_ops = {
888 .request = imxmci_request, 899 .request = imxmci_request,
889 .set_ios = imxmci_set_ios, 900 .set_ios = imxmci_set_ios,
901 .get_ro = imxmci_get_ro,
890}; 902};
891 903
892static struct resource *platform_device_resource(struct platform_device *dev, unsigned int mask, int nr) 904static struct resource *platform_device_resource(struct platform_device *dev, unsigned int mask, int nr)
@@ -913,7 +925,7 @@ static void imxmci_check_status(unsigned long data)
913{ 925{
914 struct imxmci_host *host = (struct imxmci_host *)data; 926 struct imxmci_host *host = (struct imxmci_host *)data;
915 927
916 if( host->pdata->card_present() != host->present ) { 928 if( host->pdata->card_present(mmc_dev(host->mmc)) != host->present ) {
917 host->present ^= 1; 929 host->present ^= 1;
918 dev_info(mmc_dev(host->mmc), "card %s\n", 930 dev_info(mmc_dev(host->mmc), "card %s\n",
919 host->present ? "inserted" : "removed"); 931 host->present ? "inserted" : "removed");
@@ -1022,7 +1034,7 @@ static int imxmci_probe(struct platform_device *pdev)
1022 if (ret) 1034 if (ret)
1023 goto out; 1035 goto out;
1024 1036
1025 host->present = host->pdata->card_present(); 1037 host->present = host->pdata->card_present(mmc_dev(mmc));
1026 init_timer(&host->timer); 1038 init_timer(&host->timer);
1027 host->timer.data = (unsigned long)host; 1039 host->timer.data = (unsigned long)host;
1028 host->timer.function = imxmci_check_status; 1040 host->timer.function = imxmci_check_status;
diff --git a/include/asm-arm/arch-imx/mmc.h b/include/asm-arm/arch-imx/mmc.h
index 84c726934ace..4712f354dcca 100644
--- a/include/asm-arm/arch-imx/mmc.h
+++ b/include/asm-arm/arch-imx/mmc.h
@@ -3,8 +3,11 @@
3 3
4#include <linux/mmc/host.h> 4#include <linux/mmc/host.h>
5 5
6struct device;
7
6struct imxmmc_platform_data { 8struct imxmmc_platform_data {
7 int (*card_present)(void); 9 int (*card_present)(struct device *);
10 int (*get_ro)(struct device *);
8}; 11};
9 12
10extern void imx_set_mmc_info(struct imxmmc_platform_data *info); 13extern void imx_set_mmc_info(struct imxmmc_platform_data *info);