diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-09-16 04:54:30 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2012-10-14 22:05:41 -0400 |
commit | 7f917a8df68985aa38a90b7110b5f42bfa0d7cda (patch) | |
tree | 1b7f0449267b5f573ccf0b51df0616a4f5533159 /drivers/mmc | |
parent | 27b76486a3e5be1cfd19dc59452e4185c5d43dff (diff) |
mmc: mxcmmc: remove cpu_is_xxx by using platform_device_id
It changes the driver to use platform_device_id rather than cpu_is_xxx
to determine the controller type, and updates the platform code
accordingly.
As the result, mach/hardware.h inclusion gets removed from the driver.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Chris Ball <cjb@laptop.org>
Tested-by: Javier Martin <javier.martin@vista-silicon.com>
Cc: linux-mmc@vger.kernel.org
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/mxcmmc.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 565c2e4fac75..d735ba913f9b 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/platform_data/mmc-mxcmmc.h> | 41 | #include <linux/platform_data/mmc-mxcmmc.h> |
42 | 42 | ||
43 | #include <linux/platform_data/dma-imx.h> | 43 | #include <linux/platform_data/dma-imx.h> |
44 | #include <mach/hardware.h> | ||
45 | 44 | ||
46 | #define DRIVER_NAME "mxc-mmc" | 45 | #define DRIVER_NAME "mxc-mmc" |
47 | #define MXCMCI_TIMEOUT_MS 10000 | 46 | #define MXCMCI_TIMEOUT_MS 10000 |
@@ -113,6 +112,11 @@ | |||
113 | #define INT_WRITE_OP_DONE_EN (1 << 1) | 112 | #define INT_WRITE_OP_DONE_EN (1 << 1) |
114 | #define INT_READ_OP_EN (1 << 0) | 113 | #define INT_READ_OP_EN (1 << 0) |
115 | 114 | ||
115 | enum mxcmci_type { | ||
116 | IMX21_MMC, | ||
117 | IMX31_MMC, | ||
118 | }; | ||
119 | |||
116 | struct mxcmci_host { | 120 | struct mxcmci_host { |
117 | struct mmc_host *mmc; | 121 | struct mmc_host *mmc; |
118 | struct resource *res; | 122 | struct resource *res; |
@@ -153,7 +157,26 @@ struct mxcmci_host { | |||
153 | struct imx_dma_data dma_data; | 157 | struct imx_dma_data dma_data; |
154 | 158 | ||
155 | struct timer_list watchdog; | 159 | struct timer_list watchdog; |
160 | enum mxcmci_type devtype; | ||
161 | }; | ||
162 | |||
163 | static struct platform_device_id mxcmci_devtype[] = { | ||
164 | { | ||
165 | .name = "imx21-mmc", | ||
166 | .driver_data = IMX21_MMC, | ||
167 | }, { | ||
168 | .name = "imx31-mmc", | ||
169 | .driver_data = IMX31_MMC, | ||
170 | }, { | ||
171 | /* sentinel */ | ||
172 | } | ||
156 | }; | 173 | }; |
174 | MODULE_DEVICE_TABLE(platform, mxcmci_devtype); | ||
175 | |||
176 | static inline int is_imx31_mmc(struct mxcmci_host *host) | ||
177 | { | ||
178 | return host->devtype == IMX31_MMC; | ||
179 | } | ||
157 | 180 | ||
158 | static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios); | 181 | static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios); |
159 | 182 | ||
@@ -843,6 +866,8 @@ static void mxcmci_enable_sdio_irq(struct mmc_host *mmc, int enable) | |||
843 | 866 | ||
844 | static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) | 867 | static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) |
845 | { | 868 | { |
869 | struct mxcmci_host *mxcmci = mmc_priv(host); | ||
870 | |||
846 | /* | 871 | /* |
847 | * MX3 SoCs have a silicon bug which corrupts CRC calculation of | 872 | * MX3 SoCs have a silicon bug which corrupts CRC calculation of |
848 | * multi-block transfers when connected SDIO peripheral doesn't | 873 | * multi-block transfers when connected SDIO peripheral doesn't |
@@ -850,7 +875,7 @@ static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) | |||
850 | * One way to prevent this is to only allow 1-bit transfers. | 875 | * One way to prevent this is to only allow 1-bit transfers. |
851 | */ | 876 | */ |
852 | 877 | ||
853 | if (cpu_is_mx3() && card->type == MMC_TYPE_SDIO) | 878 | if (is_imx31_mmc(mxcmci) && card->type == MMC_TYPE_SDIO) |
854 | host->caps &= ~MMC_CAP_4_BIT_DATA; | 879 | host->caps &= ~MMC_CAP_4_BIT_DATA; |
855 | else | 880 | else |
856 | host->caps |= MMC_CAP_4_BIT_DATA; | 881 | host->caps |= MMC_CAP_4_BIT_DATA; |
@@ -948,6 +973,7 @@ static int mxcmci_probe(struct platform_device *pdev) | |||
948 | 973 | ||
949 | host->mmc = mmc; | 974 | host->mmc = mmc; |
950 | host->pdata = pdev->dev.platform_data; | 975 | host->pdata = pdev->dev.platform_data; |
976 | host->devtype = pdev->id_entry->driver_data; | ||
951 | spin_lock_init(&host->lock); | 977 | spin_lock_init(&host->lock); |
952 | 978 | ||
953 | mxcmci_init_ocr(host); | 979 | mxcmci_init_ocr(host); |
@@ -1120,6 +1146,7 @@ static const struct dev_pm_ops mxcmci_pm_ops = { | |||
1120 | static struct platform_driver mxcmci_driver = { | 1146 | static struct platform_driver mxcmci_driver = { |
1121 | .probe = mxcmci_probe, | 1147 | .probe = mxcmci_probe, |
1122 | .remove = mxcmci_remove, | 1148 | .remove = mxcmci_remove, |
1149 | .id_table = mxcmci_devtype, | ||
1123 | .driver = { | 1150 | .driver = { |
1124 | .name = DRIVER_NAME, | 1151 | .name = DRIVER_NAME, |
1125 | .owner = THIS_MODULE, | 1152 | .owner = THIS_MODULE, |