aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-09-30 10:44:53 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-10-01 03:32:05 -0400
commit44505c0768971f4aa94ca09c8155448a46a7ff8a (patch)
treec2ce5c93554182d73eaa95972c4ba9a7cff646a7
parent64de5ec168d9743903e6ec482c3e9f37af49f9c1 (diff)
ARM: mx5: dynamically register imx-i2c devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/mach-mx5/Kconfig2
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c6
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c7
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h14
-rw-r--r--arch/arm/mach-mx5/devices.c38
-rw-r--r--arch/arm/mach-mx5/devices.h2
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-i2c.c9
7 files changed, 31 insertions, 47 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 0848db5dd364..e57caefb1f28 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -10,6 +10,7 @@ comment "MX5 platforms:"
10 10
11config MACH_MX51_BABBAGE 11config MACH_MX51_BABBAGE
12 bool "Support MX51 BABBAGE platforms" 12 bool "Support MX51 BABBAGE platforms"
13 select IMX_HAVE_PLATFORM_IMX_I2C
13 help 14 help
14 Include support for MX51 Babbage platform, also known as MX51EVK in 15 Include support for MX51 Babbage platform, also known as MX51EVK in
15 u-boot. This includes specific configurations for the board and its 16 u-boot. This includes specific configurations for the board and its
@@ -24,6 +25,7 @@ config MACH_MX51_3DS
24 25
25config MACH_EUKREA_CPUIMX51 26config MACH_EUKREA_CPUIMX51
26 bool "Support Eukrea CPUIMX51 module" 27 bool "Support Eukrea CPUIMX51 module"
28 select IMX_HAVE_PLATFORM_IMX_I2C
27 help 29 help
28 Include support for Eukrea CPUIMX51 platform. This includes 30 Include support for Eukrea CPUIMX51 platform. This includes
29 specific configurations for the module and its peripherals. 31 specific configurations for the module and its peripherals.
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
index 623607a20f57..d52f2527f6bf 100644
--- a/arch/arm/mach-mx5/board-cpuimx51.c
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -30,7 +30,6 @@
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/imx-uart.h> 31#include <mach/imx-uart.h>
32#include <mach/iomux-mx51.h> 32#include <mach/iomux-mx51.h>
33#include <mach/i2c.h>
34#include <mach/mxc_ehci.h> 33#include <mach/mxc_ehci.h>
35 34
36#include <asm/irq.h> 35#include <asm/irq.h>
@@ -152,7 +151,8 @@ static struct imxuart_platform_data uart_pdata = {
152 .flags = IMXUART_HAVE_RTSCTS, 151 .flags = IMXUART_HAVE_RTSCTS,
153}; 152};
154 153
155static struct imxi2c_platform_data eukrea_cpuimx51_i2c_data = { 154static const
155struct imxi2c_platform_data eukrea_cpuimx51_i2c_data __initconst = {
156 .bitrate = 100000, 156 .bitrate = 100000,
157}; 157};
158 158
@@ -255,7 +255,7 @@ static void __init eukrea_cpuimx51_init(void)
255 255
256 platform_add_devices(devices, ARRAY_SIZE(devices)); 256 platform_add_devices(devices, ARRAY_SIZE(devices));
257 257
258 mxc_register_device(&mxc_i2c_device1, &eukrea_cpuimx51_i2c_data); 258 imx51_add_imx_i2c(1, &eukrea_cpuimx51_i2c_data);
259 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices, 259 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
260 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices)); 260 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
261 261
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index caa8f680649e..3f3075d7768f 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -23,7 +23,6 @@
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/imx-uart.h> 24#include <mach/imx-uart.h>
25#include <mach/iomux-mx51.h> 25#include <mach/iomux-mx51.h>
26#include <mach/i2c.h>
27#include <mach/mxc_ehci.h> 26#include <mach/mxc_ehci.h>
28 27
29#include <asm/irq.h> 28#include <asm/irq.h>
@@ -137,7 +136,7 @@ static inline void mxc_init_imx_uart(void)
137} 136}
138#endif /* SERIAL_IMX */ 137#endif /* SERIAL_IMX */
139 138
140static struct imxi2c_platform_data babbage_i2c_data = { 139static const struct imxi2c_platform_data babbage_i2c_data __initconst = {
141 .bitrate = 100000, 140 .bitrate = 100000,
142}; 141};
143 142
@@ -293,8 +292,8 @@ static void __init mxc_board_init(void)
293 babbage_fec_reset(); 292 babbage_fec_reset();
294 platform_add_devices(devices, ARRAY_SIZE(devices)); 293 platform_add_devices(devices, ARRAY_SIZE(devices));
295 294
296 mxc_register_device(&mxc_i2c_device0, &babbage_i2c_data); 295 imx51_add_imx_i2c(0, &babbage_i2c_data);
297 mxc_register_device(&mxc_i2c_device1, &babbage_i2c_data); 296 imx51_add_imx_i2c(1, &babbage_i2c_data);
298 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); 297 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
299 298
300 if (otg_mode_host) 299 if (otg_mode_host)
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
new file mode 100644
index 000000000000..a3cc3834c9fe
--- /dev/null
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -0,0 +1,14 @@
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/mx51.h>
10#include <mach/devices-common.h>
11
12extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
13#define imx51_add_imx_i2c(id, pdata) \
14 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 1920ff4963b2..70b76d16391c 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -93,44 +93,6 @@ struct platform_device mxc_fec_device = {
93 .resource = mxc_fec_resources, 93 .resource = mxc_fec_resources,
94}; 94};
95 95
96static struct resource mxc_i2c0_resources[] = {
97 {
98 .start = MX51_I2C1_BASE_ADDR,
99 .end = MX51_I2C1_BASE_ADDR + SZ_4K - 1,
100 .flags = IORESOURCE_MEM,
101 }, {
102 .start = MX51_MXC_INT_I2C1,
103 .end = MX51_MXC_INT_I2C1,
104 .flags = IORESOURCE_IRQ,
105 },
106};
107
108struct platform_device mxc_i2c_device0 = {
109 .name = "imx-i2c",
110 .id = 0,
111 .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
112 .resource = mxc_i2c0_resources,
113};
114
115static struct resource mxc_i2c1_resources[] = {
116 {
117 .start = MX51_I2C2_BASE_ADDR,
118 .end = MX51_I2C2_BASE_ADDR + SZ_4K - 1,
119 .flags = IORESOURCE_MEM,
120 }, {
121 .start = MX51_MXC_INT_I2C2,
122 .end = MX51_MXC_INT_I2C2,
123 .flags = IORESOURCE_IRQ,
124 },
125};
126
127struct platform_device mxc_i2c_device1 = {
128 .name = "imx-i2c",
129 .id = 1,
130 .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
131 .resource = mxc_i2c1_resources,
132};
133
134static struct resource mxc_hsi2c_resources[] = { 96static struct resource mxc_hsi2c_resources[] = {
135 { 97 {
136 .start = MX51_HSI2C_DMA_BASE_ADDR, 98 .start = MX51_HSI2C_DMA_BASE_ADDR,
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index e509cfaad1d4..5c2918fcec0d 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -6,7 +6,5 @@ extern struct platform_device mxc_usbdr_host_device;
6extern struct platform_device mxc_usbh1_device; 6extern struct platform_device mxc_usbh1_device;
7extern struct platform_device mxc_usbdr_udc_device; 7extern struct platform_device mxc_usbdr_udc_device;
8extern struct platform_device mxc_wdt; 8extern struct platform_device mxc_wdt;
9extern struct platform_device mxc_i2c_device0;
10extern struct platform_device mxc_i2c_device1;
11extern struct platform_device mxc_hsi2c_device; 9extern struct platform_device mxc_hsi2c_device;
12extern struct platform_device mxc_keypad_device; 10extern struct platform_device mxc_keypad_device;
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
index ab9670b96c8a..ca988d40a3d7 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
@@ -68,6 +68,15 @@ const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
68}; 68};
69#endif /* ifdef CONFIG_ARCH_MX35 */ 69#endif /* ifdef CONFIG_ARCH_MX35 */
70 70
71#ifdef CONFIG_ARCH_MX51
72const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
73#define imx51_imx_i2c_data_entry(_id, _hwid) \
74 imx_imx_i2c_data_entry(MX51, _id, _hwid, SZ_4K)
75 imx51_imx_i2c_data_entry(0, 1),
76 imx51_imx_i2c_data_entry(1, 2),
77};
78#endif /* ifdef CONFIG_ARCH_MX51 */
79
71struct platform_device *__init imx_add_imx_i2c( 80struct platform_device *__init imx_add_imx_i2c(
72 const struct imx_imx_i2c_data *data, 81 const struct imx_imx_i2c_data *data,
73 const struct imxi2c_platform_data *pdata) 82 const struct imxi2c_platform_data *pdata)