diff options
author | Pavel Pisa <ppisa4lists@pikron.com> | 2007-09-23 16:59:01 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-24 13:33:14 -0400 |
commit | faf39ede5e6325d3e91b6e4e0017d27fbecb6022 (patch) | |
tree | 52c99935cda486c982f1ff6c238ceb12b7601498 /drivers/mmc | |
parent | af8350c756cb48a738474738f7bf8c0e572fa057 (diff) |
arm: i.MX/MX1 SDHC implements SD cards read-only switch read-back
The patch enables to define MMC host get_ro() method through platform data.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/imxmmc.c | 16 |
1 files changed, 14 insertions, 2 deletions
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 | ||
887 | static 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 | |||
887 | static const struct mmc_host_ops imxmci_ops = { | 898 | static 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 | ||
892 | static struct resource *platform_device_resource(struct platform_device *dev, unsigned int mask, int nr) | 904 | static 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; |