aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-06-16 12:03:05 -0400
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-06-30 03:00:43 -0400
commit4a9b8b0b061ef750b5ef31d1e9d2fa0206731f2f (patch)
treed6128f7116c4cefdb801897c6febe5e1297a1228
parentc69871597dd173af2d7615429c0ee6aa10fae42b (diff)
ARM: imx: dynamically register imx-i2c devices (imx31)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--arch/arm/mach-mx3/Kconfig4
-rw-r--r--arch/arm/mach-mx3/devices-imx31.h7
-rw-r--r--arch/arm/mach-mx3/devices.c2
-rw-r--r--arch/arm/mach-mx3/devices.h2
-rw-r--r--arch/arm/mach-mx3/mach-armadillo5x0.c2
-rw-r--r--arch/arm/mach-mx3/mach-mx31ads.c3
-rw-r--r--arch/arm/mach-mx3/mach-mx31moboard.c10
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c9
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h4
9 files changed, 29 insertions, 14 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 5611b2376f1c..557a20b48830 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -15,6 +15,7 @@ comment "MX3 platforms:"
15config MACH_MX31ADS 15config MACH_MX31ADS
16 bool "Support MX31ADS platforms" 16 bool "Support MX31ADS platforms"
17 select ARCH_MX31 17 select ARCH_MX31
18 select IMX_HAVE_PLATFORM_IMX_I2C
18 default y 19 default y
19 help 20 help
20 Include support for MX31ADS platform. This includes specific 21 Include support for MX31ADS platform. This includes specific
@@ -34,6 +35,7 @@ config MACH_MX31ADS_WM1133_EV1
34config MACH_PCM037 35config MACH_PCM037
35 bool "Support Phytec pcm037 (i.MX31) platforms" 36 bool "Support Phytec pcm037 (i.MX31) platforms"
36 select ARCH_MX31 37 select ARCH_MX31
38 select IMX_HAVE_PLATFORM_IMX_I2C
37 select IMX_HAVE_PLATFORM_MXC_NAND 39 select IMX_HAVE_PLATFORM_MXC_NAND
38 select MXC_ULPI if USB_ULPI 40 select MXC_ULPI if USB_ULPI
39 help 41 help
@@ -77,6 +79,7 @@ config MACH_MX31_3DS_MXC_NAND_USE_BBT
77config MACH_MX31MOBOARD 79config MACH_MX31MOBOARD
78 bool "Support mx31moboard platforms (EPFL Mobots group)" 80 bool "Support mx31moboard platforms (EPFL Mobots group)"
79 select ARCH_MX31 81 select ARCH_MX31
82 select IMX_HAVE_PLATFORM_IMX_I2C
80 select MXC_ULPI if USB_ULPI 83 select MXC_ULPI if USB_ULPI
81 help 84 help
82 Include support for mx31moboard platform. This includes specific 85 Include support for mx31moboard platform. This includes specific
@@ -109,6 +112,7 @@ config MACH_PCM043
109config MACH_ARMADILLO5X0 112config MACH_ARMADILLO5X0
110 bool "Support Atmark Armadillo-500 Development Base Board" 113 bool "Support Atmark Armadillo-500 Development Base Board"
111 select ARCH_MX31 114 select ARCH_MX31
115 select IMX_HAVE_PLATFORM_IMX_I2C
112 select IMX_HAVE_PLATFORM_MXC_NAND 116 select IMX_HAVE_PLATFORM_MXC_NAND
113 select MXC_ULPI if USB_ULPI 117 select MXC_ULPI if USB_ULPI
114 help 118 help
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h
index 8bd8b3808cae..56bc1e1ca8d6 100644
--- a/arch/arm/mach-mx3/devices-imx31.h
+++ b/arch/arm/mach-mx3/devices-imx31.h
@@ -9,5 +9,12 @@
9#include <mach/mx31.h> 9#include <mach/mx31.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx31_add_imx_i2c0(pdata) \
13 imx_add_imx_i2c(0, MX31_I2C1_BASE_ADDR, SZ_4K, MX31_INT_I2C1, pdata)
14#define imx31_add_imx_i2c1(pdata) \
15 imx_add_imx_i2c(1, MX31_I2C2_BASE_ADDR, SZ_4K, MX31_INT_I2C2, pdata)
16#define imx31_add_imx_i2c2(pdata) \
17 imx_add_imx_i2c(2, MX31_I2C3_BASE_ADDR, SZ_4K, MX31_INT_I2C3, pdata)
18
12#define imx31_add_mxc_nand(pdata) \ 19#define imx31_add_mxc_nand(pdata) \
13 imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata) 20 imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index c8db84942bff..0743214127a9 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -167,6 +167,7 @@ struct platform_device mxc_w1_master_device = {
167 .resource = mxc_w1_master_resources, 167 .resource = mxc_w1_master_resources,
168}; 168};
169 169
170#if defined(CONFIG_ARCH_MX35)
170static struct resource mxc_i2c0_resources[] = { 171static struct resource mxc_i2c0_resources[] = {
171 { 172 {
172 .start = I2C_BASE_ADDR, 173 .start = I2C_BASE_ADDR,
@@ -223,6 +224,7 @@ struct platform_device mxc_i2c_device2 = {
223 .num_resources = ARRAY_SIZE(mxc_i2c2_resources), 224 .num_resources = ARRAY_SIZE(mxc_i2c2_resources),
224 .resource = mxc_i2c2_resources, 225 .resource = mxc_i2c2_resources,
225}; 226};
227#endif
226 228
227#ifdef CONFIG_ARCH_MX31 229#ifdef CONFIG_ARCH_MX31
228static struct resource mxcsdhc0_resources[] = { 230static struct resource mxcsdhc0_resources[] = {
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 4a224e6dc5ee..e108fa3f5d7e 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -5,9 +5,11 @@ extern struct platform_device mxc_uart_device2;
5extern struct platform_device mxc_uart_device3; 5extern struct platform_device mxc_uart_device3;
6extern struct platform_device mxc_uart_device4; 6extern struct platform_device mxc_uart_device4;
7extern struct platform_device mxc_w1_master_device; 7extern struct platform_device mxc_w1_master_device;
8#if defined(CONFIG_ARCH_MX35)
8extern struct platform_device mxc_i2c_device0; 9extern struct platform_device mxc_i2c_device0;
9extern struct platform_device mxc_i2c_device1; 10extern struct platform_device mxc_i2c_device1;
10extern struct platform_device mxc_i2c_device2; 11extern struct platform_device mxc_i2c_device2;
12#endif
11extern struct platform_device mx3_ipu; 13extern struct platform_device mx3_ipu;
12extern struct platform_device mx3_fb; 14extern struct platform_device mx3_fb;
13extern struct platform_device mx3_camera; 15extern struct platform_device mx3_camera;
diff --git a/arch/arm/mach-mx3/mach-armadillo5x0.c b/arch/arm/mach-mx3/mach-armadillo5x0.c
index 633107a69acd..423ffe774ead 100644
--- a/arch/arm/mach-mx3/mach-armadillo5x0.c
+++ b/arch/arm/mach-mx3/mach-armadillo5x0.c
@@ -499,7 +499,6 @@ static struct imxuart_platform_data uart_pdata = {
499 499
500static struct platform_device *devices[] __initdata = { 500static struct platform_device *devices[] __initdata = {
501 &armadillo5x0_smc911x_device, 501 &armadillo5x0_smc911x_device,
502 &mxc_i2c_device1,
503 &armadillo5x0_button_device, 502 &armadillo5x0_button_device,
504}; 503};
505 504
@@ -512,6 +511,7 @@ static void __init armadillo5x0_init(void)
512 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); 511 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0");
513 512
514 platform_add_devices(devices, ARRAY_SIZE(devices)); 513 platform_add_devices(devices, ARRAY_SIZE(devices));
514 imx31_add_imx_i2c1(NULL);
515 515
516 /* Register UART */ 516 /* Register UART */
517 mxc_register_device(&mxc_uart_device0, &uart_pdata); 517 mxc_register_device(&mxc_uart_device0, &uart_pdata);
diff --git a/arch/arm/mach-mx3/mach-mx31ads.c b/arch/arm/mach-mx3/mach-mx31ads.c
index a68b86826e8a..b6dc6c848b51 100644
--- a/arch/arm/mach-mx3/mach-mx31ads.c
+++ b/arch/arm/mach-mx3/mach-mx31ads.c
@@ -38,6 +38,7 @@
38#include <linux/mfd/wm8350/pmic.h> 38#include <linux/mfd/wm8350/pmic.h>
39#endif 39#endif
40 40
41#include "devices-imx31.h"
41#include "devices.h" 42#include "devices.h"
42 43
43/* Base address of PBC controller */ 44/* Base address of PBC controller */
@@ -500,7 +501,7 @@ static void mxc_init_i2c(void)
500 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1)); 501 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1));
501 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1)); 502 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1));
502 503
503 mxc_register_device(&mxc_i2c_device1, NULL); 504 imx31_add_imx_i2c1(NULL);
504} 505}
505#else 506#else
506static void mxc_init_i2c(void) 507static void mxc_init_i2c(void)
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index 545cfdd7e4e9..dd51d08f2594 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -41,13 +41,13 @@
41#include <mach/imx-uart.h> 41#include <mach/imx-uart.h>
42#include <mach/iomux-mx3.h> 42#include <mach/iomux-mx3.h>
43#include <mach/ipu.h> 43#include <mach/ipu.h>
44#include <mach/i2c.h>
45#include <mach/mmc.h> 44#include <mach/mmc.h>
46#include <mach/mxc_ehci.h> 45#include <mach/mxc_ehci.h>
47#include <mach/mx3_camera.h> 46#include <mach/mx3_camera.h>
48#include <mach/spi.h> 47#include <mach/spi.h>
49#include <mach/ulpi.h> 48#include <mach/ulpi.h>
50 49
50#include "devices-imx31.h"
51#include "devices.h" 51#include "devices.h"
52 52
53static unsigned int moboard_pins[] = { 53static unsigned int moboard_pins[] = {
@@ -139,11 +139,11 @@ static struct imxuart_platform_data uart4_pdata = {
139 .flags = IMXUART_HAVE_RTSCTS, 139 .flags = IMXUART_HAVE_RTSCTS,
140}; 140};
141 141
142static struct imxi2c_platform_data moboard_i2c0_pdata = { 142static const struct imxi2c_platform_data moboard_i2c0_data __initconst = {
143 .bitrate = 400000, 143 .bitrate = 400000,
144}; 144};
145 145
146static struct imxi2c_platform_data moboard_i2c1_pdata = { 146static const struct imxi2c_platform_data moboard_i2c1_data __initconst = {
147 .bitrate = 100000, 147 .bitrate = 100000,
148}; 148};
149 149
@@ -499,8 +499,8 @@ static void __init mxc_board_init(void)
499 499
500 mxc_register_device(&mxc_uart_device4, &uart4_pdata); 500 mxc_register_device(&mxc_uart_device4, &uart4_pdata);
501 501
502 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata); 502 imx31_add_imx_i2c0(&moboard_i2c0_data);
503 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata); 503 imx31_add_imx_i2c1(&moboard_i2c1_data);
504 504
505 mxc_register_device(&mxc_spi_device1, &moboard_spi1_master); 505 mxc_register_device(&mxc_spi_device1, &moboard_spi1_master);
506 mxc_register_device(&mxc_spi_device2, &moboard_spi2_master); 506 mxc_register_device(&mxc_spi_device2, &moboard_spi2_master);
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index d7fef469990a..7e3fc470d55d 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -41,7 +41,6 @@
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42#include <mach/common.h> 42#include <mach/common.h>
43#include <mach/hardware.h> 43#include <mach/hardware.h>
44#include <mach/i2c.h>
45#include <mach/imx-uart.h> 44#include <mach/imx-uart.h>
46#include <mach/iomux-mx3.h> 45#include <mach/iomux-mx3.h>
47#include <mach/ipu.h> 46#include <mach/ipu.h>
@@ -280,11 +279,11 @@ pcm037_nand_board_info __initconst = {
280 .hw_ecc = 1, 279 .hw_ecc = 1,
281}; 280};
282 281
283static struct imxi2c_platform_data pcm037_i2c_1_data = { 282static const struct imxi2c_platform_data pcm037_i2c1_data __initconst = {
284 .bitrate = 100000, 283 .bitrate = 100000,
285}; 284};
286 285
287static struct imxi2c_platform_data pcm037_i2c_2_data = { 286static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = {
288 .bitrate = 20000, 287 .bitrate = 20000,
289}; 288};
290 289
@@ -630,8 +629,8 @@ static void __init mxc_board_init(void)
630 i2c_register_board_info(1, pcm037_i2c_devices, 629 i2c_register_board_info(1, pcm037_i2c_devices,
631 ARRAY_SIZE(pcm037_i2c_devices)); 630 ARRAY_SIZE(pcm037_i2c_devices));
632 631
633 mxc_register_device(&mxc_i2c_device1, &pcm037_i2c_1_data); 632 imx31_add_imx_i2c1(&pcm037_i2c1_data);
634 mxc_register_device(&mxc_i2c_device2, &pcm037_i2c_2_data); 633 imx31_add_imx_i2c2(&pcm037_i2c2_data);
635 634
636 imx31_add_mxc_nand(&pcm037_nand_board_info); 635 imx31_add_mxc_nand(&pcm037_nand_board_info);
637 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata); 636 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index fb90e119c2b5..afee3ab9d62e 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -23,7 +23,7 @@
23#define MX31_ETB_SLOT4_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x10000) 23#define MX31_ETB_SLOT4_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x10000)
24#define MX31_ETB_SLOT5_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x14000) 24#define MX31_ETB_SLOT5_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x14000)
25#define MX31_ECT_CTIO_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x18000) 25#define MX31_ECT_CTIO_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x18000)
26#define MX31_I2C_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x80000) 26#define MX31_I2C1_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x80000)
27#define MX31_I2C3_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x84000) 27#define MX31_I2C3_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x84000)
28#define MX31_OTG_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x88000) 28#define MX31_OTG_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x88000)
29#define MX31_ATA_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x8c000) 29#define MX31_ATA_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x8c000)
@@ -145,7 +145,7 @@ static inline void mx31_setup_weimcs(size_t cs,
145#define MX31_INT_FIRI 7 145#define MX31_INT_FIRI 7
146#define MX31_INT_MMC_SDHC2 8 146#define MX31_INT_MMC_SDHC2 8
147#define MX31_INT_MMC_SDHC1 9 147#define MX31_INT_MMC_SDHC1 9
148#define MX31_INT_I2C 10 148#define MX31_INT_I2C1 10
149#define MX31_INT_SSI2 11 149#define MX31_INT_SSI2 11
150#define MX31_INT_SSI1 12 150#define MX31_INT_SSI1 12
151#define MX31_INT_CSPI2 13 151#define MX31_INT_CSPI2 13