aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-09-21 06:13:34 -0400
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-09-27 09:46:39 -0400
commit64de5ec168d9743903e6ec482c3e9f37af49f9c1 (patch)
tree177232c0fad2ef3959a8b7303f2d01076155cefc /arch/arm/plat-mxc
parent4697bb926f43b8012ebd111ef43834f42126a0ef (diff)
ARM: imx: reorganize imx-i2c device registration to use a struct per SoC
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-i2c.c75
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h10
-rw-r--r--arch/arm/plat-mxc/include/mach/mx51.h4
3 files changed, 78 insertions, 11 deletions
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
index d0af9f7d8ae..ab9670b96c8 100644
--- a/arch/arm/plat-mxc/devices/platform-imx-i2c.c
+++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
@@ -6,24 +6,85 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/hardware.h>
9#include <mach/devices-common.h> 10#include <mach/devices-common.h>
10 11
11struct platform_device *__init imx_add_imx_i2c(int id, 12#define imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size) \
12 resource_size_t iobase, resource_size_t iosize, int irq, 13 { \
14 .id = _id, \
15 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_I2C ## _hwid, \
18 }
19
20#define imx_imx_i2c_data_entry(soc, _id, _hwid, _size) \
21 [_id] = imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size)
22
23#ifdef CONFIG_SOC_IMX1
24const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst =
25 imx_imx_i2c_data_entry_single(MX1, 0, , SZ_4K);
26#endif /* ifdef CONFIG_SOC_IMX1 */
27
28#ifdef CONFIG_SOC_IMX21
29const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
30 imx_imx_i2c_data_entry_single(MX21, 0, , SZ_4K);
31#endif /* ifdef CONFIG_SOC_IMX21 */
32
33#ifdef CONFIG_ARCH_MX25
34const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
35#define imx25_imx_i2c_data_entry(_id, _hwid) \
36 imx_imx_i2c_data_entry(MX25, _id, _hwid, SZ_16K)
37 imx25_imx_i2c_data_entry(0, 1),
38 imx25_imx_i2c_data_entry(1, 2),
39 imx25_imx_i2c_data_entry(2, 3),
40};
41#endif /* ifdef CONFIG_ARCH_MX25 */
42
43#ifdef CONFIG_SOC_IMX27
44const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
45#define imx27_imx_i2c_data_entry(_id, _hwid) \
46 imx_imx_i2c_data_entry(MX27, _id, _hwid, SZ_4K)
47 imx27_imx_i2c_data_entry(0, 1),
48 imx27_imx_i2c_data_entry(1, 2),
49};
50#endif /* ifdef CONFIG_SOC_IMX27 */
51
52#ifdef CONFIG_ARCH_MX31
53const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
54#define imx31_imx_i2c_data_entry(_id, _hwid) \
55 imx_imx_i2c_data_entry(MX31, _id, _hwid, SZ_4K)
56 imx31_imx_i2c_data_entry(0, 1),
57 imx31_imx_i2c_data_entry(1, 2),
58 imx31_imx_i2c_data_entry(2, 3),
59};
60#endif /* ifdef CONFIG_ARCH_MX31 */
61
62#ifdef CONFIG_ARCH_MX35
63const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
64#define imx35_imx_i2c_data_entry(_id, _hwid) \
65 imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K)
66 imx35_imx_i2c_data_entry(0, 1),
67 imx35_imx_i2c_data_entry(1, 2),
68};
69#endif /* ifdef CONFIG_ARCH_MX35 */
70
71struct platform_device *__init imx_add_imx_i2c(
72 const struct imx_imx_i2c_data *data,
13 const struct imxi2c_platform_data *pdata) 73 const struct imxi2c_platform_data *pdata)
14{ 74{
15 struct resource res[] = { 75 struct resource res[] = {
16 { 76 {
17 .start = iobase, 77 .start = data->iobase,
18 .end = iobase + iosize - 1, 78 .end = data->iobase + data->iosize - 1,
19 .flags = IORESOURCE_MEM, 79 .flags = IORESOURCE_MEM,
20 }, { 80 }, {
21 .start = irq, 81 .start = data->irq,
22 .end = irq, 82 .end = data->irq,
23 .flags = IORESOURCE_IRQ, 83 .flags = IORESOURCE_IRQ,
24 }, 84 },
25 }; 85 };
26 86
27 return imx_add_platform_device("imx-i2c", id, res, ARRAY_SIZE(res), 87 return imx_add_platform_device("imx-i2c", data->id,
88 res, ARRAY_SIZE(res),
28 pdata, sizeof(*pdata)); 89 pdata, sizeof(*pdata));
29} 90}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 84bfe44ec2c..490fe7c3ed5 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -21,8 +21,14 @@ struct platform_device *__init imx_add_flexcan(int id,
21 const struct flexcan_platform_data *pdata); 21 const struct flexcan_platform_data *pdata);
22 22
23#include <mach/i2c.h> 23#include <mach/i2c.h>
24struct platform_device *__init imx_add_imx_i2c(int id, 24struct imx_imx_i2c_data {
25 resource_size_t iobase, resource_size_t iosize, int irq, 25 int id;
26 resource_size_t iobase;
27 resource_size_t iosize;
28 resource_size_t irq;
29};
30struct platform_device *__init imx_add_imx_i2c(
31 const struct imx_imx_i2c_data *data,
26 const struct imxi2c_platform_data *pdata); 32 const struct imxi2c_platform_data *pdata);
27 33
28#include <mach/ssi.h> 34#include <mach/ssi.h>
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h
index f6026506c5e..b919235768a 100644
--- a/arch/arm/plat-mxc/include/mach/mx51.h
+++ b/arch/arm/plat-mxc/include/mach/mx51.h
@@ -341,8 +341,8 @@
341#define MX51_MXC_INT_WDOG2 59 341#define MX51_MXC_INT_WDOG2 59
342#define MX51_MXC_INT_KPP 60 342#define MX51_MXC_INT_KPP 60
343#define MX51_MXC_INT_PWM1 61 343#define MX51_MXC_INT_PWM1 61
344#define MX51_MXC_INT_I2C1 62 344#define MX51_INT_I2C1 62
345#define MX51_MXC_INT_I2C2 63 345#define MX51_INT_I2C2 63
346#define MX51_MXC_INT_HS_I2C 64 346#define MX51_MXC_INT_HS_I2C 64
347#define MX51_MXC_INT_RESV65 65 347#define MX51_MXC_INT_RESV65 65
348#define MX51_MXC_INT_RESV66 66 348#define MX51_MXC_INT_RESV66 66