diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2011-06-30 05:24:26 +0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2011-07-27 05:31:27 +0400 |
commit | 57ed3314e0bfa90ea63c63b8d3038814e9d98a20 (patch) | |
tree | ce82f977d851c5cb2b0d6c28da0ef7270f3be848 /drivers/mmc | |
parent | 842afc02cf04f0474392b4c5efd808996a804fa6 (diff) | |
download | linux-57ed3314e0bfa90ea63c63b8d3038814e9d98a20.tar.xz |
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/mmc')
-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 @@ #include <linux/mmc/host.h> #include <linux/mmc/mmc.h> #include <linux/mmc/sdio.h> -#include <mach/hardware.h> #include <mach/esdhc.h> #include "sdhci-pltfm.h" #include "sdhci-esdhc.h" @@ -42,12 +41,59 @@ */ #define ESDHC_FLAG_MULTIBLK_NO_INT (1 << 1) +enum imx_esdhc_type { + IMX25_ESDHC, + IMX35_ESDHC, + IMX51_ESDHC, + IMX53_ESDHC, +}; + struct pltfm_imx_data { int flags; u32 scratchpad; + enum imx_esdhc_type devtype; struct esdhc_platform_data boarddata; }; +static struct platform_device_id imx_esdhc_devtype[] = { + { + .name = "sdhci-esdhc-imx25", + .driver_data = IMX25_ESDHC, + }, { + .name = "sdhci-esdhc-imx35", + .driver_data = IMX35_ESDHC, + }, { + .name = "sdhci-esdhc-imx51", + .driver_data = IMX51_ESDHC, + }, { + .name = "sdhci-esdhc-imx53", + .driver_data = IMX53_ESDHC, + }, { + /* sentinel */ + } +}; +MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype); + +static inline int is_imx25_esdhc(struct pltfm_imx_data *data) +{ + return data->devtype == IMX25_ESDHC; +} + +static inline int is_imx35_esdhc(struct pltfm_imx_data *data) +{ + return data->devtype == IMX35_ESDHC; +} + +static inline int is_imx51_esdhc(struct pltfm_imx_data *data) +{ + return data->devtype == IMX51_ESDHC; +} + +static inline int is_imx53_esdhc(struct pltfm_imx_data *data) +{ + return data->devtype == IMX53_ESDHC; +} + static inline void esdhc_clrset_le(struct sdhci_host *host, u32 mask, u32 val, int reg) { void __iomem *base = host->ioaddr + (reg & ~0x3); @@ -262,6 +308,8 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) imx_data = kzalloc(sizeof(struct pltfm_imx_data), GFP_KERNEL); if (!imx_data) return -ENOMEM; + + imx_data->devtype = pdev->id_entry->driver_data; pltfm_host->priv = imx_data; clk = clk_get(mmc_dev(host->mmc), NULL); @@ -273,14 +321,14 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) clk_enable(clk); pltfm_host->clk = clk; - if (!cpu_is_mx25()) + if (!is_imx25_esdhc(imx_data)) host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; - if (cpu_is_mx25() || cpu_is_mx35()) + if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ host->quirks |= SDHCI_QUIRK_NO_MULTIBLOCK; - if (!(cpu_is_mx25() || cpu_is_mx35() || cpu_is_mx51())) + if (is_imx53_esdhc(imx_data)) imx_data->flags |= ESDHC_FLAG_MULTIBLK_NO_INT; if (!host->mmc->parent->platform_data) { @@ -395,6 +443,7 @@ static struct platform_driver sdhci_esdhc_imx_driver = { .name = "sdhci-esdhc-imx", .owner = THIS_MODULE, }, + .id_table = imx_esdhc_devtype, .probe = sdhci_esdhc_imx_probe, .remove = __devexit_p(sdhci_esdhc_imx_remove), #ifdef CONFIG_PM |