]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blobdiff - drivers/mmc/host/mxcmmc.c
Merge remote-tracking branch 'arm-soc/imx/multiplatform' into imx25-dt
[can-eth-gw-linux.git] / drivers / mmc / host / mxcmmc.c
index 6290b7f1ccfec2d56f31675663923e057a1570c8..477f63bad5212ac66053186b6a376ed0b7088f96 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/platform_data/mmc-mxcmmc.h>
 
 #include <linux/platform_data/dma-imx.h>
-#include <mach/hardware.h>
 
 #define DRIVER_NAME "mxc-mmc"
 #define MXCMCI_TIMEOUT_MS 10000
 #define INT_WRITE_OP_DONE_EN           (1 << 1)
 #define INT_READ_OP_EN                 (1 << 0)
 
+enum mxcmci_type {
+       IMX21_MMC,
+       IMX31_MMC,
+};
+
 struct mxcmci_host {
        struct mmc_host         *mmc;
        struct resource         *res;
@@ -153,7 +157,26 @@ struct mxcmci_host {
        struct imx_dma_data     dma_data;
 
        struct timer_list       watchdog;
+       enum mxcmci_type        devtype;
+};
+
+static struct platform_device_id mxcmci_devtype[] = {
+       {
+               .name = "imx21-mmc",
+               .driver_data = IMX21_MMC,
+       }, {
+               .name = "imx31-mmc",
+               .driver_data = IMX31_MMC,
+       }, {
+               /* sentinel */
+       }
 };
+MODULE_DEVICE_TABLE(platform, mxcmci_devtype);
+
+static inline int is_imx31_mmc(struct mxcmci_host *host)
+{
+       return host->devtype == IMX31_MMC;
+}
 
 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
 
@@ -843,6 +866,8 @@ static void mxcmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
 
 static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card)
 {
+       struct mxcmci_host *mxcmci = mmc_priv(host);
+
        /*
         * MX3 SoCs have a silicon bug which corrupts CRC calculation of
         * 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)
         * One way to prevent this is to only allow 1-bit transfers.
         */
 
-       if (cpu_is_mx3() && card->type == MMC_TYPE_SDIO)
+       if (is_imx31_mmc(mxcmci) && card->type == MMC_TYPE_SDIO)
                host->caps &= ~MMC_CAP_4_BIT_DATA;
        else
                host->caps |= MMC_CAP_4_BIT_DATA;
@@ -948,6 +973,7 @@ static int mxcmci_probe(struct platform_device *pdev)
 
        host->mmc = mmc;
        host->pdata = pdev->dev.platform_data;
+       host->devtype = pdev->id_entry->driver_data;
        spin_lock_init(&host->lock);
 
        mxcmci_init_ocr(host);
@@ -1120,6 +1146,7 @@ static const struct dev_pm_ops mxcmci_pm_ops = {
 static struct platform_driver mxcmci_driver = {
        .probe          = mxcmci_probe,
        .remove         = mxcmci_remove,
+       .id_table       = mxcmci_devtype,
        .driver         = {
                .name           = DRIVER_NAME,
                .owner          = THIS_MODULE,