diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-09-21 06:13:34 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-09-27 09:46:39 -0400 |
commit | 64de5ec168d9743903e6ec482c3e9f37af49f9c1 (patch) | |
tree | 177232c0fad2ef3959a8b7303f2d01076155cefc /arch | |
parent | 4697bb926f43b8012ebd111ef43834f42126a0ef (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')
-rw-r--r-- | arch/arm/mach-imx/devices-imx1.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx21.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx27.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-mx25/devices-imx25.h | 12 | ||||
-rw-r--r-- | arch/arm/mach-mx3/devices-imx31.h | 12 | ||||
-rw-r--r-- | arch/arm/mach-mx3/devices-imx35.h | 12 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-imx-i2c.c | 75 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 10 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/mx51.h | 4 |
9 files changed, 105 insertions, 35 deletions
diff --git a/arch/arm/mach-imx/devices-imx1.h b/arch/arm/mach-imx/devices-imx1.h index 2861cb8b100a..6cf08640dae9 100644 --- a/arch/arm/mach-imx/devices-imx1.h +++ b/arch/arm/mach-imx/devices-imx1.h | |||
@@ -9,8 +9,9 @@ | |||
9 | #include <mach/mx1.h> | 9 | #include <mach/mx1.h> |
10 | #include <mach/devices-common.h> | 10 | #include <mach/devices-common.h> |
11 | 11 | ||
12 | extern const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst; | ||
12 | #define imx1_add_i2c_imx(pdata) \ | 13 | #define imx1_add_i2c_imx(pdata) \ |
13 | imx_add_imx_i2c(0, MX1_I2C_BASE_ADDR, SZ_4K, MX1_INT_I2C, pdata) | 14 | imx_add_imx_i2c(&imx1_imx_i2c_data, pdata) |
14 | 15 | ||
15 | extern const struct imx_imx_uart_3irq_data imx1_imx_uart_data[] __initconst; | 16 | extern const struct imx_imx_uart_3irq_data imx1_imx_uart_data[] __initconst; |
16 | #define imx1_add_imx_uart(id, pdata) \ | 17 | #define imx1_add_imx_uart(id, pdata) \ |
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h index 24868c36d824..d3d2b2669b96 100644 --- a/arch/arm/mach-imx/devices-imx21.h +++ b/arch/arm/mach-imx/devices-imx21.h | |||
@@ -9,8 +9,9 @@ | |||
9 | #include <mach/mx21.h> | 9 | #include <mach/mx21.h> |
10 | #include <mach/devices-common.h> | 10 | #include <mach/devices-common.h> |
11 | 11 | ||
12 | extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst; | ||
12 | #define imx21_add_i2c_imx(pdata) \ | 13 | #define imx21_add_i2c_imx(pdata) \ |
13 | imx_add_imx_i2c(0, MX2x_I2C_BASE_ADDR, SZ_4K, MX2x_INT_I2C, pdata) | 14 | imx_add_imx_i2c(&imx21_imx_i2c_data, pdata) |
14 | 15 | ||
15 | extern const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst; | 16 | extern const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst; |
16 | #define imx21_add_imx_ssi(id, pdata) \ | 17 | #define imx21_add_imx_ssi(id, pdata) \ |
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index 2972e6912af4..193dfb55023b 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h | |||
@@ -9,10 +9,11 @@ | |||
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) \ | 12 | extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst; |
13 | imx_add_imx_i2c(0, MX27_I2C1_BASE_ADDR, SZ_4K, MX27_INT_I2C1, pdata) | 13 | #define imx27_add_imx_i2c(id, pdata) \ |
14 | #define imx27_add_i2c_imx1(pdata) \ | 14 | imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata) |
15 | imx_add_imx_i2c(1, MX27_I2C2_BASE_ADDR, SZ_4K, MX27_INT_I2C2, pdata) | 15 | #define imx27_add_i2c_imx0(pdata) imx27_add_imx_i2c(0, pdata) |
16 | #define imx27_add_i2c_imx1(pdata) imx27_add_imx_i2c(1, pdata) | ||
16 | 17 | ||
17 | extern const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst; | 18 | extern const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst; |
18 | #define imx27_add_imx_ssi(id, pdata) \ | 19 | #define imx27_add_imx_ssi(id, pdata) \ |
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h index bf93facef3d0..1dd95721d9f5 100644 --- a/arch/arm/mach-mx25/devices-imx25.h +++ b/arch/arm/mach-mx25/devices-imx25.h | |||
@@ -14,12 +14,12 @@ | |||
14 | #define imx25_add_flexcan1(pdata) \ | 14 | #define imx25_add_flexcan1(pdata) \ |
15 | imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata) | 15 | imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata) |
16 | 16 | ||
17 | #define imx25_add_imx_i2c0(pdata) \ | 17 | extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst; |
18 | imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata) | 18 | #define imx25_add_imx_i2c(id, pdata) \ |
19 | #define imx25_add_imx_i2c1(pdata) \ | 19 | imx_add_imx_i2c(&imx25_imx_i2c_data[id], pdata) |
20 | imx_add_imx_i2c(1, MX25_I2C2_BASE_ADDR, SZ_16K, MX25_INT_I2C2, pdata) | 20 | #define imx25_add_imx_i2c0(pdata) imx25_add_imx_i2c(0, pdata) |
21 | #define imx25_add_imx_i2c2(pdata) \ | 21 | #define imx25_add_imx_i2c1(pdata) imx25_add_imx_i2c(1, pdata) |
22 | imx_add_imx_i2c(2, MX25_I2C3_BASE_ADDR, SZ_16K, MX25_INT_I2C3, pdata) | 22 | #define imx25_add_imx_i2c2(pdata) imx25_add_imx_i2c(2, pdata) |
23 | 23 | ||
24 | extern const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst; | 24 | extern const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst; |
25 | #define imx25_add_imx_ssi(id, pdata) \ | 25 | #define imx25_add_imx_ssi(id, pdata) \ |
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h index b8568a1af81d..eea425ff074e 100644 --- a/arch/arm/mach-mx3/devices-imx31.h +++ b/arch/arm/mach-mx3/devices-imx31.h | |||
@@ -9,12 +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) \ | 12 | extern const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst; |
13 | imx_add_imx_i2c(0, MX31_I2C1_BASE_ADDR, SZ_4K, MX31_INT_I2C1, pdata) | 13 | #define imx31_add_imx_i2c(id, pdata) \ |
14 | #define imx31_add_imx_i2c1(pdata) \ | 14 | imx_add_imx_i2c(&imx31_imx_i2c_data[id], pdata) |
15 | imx_add_imx_i2c(1, MX31_I2C2_BASE_ADDR, SZ_4K, MX31_INT_I2C2, pdata) | 15 | #define imx31_add_imx_i2c0(pdata) imx31_add_imx_i2c(0, pdata) |
16 | #define imx31_add_imx_i2c2(pdata) \ | 16 | #define imx31_add_imx_i2c1(pdata) imx31_add_imx_i2c(1, pdata) |
17 | imx_add_imx_i2c(2, MX31_I2C3_BASE_ADDR, SZ_4K, MX31_INT_I2C3, pdata) | 17 | #define imx31_add_imx_i2c2(pdata) imx31_add_imx_i2c(2, pdata) |
18 | 18 | ||
19 | extern const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst; | 19 | extern const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst; |
20 | #define imx31_add_imx_ssi(id, pdata) \ | 20 | #define imx31_add_imx_ssi(id, pdata) \ |
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h index 813e570fd3ba..f187d3552738 100644 --- a/arch/arm/mach-mx3/devices-imx35.h +++ b/arch/arm/mach-mx3/devices-imx35.h | |||
@@ -14,12 +14,12 @@ | |||
14 | #define imx35_add_flexcan1(pdata) \ | 14 | #define imx35_add_flexcan1(pdata) \ |
15 | imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata) | 15 | imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata) |
16 | 16 | ||
17 | #define imx35_add_imx_i2c0(pdata) \ | 17 | extern const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst; |
18 | imx_add_imx_i2c(0, MX35_I2C1_BASE_ADDR, SZ_4K, MX35_INT_I2C1, pdata) | 18 | #define imx35_add_imx_i2c(id, pdata) \ |
19 | #define imx35_add_imx_i2c1(pdata) \ | 19 | imx_add_imx_i2c(&imx35_imx_i2c_data[id], pdata) |
20 | imx_add_imx_i2c(1, MX35_I2C2_BASE_ADDR, SZ_4K, MX35_INT_I2C2, pdata) | 20 | #define imx35_add_imx_i2c0(pdata) imx35_add_imx_i2c(0, pdata) |
21 | #define imx35_add_imx_i2c2(pdata) \ | 21 | #define imx35_add_imx_i2c1(pdata) imx35_add_imx_i2c(1, pdata) |
22 | imx_add_imx_i2c(2, MX35_I2C3_BASE_ADDR, SZ_4K, MX35_INT_I2C3, pdata) | 22 | #define imx35_add_imx_i2c2(pdata) imx35_add_imx_i2c(2, pdata) |
23 | 23 | ||
24 | extern const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst; | 24 | extern const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst; |
25 | #define imx35_add_imx_ssi(id, pdata) \ | 25 | #define imx35_add_imx_ssi(id, pdata) \ |
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c index d0af9f7d8aed..ab9670b96c8a 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 | ||
11 | struct 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 | ||
24 | const 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 | ||
29 | const 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 | ||
34 | const 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 | ||
44 | const 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 | ||
53 | const 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 | ||
63 | const 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 | |||
71 | struct 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 84bfe44ec2cd..490fe7c3ed5f 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> |
24 | struct platform_device *__init imx_add_imx_i2c(int id, | 24 | struct 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 | }; | ||
30 | struct 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 f6026506c5ef..b919235768a0 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 |