diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2011-06-29 21:24:26 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2011-07-26 21:31:27 -0400 |
commit | 57ed3314e0bfa90ea63c63b8d3038814e9d98a20 (patch) | |
tree | ce82f977d851c5cb2b0d6c28da0ef7270f3be848 /drivers | |
parent | 842afc02cf04f0474392b4c5efd808996a804fa6 (diff) |
mmc: sdhci-esdhc-imx: get rid of the uses of cpu_is_mx()
The patch removes all the uses of cpu_is_mx(). Instead, it utilizes
platform_device_id to distinguish the esdhc differences among SoCs.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Chris Ball <cjb@laptop.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/host/sdhci-esdhc-imx.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 58fc6533d250..a0d0da4d9bc8 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/mmc/host.h> | 20 | #include <linux/mmc/host.h> |
21 | #include <linux/mmc/mmc.h> | 21 | #include <linux/mmc/mmc.h> |
22 | #include <linux/mmc/sdio.h> | 22 | #include <linux/mmc/sdio.h> |
23 | #include <mach/hardware.h> | ||
24 | #include <mach/esdhc.h> | 23 | #include <mach/esdhc.h> |
25 | #include "sdhci-pltfm.h" | 24 | #include "sdhci-pltfm.h" |
26 | #include "sdhci-esdhc.h" | 25 | #include "sdhci-esdhc.h" |
@@ -42,12 +41,59 @@ | |||
42 | */ | 41 | */ |
43 | #define ESDHC_FLAG_MULTIBLK_NO_INT (1 << 1) | 42 | #define ESDHC_FLAG_MULTIBLK_NO_INT (1 << 1) |
44 | 43 | ||
44 | enum imx_esdhc_type { | ||
45 | IMX25_ESDHC, | ||
46 | IMX35_ESDHC, | ||
47 | IMX51_ESDHC, | ||
48 | IMX53_ESDHC, | ||
49 | }; | ||
50 | |||
45 | struct pltfm_imx_data { | 51 | struct pltfm_imx_data { |
46 | int flags; | 52 | int flags; |
47 | u32 scratchpad; | 53 | u32 scratchpad; |
54 | enum imx_esdhc_type devtype; | ||
48 | struct esdhc_platform_data boarddata; | 55 | struct esdhc_platform_data boarddata; |
49 | }; | 56 | }; |
50 | 57 | ||
58 | static struct platform_device_id imx_esdhc_devtype[] = { | ||
59 | { | ||
60 | .name = "sdhci-esdhc-imx25", | ||
61 | .driver_data = IMX25_ESDHC, | ||
62 | }, { | ||
63 | .name = "sdhci-esdhc-imx35", | ||
64 | .driver_data = IMX35_ESDHC, | ||
65 | }, { | ||
66 | .name = "sdhci-esdhc-imx51", | ||
67 | .driver_data = IMX51_ESDHC, | ||
68 | }, { | ||
69 | .name = "sdhci-esdhc-imx53", | ||
70 | .driver_data = IMX53_ESDHC, | ||
71 | }, { | ||
72 | /* sentinel */ | ||
73 | } | ||
74 | }; | ||
75 | MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype); | ||
76 | |||
77 | static inline int is_imx25_esdhc(struct pltfm_imx_data *data) | ||
78 | { | ||
79 | return data->devtype == IMX25_ESDHC; | ||
80 | } | ||
81 | |||
82 | static inline int is_imx35_esdhc(struct pltfm_imx_data *data) | ||
83 | { | ||
84 | return data->devtype == IMX35_ESDHC; | ||
85 | } | ||
86 | |||
87 | static inline int is_imx51_esdhc(struct pltfm_imx_data *data) | ||
88 | { | ||
89 | return data->devtype == IMX51_ESDHC; | ||
90 | } | ||
91 | |||
92 | static inline int is_imx53_esdhc(struct pltfm_imx_data *data) | ||
93 | { | ||
94 | return data->devtype == IMX53_ESDHC; | ||
95 | } | ||
96 | |||
51 | static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg) | 97 | static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg) |
52 | { | 98 | { |
53 | void __iomem *base = host->ioaddr + (reg & ~0x3); | 99 | void __iomem *base = host->ioaddr + (reg & ~0x3); |
@@ -262,6 +308,8 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
262 | imx_data = kzalloc(sizeof(struct pltfm_imx_data), GFP_KERNEL); | 308 | imx_data = kzalloc(sizeof(struct pltfm_imx_data), GFP_KERNEL); |
263 | if (!imx_data) | 309 | if (!imx_data) |
264 | return -ENOMEM; | 310 | return -ENOMEM; |
311 | |||
312 | imx_data->devtype = pdev->id_entry->driver_data; | ||
265 | pltfm_host->priv = imx_data; | 313 | pltfm_host->priv = imx_data; |
266 | 314 | ||
267 | clk = clk_get(mmc_dev(host->mmc), NULL); | 315 | clk = clk_get(mmc_dev(host->mmc), NULL); |
@@ -273,14 +321,14 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
273 | clk_enable(clk); | 321 | clk_enable(clk); |
274 | pltfm_host->clk = clk; | 322 | pltfm_host->clk = clk; |
275 | 323 | ||
276 | if (!cpu_is_mx25()) | 324 | if (!is_imx25_esdhc(imx_data)) |
277 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | 325 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
278 | 326 | ||
279 | if (cpu_is_mx25() || cpu_is_mx35()) | 327 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) |
280 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ | 328 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ |
281 | host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; | 329 | host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; |
282 | 330 | ||
283 | if (!(cpu_is_mx25() || cpu_is_mx35() || cpu_is_mx51())) | 331 | if (is_imx53_esdhc(imx_data)) |
284 | imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; | 332 | imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; |
285 | 333 | ||
286 | if (!host->mmc->parent->platform_data) { | 334 | if (!host->mmc->parent->platform_data) { |
@@ -395,6 +443,7 @@ static struct platform_driver sdhci_esdhc_imx_driver = { | |||
395 | .name = "sdhci-esdhc-imx", | 443 | .name = "sdhci-esdhc-imx", |
396 | .owner = THIS_MODULE, | 444 | .owner = THIS_MODULE, |
397 | }, | 445 | }, |
446 | .id_table = imx_esdhc_devtype, | ||
398 | .probe = sdhci_esdhc_imx_probe, | 447 | .probe = sdhci_esdhc_imx_probe, |
399 | .remove = __devexit_p(sdhci_esdhc_imx_remove), | 448 | .remove = __devexit_p(sdhci_esdhc_imx_remove), |
400 | #ifdef CONFIG_PM | 449 | #ifdef CONFIG_PM |