diff options
-rw-r--r-- | arch/arm/mach-mx25/devices-imx25.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-mx3/devices-imx35.h | 9 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-flexcan.c | 48 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 11 |
4 files changed, 56 insertions, 21 deletions
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h index 93afa10b13cf..f62ce93ccbcd 100644 --- a/arch/arm/mach-mx25/devices-imx25.h +++ b/arch/arm/mach-mx25/devices-imx25.h | |||
@@ -13,10 +13,11 @@ extern const struct imx_fec_data imx25_fec_data __initconst; | |||
13 | #define imx25_add_fec(pdata) \ | 13 | #define imx25_add_fec(pdata) \ |
14 | imx_add_fec(&imx25_fec_data, pdata) | 14 | imx_add_fec(&imx25_fec_data, pdata) |
15 | 15 | ||
16 | #define imx25_add_flexcan0(pdata) \ | 16 | extern const struct imx_flexcan_data imx25_flexcan_data[] __initconst; |
17 | imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata) | 17 | #define imx25_add_flexcan(id, pdata) \ |
18 | #define imx25_add_flexcan1(pdata) \ | 18 | imx_add_flexcan(&imx25_flexcan_data[id], pdata) |
19 | imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata) | 19 | #define imx25_add_flexcan0(pdata) imx25_add_flexcan(0, pdata) |
20 | #define imx25_add_flexcan1(pdata) imx25_add_flexcan(1, pdata) | ||
20 | 21 | ||
21 | extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst; | 22 | extern const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst; |
22 | #define imx25_add_imx_i2c(id, pdata) \ | 23 | #define imx25_add_imx_i2c(id, pdata) \ |
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h index 7602cb49aab6..a71ce68af9a1 100644 --- a/arch/arm/mach-mx3/devices-imx35.h +++ b/arch/arm/mach-mx3/devices-imx35.h | |||
@@ -13,10 +13,11 @@ extern const struct imx_fec_data imx35_fec_data __initconst; | |||
13 | #define imx35_add_fec(pdata) \ | 13 | #define imx35_add_fec(pdata) \ |
14 | imx_add_fec(&imx35_fec_data, pdata) | 14 | imx_add_fec(&imx35_fec_data, pdata) |
15 | 15 | ||
16 | #define imx35_add_flexcan0(pdata) \ | 16 | extern const struct imx_flexcan_data imx35_flexcan_data[] __initconst; |
17 | imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata) | 17 | #define imx35_add_flexcan(id, pdata) \ |
18 | #define imx35_add_flexcan1(pdata) \ | 18 | imx_add_flexcan(&imx35_flexcan_data[id], pdata) |
19 | imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata) | 19 | #define imx35_add_flexcan0(pdata) imx35_add_flexcan(0, pdata) |
20 | #define imx35_add_flexcan1(pdata) imx35_add_flexcan(1, pdata) | ||
20 | 21 | ||
21 | extern const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst; | 22 | extern const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst; |
22 | #define imx35_add_imx_i2c(id, pdata) \ | 23 | #define imx35_add_imx_i2c(id, pdata) \ |
diff --git a/arch/arm/plat-mxc/devices/platform-flexcan.c b/arch/arm/plat-mxc/devices/platform-flexcan.c index 5e97a01f14f3..518901750587 100644 --- a/arch/arm/plat-mxc/devices/platform-flexcan.c +++ b/arch/arm/plat-mxc/devices/platform-flexcan.c | |||
@@ -5,26 +5,54 @@ | |||
5 | * the terms of the GNU General Public License version 2 as published by the | 5 | * the terms of the GNU General Public License version 2 as published by the |
6 | * Free Software Foundation. | 6 | * Free Software Foundation. |
7 | */ | 7 | */ |
8 | 8 | #include <mach/hardware.h> | |
9 | #include <mach/devices-common.h> | 9 | #include <mach/devices-common.h> |
10 | 10 | ||
11 | struct platform_device *__init imx_add_flexcan(int id, | 11 | #define imx_flexcan_data_entry_single(soc, _id, _hwid, _size) \ |
12 | resource_size_t iobase, resource_size_t iosize, | 12 | { \ |
13 | resource_size_t irq, | 13 | .id = _id, \ |
14 | .iobase = soc ## _CAN ## _hwid ## _BASE_ADDR, \ | ||
15 | .iosize = _size, \ | ||
16 | .irq = soc ## _INT_CAN ## _hwid, \ | ||
17 | } | ||
18 | |||
19 | #define imx_flexcan_data_entry(soc, _id, _hwid, _size) \ | ||
20 | [_id] = imx_flexcan_data_entry_single(soc, _id, _hwid, _size) | ||
21 | |||
22 | #ifdef CONFIG_ARCH_MX25 | ||
23 | const struct imx_flexcan_data imx25_flexcan_data[] __initconst = { | ||
24 | #define imx25_flexcan_data_entry(_id, _hwid) \ | ||
25 | imx_flexcan_data_entry(MX25, _id, _hwid, SZ_16K) | ||
26 | imx25_flexcan_data_entry(0, 1), | ||
27 | imx25_flexcan_data_entry(1, 2), | ||
28 | }; | ||
29 | #endif /* ifdef CONFIG_ARCH_MX25 */ | ||
30 | |||
31 | #ifdef CONFIG_ARCH_MX35 | ||
32 | const struct imx_flexcan_data imx35_flexcan_data[] __initconst = { | ||
33 | #define imx35_flexcan_data_entry(_id, _hwid) \ | ||
34 | imx_flexcan_data_entry(MX35, _id, _hwid, SZ_16K) | ||
35 | imx35_flexcan_data_entry(0, 1), | ||
36 | imx35_flexcan_data_entry(1, 2), | ||
37 | }; | ||
38 | #endif /* ifdef CONFIG_ARCH_MX35 */ | ||
39 | |||
40 | struct platform_device *__init imx_add_flexcan( | ||
41 | const struct imx_flexcan_data *data, | ||
14 | const struct flexcan_platform_data *pdata) | 42 | const struct flexcan_platform_data *pdata) |
15 | { | 43 | { |
16 | struct resource res[] = { | 44 | struct resource res[] = { |
17 | { | 45 | { |
18 | .start = iobase, | 46 | .start = data->iobase, |
19 | .end = iobase + iosize - 1, | 47 | .end = data->iobase + data->iosize - 1, |
20 | .flags = IORESOURCE_MEM, | 48 | .flags = IORESOURCE_MEM, |
21 | }, { | 49 | }, { |
22 | .start = irq, | 50 | .start = data->irq, |
23 | .end = irq, | 51 | .end = data->irq, |
24 | .flags = IORESOURCE_IRQ, | 52 | .flags = IORESOURCE_IRQ, |
25 | }, | 53 | }, |
26 | }; | 54 | }; |
27 | 55 | ||
28 | return imx_add_platform_device("flexcan", id, res, ARRAY_SIZE(res), | 56 | return imx_add_platform_device("flexcan", data->id, |
29 | pdata, sizeof(*pdata)); | 57 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); |
30 | } | 58 | } |
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index a0ac84542298..830369ea80d0 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -34,9 +34,14 @@ struct platform_device *__init imx_add_fec( | |||
34 | const struct fec_platform_data *pdata); | 34 | const struct fec_platform_data *pdata); |
35 | 35 | ||
36 | #include <linux/can/platform/flexcan.h> | 36 | #include <linux/can/platform/flexcan.h> |
37 | struct platform_device *__init imx_add_flexcan(int id, | 37 | struct imx_flexcan_data { |
38 | resource_size_t iobase, resource_size_t iosize, | 38 | int id; |
39 | resource_size_t irq, | 39 | resource_size_t iobase; |
40 | resource_size_t iosize; | ||
41 | resource_size_t irq; | ||
42 | }; | ||
43 | struct platform_device *__init imx_add_flexcan( | ||
44 | const struct imx_flexcan_data *data, | ||
40 | const struct flexcan_platform_data *pdata); | 45 | const struct flexcan_platform_data *pdata); |
41 | 46 | ||
42 | #include <linux/gpio_keys.h> | 47 | #include <linux/gpio_keys.h> |