summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2012-05-05 14:24:01 +0200
committerShawn Guo <shawn.guo@linaro.org>2012-05-13 02:05:31 +0200
commitef9b4d3996624f65ffa928bd7767f0e186687c15 (patch)
treea0172896d66edf625d7c600e78525ee91401c25e /drivers
parentmmc: mxs-mmc: let ssp_is_old take host as parameter (diff)
downloadlinux-ef9b4d3996624f65ffa928bd7767f0e186687c15.tar.xz
linux-ef9b4d3996624f65ffa928bd7767f0e186687c15.zip
mmc: mxs-mmc: get rid of the use of cpu_is_xxx
The register HW_SSP_VERSION is broken for ssp version detection, as the address of the register is different between imx23 and imx28. Let's use platform_device_id to detect the device, so that the use of cpu_is_xxx can be removed. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/mxs/clk-imx23.c4
-rw-r--r--drivers/clk/mxs/clk-imx28.c8
-rw-r--r--drivers/mmc/host/mxs-mmc.c32
3 files changed, 28 insertions, 16 deletions
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index 96562f5f92f7..f7be225f544c 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -93,8 +93,8 @@ static struct clk_lookup xbus_lookups[] __initdata = {
};
static struct clk_lookup ssp_lookups[] __initdata = {
- { .dev_id = "mxs-mmc.0", },
- { .dev_id = "mxs-mmc.1", },
+ { .dev_id = "imx23-mmc.0", },
+ { .dev_id = "imx23-mmc.1", },
{ .dev_id = "80010000.ssp", },
{ .dev_id = "80034000.ssp", },
};
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index a7ff4f106ce2..2826a2606a29 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -148,22 +148,22 @@ static struct clk_lookup xbus_lookups[] __initdata = {
};
static struct clk_lookup ssp0_lookups[] __initdata = {
- { .dev_id = "mxs-mmc.0", },
+ { .dev_id = "imx28-mmc.0", },
{ .dev_id = "80010000.ssp", },
};
static struct clk_lookup ssp1_lookups[] __initdata = {
- { .dev_id = "mxs-mmc.1", },
+ { .dev_id = "imx28-mmc.1", },
{ .dev_id = "80012000.ssp", },
};
static struct clk_lookup ssp2_lookups[] __initdata = {
- { .dev_id = "mxs-mmc.2", },
+ { .dev_id = "imx28-mmc.2", },
{ .dev_id = "80014000.ssp", },
};
static struct clk_lookup ssp3_lookups[] __initdata = {
- { .dev_id = "mxs-mmc.3", },
+ { .dev_id = "imx28-mmc.3", },
{ .dev_id = "80016000.ssp", },
};
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
index a699a8673766..92395563cd82 100644
--- a/drivers/mmc/host/mxs-mmc.c
+++ b/drivers/mmc/host/mxs-mmc.c
@@ -42,7 +42,6 @@
#include <linux/pinctrl/consumer.h>
#include <linux/stmp_device.h>
-#include <mach/mxs.h>
#include <mach/mmc.h>
#define DRIVER_NAME "mxs-mmc"
@@ -50,8 +49,7 @@
/* card detect polling timeout */
#define MXS_MMC_DETECT_TIMEOUT (HZ/2)
-#define SSP_VERSION_LATEST 4
-#define ssp_is_old(host) ((host)->version < SSP_VERSION_LATEST)
+#define ssp_is_old(host) ((host)->devid == IMX23_MMC)
/* SSP registers */
#define HW_SSP_CTRL0 0x000
@@ -123,8 +121,6 @@
#define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100)
#define BM_SSP_STATUS_CARD_DETECT (1 << 28)
#define BM_SSP_STATUS_SDIO_IRQ (1 << 17)
-#define HW_SSP_VERSION (cpu_is_mx23() ? 0x110 : 0x130)
-#define BP_SSP_VERSION_MAJOR (24)
#define BF_SSP(value, field) (((value) << BP_SSP_##field) & BM_SSP_##field)
@@ -139,6 +135,11 @@
#define SSP_PIO_NUM 3
+enum mxs_mmc_id {
+ IMX23_MMC,
+ IMX28_MMC,
+};
+
struct mxs_mmc_host {
struct mmc_host *mmc;
struct mmc_request *mrq;
@@ -158,7 +159,7 @@ struct mxs_mmc_host {
enum dma_transfer_direction slave_dirn;
u32 ssp_pio_words[SSP_PIO_NUM];
- unsigned int version;
+ enum mxs_mmc_id devid;
unsigned char bus_width;
spinlock_t lock;
int sdio_irq_en;
@@ -678,6 +679,19 @@ static bool mxs_mmc_dma_filter(struct dma_chan *chan, void *param)
return true;
}
+static struct platform_device_id mxs_mmc_ids[] = {
+ {
+ .name = "imx23-mmc",
+ .driver_data = IMX23_MMC,
+ }, {
+ .name = "imx28-mmc",
+ .driver_data = IMX28_MMC,
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(platform, mxs_mmc_ids);
+
static int mxs_mmc_probe(struct platform_device *pdev)
{
struct mxs_mmc_host *host;
@@ -712,10 +726,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
goto out_mmc_free;
}
- /* only major verion does matter */
- host->version = readl(host->base + HW_SSP_VERSION) >>
- BP_SSP_VERSION_MAJOR;
-
+ host->devid = pdev->id_entry->driver_data;
host->mmc = mmc;
host->res = r;
host->dma_res = dmares;
@@ -866,6 +877,7 @@ static const struct dev_pm_ops mxs_mmc_pm_ops = {
static struct platform_driver mxs_mmc_driver = {
.probe = mxs_mmc_probe,
.remove = mxs_mmc_remove,
+ .id_table = mxs_mmc_ids,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,