aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-06-16 11:25:40 -0400
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-06-30 03:00:41 -0400
commitc69871597dd173af2d7615429c0ee6aa10fae42b (patch)
tree3747d63224d52637489b268c39f7a6346899bc4c /arch/arm
parenta8ff045603c712d6d61e07260ec2c0e44c40d14c (diff)
ARM: imx: dynamically register imx-i2c devices (imx27)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-imx/Kconfig5
-rw-r--r--arch/arm/mach-imx/devices-imx27.h5
-rw-r--r--arch/arm/mach-imx/devices.c26
-rw-r--r--arch/arm/mach-imx/devices.h4
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c5
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c5
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c9
-rw-r--r--arch/arm/mach-imx/mach-pca100.c5
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c5
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h4
10 files changed, 24 insertions, 49 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 3f88d4a0b89f..2bf807818fdc 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -82,6 +82,7 @@ comment "MX27 platforms:"
82 82
83config MACH_MX27ADS 83config MACH_MX27ADS
84 bool "MX27ADS platform" 84 bool "MX27ADS platform"
85 select IMX_HAVE_PLATFORM_IMX_I2C
85 select IMX_HAVE_PLATFORM_MXC_NAND 86 select IMX_HAVE_PLATFORM_MXC_NAND
86 help 87 help
87 Include support for MX27ADS platform. This includes specific 88 Include support for MX27ADS platform. This includes specific
@@ -89,6 +90,7 @@ config MACH_MX27ADS
89 90
90config MACH_PCM038 91config MACH_PCM038
91 bool "Phytec phyCORE-i.MX27 CPU module (pcm038)" 92 bool "Phytec phyCORE-i.MX27 CPU module (pcm038)"
93 select IMX_HAVE_PLATFORM_IMX_I2C
92 select IMX_HAVE_PLATFORM_MXC_NAND 94 select IMX_HAVE_PLATFORM_MXC_NAND
93 select MXC_ULPI if USB_ULPI 95 select MXC_ULPI if USB_ULPI
94 help 96 help
@@ -111,6 +113,7 @@ endchoice
111 113
112config MACH_CPUIMX27 114config MACH_CPUIMX27
113 bool "Eukrea CPUIMX27 module" 115 bool "Eukrea CPUIMX27 module"
116 select IMX_HAVE_PLATFORM_IMX_I2C
114 select IMX_HAVE_PLATFORM_MXC_NAND 117 select IMX_HAVE_PLATFORM_MXC_NAND
115 help 118 help
116 Include support for Eukrea CPUIMX27 platform. This includes 119 Include support for Eukrea CPUIMX27 platform. This includes
@@ -151,6 +154,7 @@ config MACH_IMX27LITE
151 154
152config MACH_PCA100 155config MACH_PCA100
153 bool "Phytec phyCARD-s (pca100)" 156 bool "Phytec phyCARD-s (pca100)"
157 select IMX_HAVE_PLATFORM_IMX_I2C
154 select IMX_HAVE_PLATFORM_MXC_NAND 158 select IMX_HAVE_PLATFORM_MXC_NAND
155 select MXC_ULPI if USB_ULPI 159 select MXC_ULPI if USB_ULPI
156 help 160 help
@@ -159,6 +163,7 @@ config MACH_PCA100
159 163
160config MACH_MXT_TD60 164config MACH_MXT_TD60
161 bool "Maxtrack i-MXT TD60" 165 bool "Maxtrack i-MXT TD60"
166 select IMX_HAVE_PLATFORM_IMX_I2C
162 select IMX_HAVE_PLATFORM_MXC_NAND 167 select IMX_HAVE_PLATFORM_MXC_NAND
163 help 168 help
164 Include support for i-MXT (aka td60) platform. This 169 Include support for i-MXT (aka td60) platform. This
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index b2f6a12c88d5..5e0c40c92013 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -9,5 +9,10 @@
9#include <mach/mx27.h> 9#include <mach/mx27.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx27_add_i2c_imx0(pdata) \
13 imx_add_imx_i2c(0, MX27_I2C1_BASE_ADDR, SZ_4K, MX27_INT_I2C1, pdata)
14#define imx27_add_i2c_imx1(pdata) \
15 imx_add_imx_i2c(1, MX27_I2C2_BASE_ADDR, SZ_4K, MX27_INT_I2C2, pdata)
16
12#define imx27_add_mxc_nand(pdata) \ 17#define imx27_add_mxc_nand(pdata) \
13 imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata) 18 imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata)
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index b9f5b69df8f1..f8641c2c9055 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -368,32 +368,6 @@ struct platform_device mxc_fec_device = {
368}; 368};
369#endif 369#endif
370 370
371#ifdef CONFIG_MACH_MX27
372#define DEFINE_IMX_I2C_DEVICE(n, baseaddr, irq) \
373 static struct resource mxc_i2c_resources ## n[] = { \
374 { \
375 .start = baseaddr, \
376 .end = baseaddr + SZ_4K - 1, \
377 .flags = IORESOURCE_MEM, \
378 }, { \
379 .start = irq, \
380 .end = irq, \
381 .flags = IORESOURCE_IRQ, \
382 } \
383 }; \
384 \
385 struct platform_device mxc_i2c_device ## n = { \
386 .name = "imx-i2c", \
387 .id = n, \
388 .num_resources = ARRAY_SIZE(mxc_i2c_resources ## n), \
389 .resource = mxc_i2c_resources ## n, \
390 }
391
392DEFINE_IMX_I2C_DEVICE(0, MX2x_I2C_BASE_ADDR, MX2x_INT_I2C);
393
394DEFINE_IMX_I2C_DEVICE(1, MX27_I2C2_BASE_ADDR, MX27_INT_I2C2);
395#endif
396
397static struct resource mxc_pwm_resources[] = { 371static struct resource mxc_pwm_resources[] = {
398 { 372 {
399 .start = MX2x_PWM_BASE_ADDR, 373 .start = MX2x_PWM_BASE_ADDR,
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h
index dcaa4f96ed3a..4fe99354f222 100644
--- a/arch/arm/mach-imx/devices.h
+++ b/arch/arm/mach-imx/devices.h
@@ -28,10 +28,6 @@ extern struct platform_device mxc_w1_master_device;
28extern struct platform_device mxc_fb_device; 28extern struct platform_device mxc_fb_device;
29extern struct platform_device mxc_fec_device; 29extern struct platform_device mxc_fec_device;
30extern struct platform_device mxc_pwm_device; 30extern struct platform_device mxc_pwm_device;
31#ifdef CONFIG_MACH_MX27
32extern struct platform_device mxc_i2c_device0;
33extern struct platform_device mxc_i2c_device1;
34#endif
35extern struct platform_device mxc_sdhc_device0; 31extern struct platform_device mxc_sdhc_device0;
36extern struct platform_device mxc_sdhc_device1; 32extern struct platform_device mxc_sdhc_device1;
37extern struct platform_device mxc_otg_udc_device; 33extern struct platform_device mxc_otg_udc_device;
diff --git a/arch/arm/mach-imx/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 5d07c2ab4711..06dcd23f51f7 100644
--- a/arch/arm/mach-imx/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -35,7 +35,6 @@
35#include <mach/board-eukrea_cpuimx27.h> 35#include <mach/board-eukrea_cpuimx27.h>
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/i2c.h>
39#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
40#include <mach/imx-uart.h> 39#include <mach/imx-uart.h>
41#include <mach/mxc_nand.h> 40#include <mach/mxc_nand.h>
@@ -131,7 +130,7 @@ static struct platform_device *platform_devices[] __initdata = {
131 &mxc_fec_device, 130 &mxc_fec_device,
132}; 131};
133 132
134static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data = { 133static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
135 .bitrate = 100000, 134 .bitrate = 100000,
136}; 135};
137 136
@@ -196,7 +195,7 @@ static void __init eukrea_cpuimx27_init(void)
196 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices, 195 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
197 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices)); 196 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
198 197
199 mxc_register_device(&mxc_i2c_device0, &eukrea_cpuimx27_i2c_1_data); 198 imx27_add_i2c_imx1(&cpuimx27_i2c1_data);
200 199
201 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 200 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
202 201
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 1a3ebf5dab26..f1ee335ad241 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -31,7 +31,6 @@
31#include <mach/imx-uart.h> 31#include <mach/imx-uart.h>
32#include <mach/iomux-mx27.h> 32#include <mach/iomux-mx27.h>
33#include <mach/mxc_nand.h> 33#include <mach/mxc_nand.h>
34#include <mach/i2c.h>
35#include <mach/imxfb.h> 34#include <mach/imxfb.h>
36#include <mach/mmc.h> 35#include <mach/mmc.h>
37 36
@@ -195,7 +194,7 @@ static struct platform_device mx27ads_nor_mtd_device = {
195 .resource = &mx27ads_flash_resource, 194 .resource = &mx27ads_flash_resource,
196}; 195};
197 196
198static struct imxi2c_platform_data mx27ads_i2c_data = { 197static const struct imxi2c_platform_data mx27ads_i2c1_data __initconst = {
199 .bitrate = 100000, 198 .bitrate = 100000,
200}; 199};
201 200
@@ -322,7 +321,7 @@ static void __init mx27ads_board_init(void)
322 /* only the i2c master 1 is used on this CPU card */ 321 /* only the i2c master 1 is used on this CPU card */
323 i2c_register_board_info(1, mx27ads_i2c_devices, 322 i2c_register_board_info(1, mx27ads_i2c_devices,
324 ARRAY_SIZE(mx27ads_i2c_devices)); 323 ARRAY_SIZE(mx27ads_i2c_devices));
325 mxc_register_device(&mxc_i2c_device1, &mx27ads_i2c_data); 324 imx27_add_i2c_imx1(&mx27ads_i2c1_data);
326 mxc_register_device(&mxc_fb_device, &mx27ads_fb_data); 325 mxc_register_device(&mxc_fb_device, &mx27ads_fb_data);
327 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 326 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
328 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata); 327 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
diff --git a/arch/arm/mach-imx/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index 447c68fe4383..b80b41ea2c76 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/imx-uart.h> 31#include <mach/imx-uart.h>
32#include <mach/iomux-mx27.h> 32#include <mach/iomux-mx27.h>
33#include <mach/mxc_nand.h> 33#include <mach/mxc_nand.h>
34#include <mach/i2c.h>
35#include <linux/i2c/pca953x.h> 34#include <linux/i2c/pca953x.h>
36#include <mach/imxfb.h> 35#include <mach/imxfb.h>
37#include <mach/mmc.h> 36#include <mach/mmc.h>
@@ -131,7 +130,7 @@ mxt_td60_nand_board_info __initconst = {
131 .hw_ecc = 1, 130 .hw_ecc = 1,
132}; 131};
133 132
134static struct imxi2c_platform_data mxt_td60_i2c_data = { 133static const struct imxi2c_platform_data mxt_td60_i2c0_data __initconst = {
135 .bitrate = 100000, 134 .bitrate = 100000,
136}; 135};
137 136
@@ -171,7 +170,7 @@ static struct i2c_board_info mxt_td60_i2c_devices[] = {
171 }, 170 },
172}; 171};
173 172
174static struct imxi2c_platform_data mxt_td60_i2c2_data = { 173static const struct imxi2c_platform_data mxt_td60_i2c1_data __initconst = {
175 .bitrate = 100000, 174 .bitrate = 100000,
176}; 175};
177 176
@@ -263,8 +262,8 @@ static void __init mxt_td60_board_init(void)
263 i2c_register_board_info(1, mxt_td60_i2c2_devices, 262 i2c_register_board_info(1, mxt_td60_i2c2_devices,
264 ARRAY_SIZE(mxt_td60_i2c2_devices)); 263 ARRAY_SIZE(mxt_td60_i2c2_devices));
265 264
266 mxc_register_device(&mxc_i2c_device0, &mxt_td60_i2c_data); 265 imx27_add_i2c_imx0(&mxt_td60_i2c0_data);
267 mxc_register_device(&mxc_i2c_device1, &mxt_td60_i2c2_data); 266 imx27_add_i2c_imx1(&mxt_td60_i2c1_data);
268 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data); 267 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
269 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 268 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
270 269
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index 6efbc6e13be9..6501a7a5b18c 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -36,7 +36,6 @@
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
39#include <mach/i2c.h>
40#include <asm/mach/time.h> 39#include <asm/mach/time.h>
41#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) 40#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
42#include <mach/spi.h> 41#include <mach/spi.h>
@@ -150,7 +149,7 @@ static struct platform_device *platform_devices[] __initdata = {
150 &mxc_wdt, 149 &mxc_wdt,
151}; 150};
152 151
153static struct imxi2c_platform_data pca100_i2c_1_data = { 152static const struct imxi2c_platform_data pca100_i2c1_data __initconst = {
154 .bitrate = 100000, 153 .bitrate = 100000,
155}; 154};
156 155
@@ -333,7 +332,7 @@ static void __init pca100_init(void)
333 i2c_register_board_info(1, pca100_i2c_devices, 332 i2c_register_board_info(1, pca100_i2c_devices,
334 ARRAY_SIZE(pca100_i2c_devices)); 333 ARRAY_SIZE(pca100_i2c_devices));
335 334
336 mxc_register_device(&mxc_i2c_device1, &pca100_i2c_1_data); 335 imx27_add_i2c_imx1(&pca100_i2c1_data);
337 336
338 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT); 337 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
339 mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_OUT); 338 mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_OUT);
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index bc44d6faf47d..7559e0f7527d 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -35,7 +35,6 @@
35#include <mach/board-pcm038.h> 35#include <mach/board-pcm038.h>
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/i2c.h>
39#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
40#include <mach/imx-uart.h> 39#include <mach/imx-uart.h>
41#include <mach/mxc_nand.h> 40#include <mach/mxc_nand.h>
@@ -194,7 +193,7 @@ static void __init pcm038_init_sram(void)
194 mx27_setup_weimcs(1, 0x0000d843, 0x22252521, 0x22220a00); 193 mx27_setup_weimcs(1, 0x0000d843, 0x22252521, 0x22220a00);
195} 194}
196 195
197static struct imxi2c_platform_data pcm038_i2c_1_data = { 196static const struct imxi2c_platform_data pcm038_i2c1_data __initconst = {
198 .bitrate = 100000, 197 .bitrate = 100000,
199}; 198};
200 199
@@ -318,7 +317,7 @@ static void __init pcm038_init(void)
318 i2c_register_board_info(1, pcm038_i2c_devices, 317 i2c_register_board_info(1, pcm038_i2c_devices,
319 ARRAY_SIZE(pcm038_i2c_devices)); 318 ARRAY_SIZE(pcm038_i2c_devices));
320 319
321 mxc_register_device(&mxc_i2c_device1, &pcm038_i2c_1_data); 320 imx27_add_i2c_imx1(&pcm038_i2c1_data);
322 321
323 /* PE18 for user-LED D40 */ 322 /* PE18 for user-LED D40 */
324 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT); 323 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT);
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index bae9cd75beee..a8ab2e02a8ca 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -48,7 +48,7 @@
48#define MX27_CSPI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x0f000) 48#define MX27_CSPI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x0f000)
49#define MX27_SSI1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x10000) 49#define MX27_SSI1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x10000)
50#define MX27_SSI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x11000) 50#define MX27_SSI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x11000)
51#define MX27_I2C_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x12000) 51#define MX27_I2C1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x12000)
52#define MX27_SDHC1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x13000) 52#define MX27_SDHC1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x13000)
53#define MX27_SDHC2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x14000) 53#define MX27_SDHC2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x14000)
54#define MX27_GPIO_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x15000) 54#define MX27_GPIO_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x15000)
@@ -150,7 +150,7 @@ static inline void mx27_setup_weimcs(size_t cs,
150#define MX27_INT_SDHC3 9 150#define MX27_INT_SDHC3 9
151#define MX27_INT_SDHC2 10 151#define MX27_INT_SDHC2 10
152#define MX27_INT_SDHC1 11 152#define MX27_INT_SDHC1 11
153#define MX27_INT_I2C 12 153#define MX27_INT_I2C1 12
154#define MX27_INT_SSI2 13 154#define MX27_INT_SSI2 13
155#define MX27_INT_SSI1 14 155#define MX27_INT_SSI1 14
156#define MX27_INT_CSPI2 15 156#define MX27_INT_CSPI2 15