diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2012-05-05 08:24:01 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2012-05-12 20:05:31 -0400 |
commit | ef9b4d3996624f65ffa928bd7767f0e186687c15 (patch) | |
tree | a0172896d66edf625d7c600e78525ee91401c25e /drivers/mmc/host | |
parent | e0bf141db2e649830a1851f7c5c01f3b9b410778 (diff) |
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/mmc/host')
-rw-r--r-- | drivers/mmc/host/mxs-mmc.c | 32 |
1 files changed, 22 insertions, 10 deletions
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 @@ | |||
42 | #include <linux/pinctrl/consumer.h> | 42 | #include <linux/pinctrl/consumer.h> |
43 | #include <linux/stmp_device.h> | 43 | #include <linux/stmp_device.h> |
44 | 44 | ||
45 | #include <mach/mxs.h> | ||
46 | #include <mach/mmc.h> | 45 | #include <mach/mmc.h> |
47 | 46 | ||
48 | #define DRIVER_NAME "mxs-mmc" | 47 | #define DRIVER_NAME "mxs-mmc" |
@@ -50,8 +49,7 @@ | |||
50 | /* card detect polling timeout */ | 49 | /* card detect polling timeout */ |
51 | #define MXS_MMC_DETECT_TIMEOUT (HZ/2) | 50 | #define MXS_MMC_DETECT_TIMEOUT (HZ/2) |
52 | 51 | ||
53 | #define SSP_VERSION_LATEST 4 | 52 | #define ssp_is_old(host) ((host)->devid == IMX23_MMC) |
54 | #define ssp_is_old(host) ((host)->version < SSP_VERSION_LATEST) | ||
55 | 53 | ||
56 | /* SSP registers */ | 54 | /* SSP registers */ |
57 | #define HW_SSP_CTRL0 0x000 | 55 | #define HW_SSP_CTRL0 0x000 |
@@ -123,8 +121,6 @@ | |||
123 | #define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100) | 121 | #define HW_SSP_STATUS(h) (ssp_is_old(h) ? 0x0c0 : 0x100) |
124 | #define BM_SSP_STATUS_CARD_DETECT (1 << 28) | 122 | #define BM_SSP_STATUS_CARD_DETECT (1 << 28) |
125 | #define BM_SSP_STATUS_SDIO_IRQ (1 << 17) | 123 | #define BM_SSP_STATUS_SDIO_IRQ (1 << 17) |
126 | #define HW_SSP_VERSION (cpu_is_mx23() ? 0x110 : 0x130) | ||
127 | #define BP_SSP_VERSION_MAJOR (24) | ||
128 | 124 | ||
129 | #define BF_SSP(value, field) (((value) << BP_SSP_##field) & BM_SSP_##field) | 125 | #define BF_SSP(value, field) (((value) << BP_SSP_##field) & BM_SSP_##field) |
130 | 126 | ||
@@ -139,6 +135,11 @@ | |||
139 | 135 | ||
140 | #define SSP_PIO_NUM 3 | 136 | #define SSP_PIO_NUM 3 |
141 | 137 | ||
138 | enum mxs_mmc_id { | ||
139 | IMX23_MMC, | ||
140 | IMX28_MMC, | ||
141 | }; | ||
142 | |||
142 | struct mxs_mmc_host { | 143 | struct mxs_mmc_host { |
143 | struct mmc_host *mmc; | 144 | struct mmc_host *mmc; |
144 | struct mmc_request *mrq; | 145 | struct mmc_request *mrq; |
@@ -158,7 +159,7 @@ struct mxs_mmc_host { | |||
158 | enum dma_transfer_direction slave_dirn; | 159 | enum dma_transfer_direction slave_dirn; |
159 | u32 ssp_pio_words[SSP_PIO_NUM]; | 160 | u32 ssp_pio_words[SSP_PIO_NUM]; |
160 | 161 | ||
161 | unsigned int version; | 162 | enum mxs_mmc_id devid; |
162 | unsigned char bus_width; | 163 | unsigned char bus_width; |
163 | spinlock_t lock; | 164 | spinlock_t lock; |
164 | int sdio_irq_en; | 165 | int sdio_irq_en; |
@@ -678,6 +679,19 @@ static bool mxs_mmc_dma_filter(struct dma_chan *chan, void *param) | |||
678 | return true; | 679 | return true; |
679 | } | 680 | } |
680 | 681 | ||
682 | static struct platform_device_id mxs_mmc_ids[] = { | ||
683 | { | ||
684 | .name = "imx23-mmc", | ||
685 | .driver_data = IMX23_MMC, | ||
686 | }, { | ||
687 | .name = "imx28-mmc", | ||
688 | .driver_data = IMX28_MMC, | ||
689 | }, { | ||
690 | /* sentinel */ | ||
691 | } | ||
692 | }; | ||
693 | MODULE_DEVICE_TABLE(platform, mxs_mmc_ids); | ||
694 | |||
681 | static int mxs_mmc_probe(struct platform_device *pdev) | 695 | static int mxs_mmc_probe(struct platform_device *pdev) |
682 | { | 696 | { |
683 | struct mxs_mmc_host *host; | 697 | struct mxs_mmc_host *host; |
@@ -712,10 +726,7 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
712 | goto out_mmc_free; | 726 | goto out_mmc_free; |
713 | } | 727 | } |
714 | 728 | ||
715 | /* only major verion does matter */ | 729 | host->devid = pdev->id_entry->driver_data; |
716 | host->version = readl(host->base + HW_SSP_VERSION) >> | ||
717 | BP_SSP_VERSION_MAJOR; | ||
718 | |||
719 | host->mmc = mmc; | 730 | host->mmc = mmc; |
720 | host->res = r; | 731 | host->res = r; |
721 | host->dma_res = dmares; | 732 | host->dma_res = dmares; |
@@ -866,6 +877,7 @@ static const struct dev_pm_ops mxs_mmc_pm_ops = { | |||
866 | static struct platform_driver mxs_mmc_driver = { | 877 | static struct platform_driver mxs_mmc_driver = { |
867 | .probe = mxs_mmc_probe, | 878 | .probe = mxs_mmc_probe, |
868 | .remove = mxs_mmc_remove, | 879 | .remove = mxs_mmc_remove, |
880 | .id_table = mxs_mmc_ids, | ||
869 | .driver = { | 881 | .driver = { |
870 | .name = DRIVER_NAME, | 882 | .name = DRIVER_NAME, |
871 | .owner = THIS_MODULE, | 883 | .owner = THIS_MODULE, |