aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-imx/Kconfig9
-rw-r--r--arch/arm/mach-imx/devices-imx21.h4
-rw-r--r--arch/arm/mach-imx/devices-imx27.h4
-rw-r--r--arch/arm/mach-imx/devices.c35
-rw-r--r--arch/arm/mach-imx/devices.h2
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c5
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c2
-rw-r--r--arch/arm/mach-imx/mach-imx27_visstrim_m10.c5
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c14
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c5
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c9
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c5
-rw-r--r--arch/arm/mach-imx/mach-pca100.c5
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c2
-rw-r--r--arch/arm/mach-imx/pcm970-baseboard.c5
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig3
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc-mmc.c62
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h11
19 files changed, 116 insertions, 72 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index d3e983e57594..8e9297b84830 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -73,6 +73,7 @@ config MACH_MX21ADS
73 bool "MX21ADS platform" 73 bool "MX21ADS platform"
74 select IMX_HAVE_PLATFORM_IMX_FB 74 select IMX_HAVE_PLATFORM_IMX_FB
75 select IMX_HAVE_PLATFORM_IMX_UART 75 select IMX_HAVE_PLATFORM_IMX_UART
76 select IMX_HAVE_PLATFORM_MXC_MMC
76 select IMX_HAVE_PLATFORM_MXC_NAND 77 select IMX_HAVE_PLATFORM_MXC_NAND
77 help 78 help
78 Include support for MX21ADS platform. This includes specific 79 Include support for MX21ADS platform. This includes specific
@@ -89,6 +90,7 @@ config MACH_MX27ADS
89 select IMX_HAVE_PLATFORM_IMX_FB 90 select IMX_HAVE_PLATFORM_IMX_FB
90 select IMX_HAVE_PLATFORM_IMX_I2C 91 select IMX_HAVE_PLATFORM_IMX_I2C
91 select IMX_HAVE_PLATFORM_IMX_UART 92 select IMX_HAVE_PLATFORM_IMX_UART
93 select IMX_HAVE_PLATFORM_MXC_MMC
92 select IMX_HAVE_PLATFORM_MXC_NAND 94 select IMX_HAVE_PLATFORM_MXC_NAND
93 select IMX_HAVE_PLATFORM_MXC_W1 95 select IMX_HAVE_PLATFORM_MXC_W1
94 help 96 help
@@ -116,6 +118,7 @@ choice
116config MACH_PCM970_BASEBOARD 118config MACH_PCM970_BASEBOARD
117 bool "PHYTEC PCM970 development board" 119 bool "PHYTEC PCM970 development board"
118 select IMX_HAVE_PLATFORM_IMX_FB 120 select IMX_HAVE_PLATFORM_IMX_FB
121 select IMX_HAVE_PLATFORM_MXC_MMC
119 help 122 help
120 This adds board specific devices that can be found on Phytec's 123 This adds board specific devices that can be found on Phytec's
121 PCM970 evaluation board. 124 PCM970 evaluation board.
@@ -137,6 +140,7 @@ config MACH_CPUIMX27
137config MACH_EUKREA_CPUIMX27_USESDHC2 140config MACH_EUKREA_CPUIMX27_USESDHC2
138 bool "CPUIMX27 integrates SDHC2 module" 141 bool "CPUIMX27 integrates SDHC2 module"
139 depends on MACH_CPUIMX27 142 depends on MACH_CPUIMX27
143 select IMX_HAVE_PLATFORM_MXC_MMC
140 help 144 help
141 This adds support for the internal SDHC2 used on CPUIMX27 145 This adds support for the internal SDHC2 used on CPUIMX27
142 for wifi or eMMC. 146 for wifi or eMMC.
@@ -158,6 +162,7 @@ config MACH_EUKREA_MBIMX27_BASEBOARD
158 select IMX_HAVE_PLATFORM_IMX_FB 162 select IMX_HAVE_PLATFORM_IMX_FB
159 select IMX_HAVE_PLATFORM_IMX_SSI 163 select IMX_HAVE_PLATFORM_IMX_SSI
160 select IMX_HAVE_PLATFORM_IMX_UART 164 select IMX_HAVE_PLATFORM_IMX_UART
165 select IMX_HAVE_PLATFORM_MXC_MMC
161 select IMX_HAVE_PLATFORM_SPI_IMX 166 select IMX_HAVE_PLATFORM_SPI_IMX
162 help 167 help
163 This adds board specific devices that can be found on Eukrea's 168 This adds board specific devices that can be found on Eukrea's
@@ -168,6 +173,7 @@ endchoice
168config MACH_MX27_3DS 173config MACH_MX27_3DS
169 bool "MX27PDK platform" 174 bool "MX27PDK platform"
170 select IMX_HAVE_PLATFORM_IMX_UART 175 select IMX_HAVE_PLATFORM_IMX_UART
176 select IMX_HAVE_PLATFORM_MXC_MMC
171 help 177 help
172 Include support for MX27PDK platform. This includes specific 178 Include support for MX27PDK platform. This includes specific
173 configurations for the board and its peripherals. 179 configurations for the board and its peripherals.
@@ -176,6 +182,7 @@ config MACH_IMX27_VISSTRIM_M10
176 bool "Vista Silicon i.MX27 Visstrim_m10" 182 bool "Vista Silicon i.MX27 Visstrim_m10"
177 select IMX_HAVE_PLATFORM_IMX_I2C 183 select IMX_HAVE_PLATFORM_IMX_I2C
178 select IMX_HAVE_PLATFORM_IMX_UART 184 select IMX_HAVE_PLATFORM_IMX_UART
185 select IMX_HAVE_PLATFORM_MXC_MMC
179 help 186 help
180 Include support for Visstrim_m10 platform and its different variants. 187 Include support for Visstrim_m10 platform and its different variants.
181 This includes specific configurations for the board and its 188 This includes specific configurations for the board and its
@@ -195,6 +202,7 @@ config MACH_PCA100
195 select IMX_HAVE_PLATFORM_IMX_I2C 202 select IMX_HAVE_PLATFORM_IMX_I2C
196 select IMX_HAVE_PLATFORM_IMX_SSI 203 select IMX_HAVE_PLATFORM_IMX_SSI
197 select IMX_HAVE_PLATFORM_IMX_UART 204 select IMX_HAVE_PLATFORM_IMX_UART
205 select IMX_HAVE_PLATFORM_MXC_MMC
198 select IMX_HAVE_PLATFORM_MXC_NAND 206 select IMX_HAVE_PLATFORM_MXC_NAND
199 select IMX_HAVE_PLATFORM_MXC_W1 207 select IMX_HAVE_PLATFORM_MXC_W1
200 select IMX_HAVE_PLATFORM_SPI_IMX 208 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -208,6 +216,7 @@ config MACH_MXT_TD60
208 select IMX_HAVE_PLATFORM_IMX_FB 216 select IMX_HAVE_PLATFORM_IMX_FB
209 select IMX_HAVE_PLATFORM_IMX_I2C 217 select IMX_HAVE_PLATFORM_IMX_I2C
210 select IMX_HAVE_PLATFORM_IMX_UART 218 select IMX_HAVE_PLATFORM_IMX_UART
219 select IMX_HAVE_PLATFORM_MXC_MMC
211 select IMX_HAVE_PLATFORM_MXC_NAND 220 select IMX_HAVE_PLATFORM_MXC_NAND
212 help 221 help
213 Include support for i-MXT (aka td60) platform. This 222 Include support for i-MXT (aka td60) platform. This
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h
index 0f782b6fcf88..a97e921bc225 100644
--- a/arch/arm/mach-imx/devices-imx21.h
+++ b/arch/arm/mach-imx/devices-imx21.h
@@ -33,6 +33,10 @@ extern const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst;
33#define imx21_add_imx_uart2(pdata) imx21_add_imx_uart(2, pdata) 33#define imx21_add_imx_uart2(pdata) imx21_add_imx_uart(2, pdata)
34#define imx21_add_imx_uart3(pdata) imx21_add_imx_uart(3, pdata) 34#define imx21_add_imx_uart3(pdata) imx21_add_imx_uart(3, pdata)
35 35
36extern const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst;
37#define imx21_add_mxc_mmc(id, pdata) \
38 imx_add_mxc_mmc(&imx21_mxc_mmc_data[id], pdata)
39
36extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst; 40extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst;
37#define imx21_add_mxc_nand(pdata) \ 41#define imx21_add_mxc_nand(pdata) \
38 imx_add_mxc_nand(&imx21_mxc_nand_data, pdata) 42 imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index 6e11bef297d0..646674485a0d 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -43,6 +43,10 @@ extern const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst;
43#define imx27_add_mx2_camera(pdata) \ 43#define imx27_add_mx2_camera(pdata) \
44 imx_add_mx2_camera(&imx27_mx2_camera_data, pdata) 44 imx_add_mx2_camera(&imx27_mx2_camera_data, pdata)
45 45
46extern const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst;
47#define imx27_add_mxc_mmc(id, pdata) \
48 imx_add_mxc_mmc(&imx27_mxc_mmc_data[id], pdata)
49
46extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst; 50extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
47#define imx27_add_mxc_nand(pdata) \ 51#define imx27_add_mxc_nand(pdata) \
48 imx_add_mxc_nand(&imx27_mxc_nand_data, pdata) 52 imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index 9ee0e0924f55..7609e8a8f13c 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -76,40 +76,6 @@ int __init imx1_register_gpios(void)
76} 76}
77#endif 77#endif
78 78
79#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
80#define DEFINE_MXC_MMC_DEVICE(n, baseaddr, irq, dmareq) \
81 static struct resource mxc_sdhc_resources ## n[] = { \
82 { \
83 .start = baseaddr, \
84 .end = baseaddr + SZ_4K - 1, \
85 .flags = IORESOURCE_MEM, \
86 }, { \
87 .start = irq, \
88 .end = irq, \
89 .flags = IORESOURCE_IRQ, \
90 }, { \
91 .start = dmareq, \
92 .end = dmareq, \
93 .flags = IORESOURCE_DMA, \
94 }, \
95 }; \
96 \
97 static u64 mxc_sdhc ## n ## _dmamask = DMA_BIT_MASK(32); \
98 \
99 struct platform_device mxc_sdhc_device ## n = { \
100 .name = "mxc-mmc", \
101 .id = n, \
102 .dev = { \
103 .dma_mask = &mxc_sdhc ## n ## _dmamask, \
104 .coherent_dma_mask = DMA_BIT_MASK(32), \
105 }, \
106 .num_resources = ARRAY_SIZE(mxc_sdhc_resources ## n), \
107 .resource = mxc_sdhc_resources ## n, \
108 }
109
110DEFINE_MXC_MMC_DEVICE(0, MX2x_SDHC1_BASE_ADDR, MX2x_INT_SDHC1, MX2x_DMA_REQ_SDHC1);
111DEFINE_MXC_MMC_DEVICE(1, MX2x_SDHC2_BASE_ADDR, MX2x_INT_SDHC2, MX2x_DMA_REQ_SDHC2);
112
113#ifdef CONFIG_MACH_MX27 79#ifdef CONFIG_MACH_MX27
114static struct resource otg_resources[] = { 80static struct resource otg_resources[] = {
115 { 81 {
@@ -203,6 +169,7 @@ struct platform_device mxc_usbh2 = {
203}; 169};
204#endif 170#endif
205 171
172#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
206/* GPIO port description */ 173/* GPIO port description */
207#define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \ 174#define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \
208 { \ 175 { \
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h
index 1ba5042067ec..a45d760f3c77 100644
--- a/arch/arm/mach-imx/devices.h
+++ b/arch/arm/mach-imx/devices.h
@@ -1,6 +1,4 @@
1#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) 1#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
2extern struct platform_device mxc_sdhc_device0;
3extern struct platform_device mxc_sdhc_device1;
4extern struct platform_device mxc_otg_udc_device; 2extern struct platform_device mxc_otg_udc_device;
5extern struct platform_device mxc_otg_host; 3extern struct platform_device mxc_otg_host;
6extern struct platform_device mxc_usbh1; 4extern struct platform_device mxc_usbh1;
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index a226e2540ebd..fa5aaded7c2e 100644
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -33,7 +33,6 @@
33#include <mach/common.h> 33#include <mach/common.h>
34#include <mach/iomux-mx27.h> 34#include <mach/iomux-mx27.h>
35#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <mach/mmc.h>
37#include <mach/spi.h> 36#include <mach/spi.h>
38#include <mach/audmux.h> 37#include <mach/audmux.h>
39 38
@@ -305,7 +304,7 @@ static struct platform_device *platform_devices[] __initdata = {
305 &leds_gpio, 304 &leds_gpio,
306}; 305};
307 306
308static struct imxmmc_platform_data sdhc_pdata = { 307static const struct imxmmc_platform_data sdhc_pdata __initconst = {
309 .dat3_card_detect = 1, 308 .dat3_card_detect = 1,
310}; 309};
311 310
@@ -351,7 +350,7 @@ void __init eukrea_mbimx27_baseboard_init(void)
351#endif 350#endif
352 351
353 imx27_add_imx_fb(&eukrea_mbimx27_fb_data); 352 imx27_add_imx_fb(&eukrea_mbimx27_fb_data);
354 mxc_register_device(&mxc_sdhc_device0, &sdhc_pdata); 353 imx27_add_mxc_mmc(0, &sdhc_pdata);
355 354
356 i2c_register_board_info(0, eukrea_mbimx27_i2c_devices, 355 i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
357 ARRAY_SIZE(eukrea_mbimx27_i2c_devices)); 356 ARRAY_SIZE(eukrea_mbimx27_i2c_devices));
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 5771d4e58879..06ff79a60901 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -265,7 +265,7 @@ static void __init eukrea_cpuimx27_init(void)
265 265
266#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2) 266#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
267 /* SDHC2 can be used for Wifi */ 267 /* SDHC2 can be used for Wifi */
268 mxc_register_device(&mxc_sdhc_device1, NULL); 268 imx27_add_mxc_mmc(1, NULL);
269#endif 269#endif
270#if defined(MACH_EUKREA_CPUIMX27_USEUART4) 270#if defined(MACH_EUKREA_CPUIMX27_USEUART4)
271 /* in which case UART4 is also used for Bluetooth */ 271 /* in which case UART4 is also used for Bluetooth */
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
index 59716fab586d..deef1fa1138e 100644
--- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
+++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
@@ -34,7 +34,6 @@
34#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
35#include <asm/mach/time.h> 35#include <asm/mach/time.h>
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/mmc.h>
38#include <mach/iomux.h> 37#include <mach/iomux.h>
39#include <mach/mxc_ehci.h> 38#include <mach/mxc_ehci.h>
40 39
@@ -156,7 +155,7 @@ static void visstrim_m10_sdhc1_exit(struct device *dev, void *data)
156 free_irq(SDHC1_IRQ, data); 155 free_irq(SDHC1_IRQ, data);
157} 156}
158 157
159static struct imxmmc_platform_data visstrim_m10_sdhc_pdata = { 158static const struct imxmmc_platform_data visstrim_m10_sdhc_pdata __initconst = {
160 .init = visstrim_m10_sdhc1_init, 159 .init = visstrim_m10_sdhc1_init,
161 .exit = visstrim_m10_sdhc1_exit, 160 .exit = visstrim_m10_sdhc1_exit,
162}; 161};
@@ -237,7 +236,7 @@ static void __init visstrim_m10_board_init(void)
237 ARRAY_SIZE(visstrim_m10_i2c_devices)); 236 ARRAY_SIZE(visstrim_m10_i2c_devices));
238 imx27_add_imx_i2c(0, &visstrim_m10_i2c_data); 237 imx27_add_imx_i2c(0, &visstrim_m10_i2c_data);
239 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data); 238 imx27_add_imx_i2c(1, &visstrim_m10_i2c_data);
240 mxc_register_device(&mxc_sdhc_device0, &visstrim_m10_sdhc_pdata); 239 imx27_add_mxc_mmc(0, &visstrim_m10_sdhc_pdata);
241 mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata); 240 mxc_register_device(&mxc_otg_host, &visstrim_m10_usbotg_pdata);
242 imx27_add_fec(NULL); 241 imx27_add_fec(NULL);
243 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 242 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
diff --git a/arch/arm/mach-imx/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index 4820a67b8abb..83c064a3cf4b 100644
--- a/arch/arm/mach-imx/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -26,7 +26,6 @@
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27#include <mach/iomux-mx21.h> 27#include <mach/iomux-mx21.h>
28#include <mach/mxc_nand.h> 28#include <mach/mxc_nand.h>
29#include <mach/mmc.h>
30 29
31#include "devices-imx21.h" 30#include "devices-imx21.h"
32#include "devices.h" 31#include "devices.h"
@@ -232,15 +231,8 @@ static int mx21ads_sdhc_get_ro(struct device *dev)
232static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq, 231static int mx21ads_sdhc_init(struct device *dev, irq_handler_t detect_irq,
233 void *data) 232 void *data)
234{ 233{
235 int ret; 234 return request_irq(IRQ_GPIOD(25), detect_irq,
236
237 ret = request_irq(IRQ_GPIOD(25), detect_irq,
238 IRQF_TRIGGER_FALLING, "mmc-detect", data); 235 IRQF_TRIGGER_FALLING, "mmc-detect", data);
239 if (ret)
240 goto out;
241 return 0;
242out:
243 return ret;
244} 236}
245 237
246static void mx21ads_sdhc_exit(struct device *dev, void *data) 238static void mx21ads_sdhc_exit(struct device *dev, void *data)
@@ -248,7 +240,7 @@ static void mx21ads_sdhc_exit(struct device *dev, void *data)
248 free_irq(IRQ_GPIOD(25), data); 240 free_irq(IRQ_GPIOD(25), data);
249} 241}
250 242
251static struct imxmmc_platform_data mx21ads_sdhc_pdata = { 243static const struct imxmmc_platform_data mx21ads_sdhc_pdata __initconst = {
252 .ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, /* 3.0V */ 244 .ocr_avail = MMC_VDD_29_30 | MMC_VDD_30_31, /* 3.0V */
253 .get_ro = mx21ads_sdhc_get_ro, 245 .get_ro = mx21ads_sdhc_get_ro,
254 .init = mx21ads_sdhc_init, 246 .init = mx21ads_sdhc_init,
@@ -296,7 +288,7 @@ static void __init mx21ads_board_init(void)
296 imx21_add_imx_uart2(&uart_pdata_norts); 288 imx21_add_imx_uart2(&uart_pdata_norts);
297 imx21_add_imx_uart3(&uart_pdata_rts); 289 imx21_add_imx_uart3(&uart_pdata_rts);
298 imx21_add_imx_fb(&mx21ads_fb_data); 290 imx21_add_imx_fb(&mx21ads_fb_data);
299 mxc_register_device(&mxc_sdhc_device0, &mx21ads_sdhc_pdata); 291 imx21_add_mxc_mmc(0, &mx21ads_sdhc_pdata);
300 imx21_add_mxc_nand(&mx21ads_nand_board_info); 292 imx21_add_mxc_nand(&mx21ads_nand_board_info);
301 293
302 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 294 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index 84a5ba03f1ba..e6212c3d53b5 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -30,7 +30,6 @@
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/common.h> 31#include <mach/common.h>
32#include <mach/iomux-mx27.h> 32#include <mach/iomux-mx27.h>
33#include <mach/mmc.h>
34 33
35#include "devices-imx27.h" 34#include "devices-imx27.h"
36#include "devices.h" 35#include "devices.h"
@@ -109,7 +108,7 @@ static void mx27_3ds_sdhc1_exit(struct device *dev, void *data)
109 free_irq(IRQ_GPIOB(26), data); 108 free_irq(IRQ_GPIOB(26), data);
110} 109}
111 110
112static struct imxmmc_platform_data sdhc1_pdata = { 111static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
113 .init = mx27_3ds_sdhc1_init, 112 .init = mx27_3ds_sdhc1_init,
114 .exit = mx27_3ds_sdhc1_exit, 113 .exit = mx27_3ds_sdhc1_exit,
115}; 114};
@@ -129,7 +128,7 @@ static void __init mx27pdk_init(void)
129 imx27_add_imx_uart0(&uart_pdata); 128 imx27_add_imx_uart0(&uart_pdata);
130 imx27_add_fec(NULL); 129 imx27_add_fec(NULL);
131 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); 130 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
132 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 131 imx27_add_mxc_mmc(0, &sdhc1_pdata);
133} 132}
134 133
135static void __init mx27pdk_timer_init(void) 134static void __init mx27pdk_timer_init(void)
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index d97b25bffe7b..370481b3d908 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -30,7 +30,6 @@
30#include <mach/gpio.h> 30#include <mach/gpio.h>
31#include <mach/iomux-mx27.h> 31#include <mach/iomux-mx27.h>
32#include <mach/mxc_nand.h> 32#include <mach/mxc_nand.h>
33#include <mach/mmc.h>
34 33
35#include "devices-imx27.h" 34#include "devices-imx27.h"
36#include "devices.h" 35#include "devices.h"
@@ -271,12 +270,12 @@ static void mx27ads_sdhc2_exit(struct device *dev, void *data)
271 free_irq(IRQ_GPIOB(7), data); 270 free_irq(IRQ_GPIOB(7), data);
272} 271}
273 272
274static struct imxmmc_platform_data sdhc1_pdata = { 273static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
275 .init = mx27ads_sdhc1_init, 274 .init = mx27ads_sdhc1_init,
276 .exit = mx27ads_sdhc1_exit, 275 .exit = mx27ads_sdhc1_exit,
277}; 276};
278 277
279static struct imxmmc_platform_data sdhc2_pdata = { 278static const struct imxmmc_platform_data sdhc2_pdata __initconst = {
280 .init = mx27ads_sdhc2_init, 279 .init = mx27ads_sdhc2_init,
281 .exit = mx27ads_sdhc2_exit, 280 .exit = mx27ads_sdhc2_exit,
282}; 281};
@@ -307,8 +306,8 @@ static void __init mx27ads_board_init(void)
307 ARRAY_SIZE(mx27ads_i2c_devices)); 306 ARRAY_SIZE(mx27ads_i2c_devices));
308 imx27_add_imx_i2c(1, &mx27ads_i2c1_data); 307 imx27_add_imx_i2c(1, &mx27ads_i2c1_data);
309 imx27_add_imx_fb(&mx27ads_fb_data); 308 imx27_add_imx_fb(&mx27ads_fb_data);
310 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 309 imx27_add_mxc_mmc(0, &sdhc1_pdata);
311 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata); 310 imx27_add_mxc_mmc(1, &sdhc2_pdata);
312 311
313 imx27_add_fec(NULL); 312 imx27_add_fec(NULL);
314 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 313 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index 0c944858e884..d1a3158f1a82 100644
--- a/arch/arm/mach-imx/mach-mxt_td60.c
+++ b/arch/arm/mach-imx/mach-mxt_td60.c
@@ -31,7 +31,6 @@
31#include <mach/iomux-mx27.h> 31#include <mach/iomux-mx27.h>
32#include <mach/mxc_nand.h> 32#include <mach/mxc_nand.h>
33#include <linux/i2c/pca953x.h> 33#include <linux/i2c/pca953x.h>
34#include <mach/mmc.h>
35 34
36#include "devices-imx27.h" 35#include "devices-imx27.h"
37#include "devices.h" 36#include "devices.h"
@@ -225,7 +224,7 @@ static void mxt_td60_sdhc1_exit(struct device *dev, void *data)
225 free_irq(IRQ_GPIOF(8), data); 224 free_irq(IRQ_GPIOF(8), data);
226} 225}
227 226
228static struct imxmmc_platform_data sdhc1_pdata = { 227static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
229 .init = mxt_td60_sdhc1_init, 228 .init = mxt_td60_sdhc1_init,
230 .exit = mxt_td60_sdhc1_exit, 229 .exit = mxt_td60_sdhc1_exit,
231}; 230};
@@ -253,7 +252,7 @@ static void __init mxt_td60_board_init(void)
253 imx27_add_imx_i2c(0, &mxt_td60_i2c0_data); 252 imx27_add_imx_i2c(0, &mxt_td60_i2c0_data);
254 imx27_add_imx_i2c(1, &mxt_td60_i2c1_data); 253 imx27_add_imx_i2c(1, &mxt_td60_i2c1_data);
255 imx27_add_imx_fb(&mxt_td60_fb_data); 254 imx27_add_imx_fb(&mxt_td60_fb_data);
256 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 255 imx27_add_mxc_mmc(0, &sdhc1_pdata);
257 imx27_add_fec(NULL); 256 imx27_add_fec(NULL);
258} 257}
259 258
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index 30490c37190e..b05f528bfc00 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -40,7 +40,6 @@
40#include <mach/audmux.h> 40#include <mach/audmux.h>
41#include <mach/mxc_nand.h> 41#include <mach/mxc_nand.h>
42#include <mach/irqs.h> 42#include <mach/irqs.h>
43#include <mach/mmc.h>
44#include <mach/mxc_ehci.h> 43#include <mach/mxc_ehci.h>
45#include <mach/ulpi.h> 44#include <mach/ulpi.h>
46 45
@@ -268,7 +267,7 @@ static void pca100_sdhc2_exit(struct device *dev, void *data)
268 free_irq(IRQ_GPIOC(29), data); 267 free_irq(IRQ_GPIOC(29), data);
269} 268}
270 269
271static struct imxmmc_platform_data sdhc_pdata = { 270static const struct imxmmc_platform_data sdhc_pdata __initconst = {
272 .init = pca100_sdhc2_init, 271 .init = pca100_sdhc2_init,
273 .exit = pca100_sdhc2_exit, 272 .exit = pca100_sdhc2_exit,
274}; 273};
@@ -383,7 +382,7 @@ static void __init pca100_init(void)
383 382
384 imx27_add_imx_uart0(&uart_pdata); 383 imx27_add_imx_uart0(&uart_pdata);
385 384
386 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); 385 imx27_add_mxc_mmc(1, &sdhc_pdata);
387 386
388 imx27_add_mxc_nand(&pca100_nand_board_info); 387 imx27_add_mxc_nand(&pca100_nand_board_info);
389 388
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 3c9f2df89269..b3340cd8ccdd 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -212,7 +212,7 @@ static const struct spi_imx_master pcm038_spi0_data __initconst = {
212 212
213static struct regulator_consumer_supply sdhc1_consumers[] = { 213static struct regulator_consumer_supply sdhc1_consumers[] = {
214 { 214 {
215 .dev = &mxc_sdhc_device1.dev, 215 .dev_name = "mxc-mmc.1",
216 .supply = "sdhc_vcc", 216 .supply = "sdhc_vcc",
217 }, 217 },
218}; 218};
diff --git a/arch/arm/mach-imx/pcm970-baseboard.c b/arch/arm/mach-imx/pcm970-baseboard.c
index 9cf94607034e..1297f1b0dcb7 100644
--- a/arch/arm/mach-imx/pcm970-baseboard.c
+++ b/arch/arm/mach-imx/pcm970-baseboard.c
@@ -26,7 +26,6 @@
26#include <mach/common.h> 26#include <mach/common.h>
27#include <mach/iomux-mx27.h> 27#include <mach/iomux-mx27.h>
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <mach/mmc.h>
30 29
31#include "devices-imx27.h" 30#include "devices-imx27.h"
32#include "devices.h" 31#include "devices.h"
@@ -119,7 +118,7 @@ static void pcm970_sdhc2_exit(struct device *dev, void *data)
119 gpio_free(GPIO_PORTC + 28); 118 gpio_free(GPIO_PORTC + 28);
120} 119}
121 120
122static struct imxmmc_platform_data sdhc_pdata = { 121static const struct imxmmc_platform_data sdhc_pdata __initconst = {
123 .get_ro = pcm970_sdhc2_get_ro, 122 .get_ro = pcm970_sdhc2_get_ro,
124 .init = pcm970_sdhc2_init, 123 .init = pcm970_sdhc2_init,
125 .exit = pcm970_sdhc2_exit, 124 .exit = pcm970_sdhc2_exit,
@@ -228,6 +227,6 @@ void __init pcm970_baseboard_init(void)
228 227
229 imx27_add_imx_fb(&pcm038_fb_data); 228 imx27_add_imx_fb(&pcm038_fb_data);
230 mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN); 229 mxc_gpio_mode(GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN);
231 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); 230 imx27_add_mxc_mmc(1, &sdhc_pdata);
232 platform_device_register(&pcm970_sja1000); 231 platform_device_register(&pcm970_sja1000);
233} 232}
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 2ded17b51fc2..6560cf5180b6 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -37,6 +37,9 @@ config IMX_HAVE_PLATFORM_MX1_CAMERA
37config IMX_HAVE_PLATFORM_MX2_CAMERA 37config IMX_HAVE_PLATFORM_MX2_CAMERA
38 bool 38 bool
39 39
40config IMX_HAVE_PLATFORM_MXC_MMC
41 bool
42
40config IMX_HAVE_PLATFORM_MXC_NAND 43config IMX_HAVE_PLATFORM_MXC_NAND
41 bool 44 bool
42 45
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 8ecd974c40e0..d2b7a9196ab4 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -11,6 +11,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
11obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o 11obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
12obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o 12obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
13obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o 13obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
14obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
14obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o 15obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
15obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o 16obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
16obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o 17obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
diff --git a/arch/arm/plat-mxc/devices/platform-mxc-mmc.c b/arch/arm/plat-mxc/devices/platform-mxc-mmc.c
new file mode 100644
index 000000000000..953319e4d874
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-mxc-mmc.c
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/hardware.h>
10#include <mach/devices-common.h>
11
12#define imx_mxc_mmc_data_entry_single(soc, _id, _hwid) \
13 { \
14 .id = _id, \
15 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \
16 .irq = soc ## _INT_SDHC ## _hwid, \
17 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \
18 }
19#define imx_mxc_mmc_data_entry(soc, _id, _hwid) \
20 [_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid)
21
22#ifdef CONFIG_SOC_IMX21
23const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
24#define imx21_mxc_mmc_data_entry(_id, _hwid) \
25 imx_mxc_mmc_data_entry(MX21, _id, _hwid)
26 imx21_mxc_mmc_data_entry(0, 1),
27 imx21_mxc_mmc_data_entry(1, 2),
28};
29#endif /* ifdef CONFIG_SOC_IMX21 */
30
31#ifdef CONFIG_SOC_IMX27
32const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
33#define imx27_mxc_mmc_data_entry(_id, _hwid) \
34 imx_mxc_mmc_data_entry(MX27, _id, _hwid)
35 imx27_mxc_mmc_data_entry(0, 1),
36 imx27_mxc_mmc_data_entry(1, 2),
37};
38#endif /* ifdef CONFIG_SOC_IMX27 */
39
40struct platform_device *__init imx_add_mxc_mmc(
41 const struct imx_mxc_mmc_data *data,
42 const struct imxmmc_platform_data *pdata)
43{
44 struct resource res[] = {
45 {
46 .start = data->iobase,
47 .end = data->iobase + SZ_4K - 1,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = data->irq,
51 .end = data->irq,
52 .flags = IORESOURCE_IRQ,
53 }, {
54 .start = data->dmareq,
55 .end = data->dmareq,
56 .flags = IORESOURCE_DMA,
57 },
58 };
59 return imx_add_platform_device_dmamask("mxc-mmc", data->id,
60 res, ARRAY_SIZE(res),
61 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
62}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index e241e41e7484..bb3b29c7fc35 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -151,6 +151,17 @@ struct platform_device *__init imx_add_mx2_camera(
151 const struct imx_mx2_camera_data *data, 151 const struct imx_mx2_camera_data *data,
152 const struct mx2_camera_platform_data *pdata); 152 const struct mx2_camera_platform_data *pdata);
153 153
154#include <mach/mmc.h>
155struct imx_mxc_mmc_data {
156 int id;
157 resource_size_t iobase;
158 resource_size_t irq;
159 resource_size_t dmareq;
160};
161struct platform_device *__init imx_add_mxc_mmc(
162 const struct imx_mxc_mmc_data *data,
163 const struct imxmmc_platform_data *pdata);
164
154#include <mach/mxc_nand.h> 165#include <mach/mxc_nand.h>
155struct imx_mxc_nand_data { 166struct imx_mxc_nand_data {
156 /* 167 /*