diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2011-02-02 07:50:30 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-02-03 09:11:19 -0500 |
commit | 22cbba1b82de458028f4aa270e88492b622c1ea8 (patch) | |
tree | 278dae4fd5b159d4721381b954070e0d0125713b | |
parent | 6ea038a7771be6652784fd06ad01f44028e3a43c (diff) |
ARM: mxs: dynamically register flexcan devices for mx28
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
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-mxs/devices-mx28.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-flexcan.c | 51 | ||||
-rw-r--r-- | arch/arm/mach-mxs/include/mach/devices-common.h | 12 |
5 files changed, 74 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/devices-mx28.h b/arch/arm/mach-mxs/devices-mx28.h index 1ab7bf0aa458..3b18304c5653 100644 --- a/arch/arm/mach-mxs/devices-mx28.h +++ b/arch/arm/mach-mxs/devices-mx28.h | |||
@@ -26,3 +26,9 @@ extern const struct mxs_auart_data mx28_auart_data[] __initconst; | |||
26 | extern const struct mxs_fec_data mx28_fec_data[] __initconst; | 26 | extern const struct mxs_fec_data mx28_fec_data[] __initconst; |
27 | #define mx28_add_fec(id, pdata) \ | 27 | #define mx28_add_fec(id, pdata) \ |
28 | mxs_add_fec(&mx28_fec_data[id], pdata) | 28 | mxs_add_fec(&mx28_fec_data[id], pdata) |
29 | |||
30 | extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst; | ||
31 | #define mx28_add_flexcan(id, pdata) \ | ||
32 | mxs_add_flexcan(&mx28_flexcan_data[id], pdata) | ||
33 | #define mx28_add_flexcan0(pdata) mx28_add_flexcan(0, pdata) | ||
34 | #define mx28_add_flexcan1(pdata) mx28_add_flexcan(1, pdata) | ||
diff --git a/arch/arm/mach-mxs/devices/Kconfig b/arch/arm/mach-mxs/devices/Kconfig index 3001b754948a..6c65b6716cf7 100644 --- a/arch/arm/mach-mxs/devices/Kconfig +++ b/arch/arm/mach-mxs/devices/Kconfig | |||
@@ -7,3 +7,7 @@ config MXS_HAVE_PLATFORM_AUART | |||
7 | 7 | ||
8 | config MXS_HAVE_PLATFORM_FEC | 8 | config MXS_HAVE_PLATFORM_FEC |
9 | bool | 9 | bool |
10 | |||
11 | config MXS_HAVE_PLATFORM_FLEXCAN | ||
12 | select HAVE_CAN_FLEXCAN if CAN | ||
13 | bool | ||
diff --git a/arch/arm/mach-mxs/devices/Makefile b/arch/arm/mach-mxs/devices/Makefile index c814d054bad7..a8dc8d5f6e1e 100644 --- a/arch/arm/mach-mxs/devices/Makefile +++ b/arch/arm/mach-mxs/devices/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o | 1 | obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o |
2 | obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o | 2 | obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o |
3 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o | 3 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o |
4 | obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | ||
diff --git a/arch/arm/mach-mxs/devices/platform-flexcan.c b/arch/arm/mach-mxs/devices/platform-flexcan.c new file mode 100644 index 000000000000..43a6b4bae6fe --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-flexcan.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010, 2011 Pengutronix, | ||
3 | * Marc Kleine-Budde <kernel@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 <asm/sizes.h> | ||
10 | #include <mach/mx28.h> | ||
11 | #include <mach/devices-common.h> | ||
12 | |||
13 | #define mxs_flexcan_data_entry_single(soc, _id, _hwid, _size) \ | ||
14 | { \ | ||
15 | .id = _id, \ | ||
16 | .iobase = soc ## _CAN ## _hwid ## _BASE_ADDR, \ | ||
17 | .iosize = _size, \ | ||
18 | .irq = soc ## _INT_CAN ## _hwid, \ | ||
19 | } | ||
20 | |||
21 | #define mxs_flexcan_data_entry(soc, _id, _hwid, _size) \ | ||
22 | [_id] = mxs_flexcan_data_entry_single(soc, _id, _hwid, _size) | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX28 | ||
25 | const struct mxs_flexcan_data mx28_flexcan_data[] __initconst = { | ||
26 | #define mx28_flexcan_data_entry(_id, _hwid) \ | ||
27 | mxs_flexcan_data_entry_single(MX28, _id, _hwid, SZ_8K) | ||
28 | mx28_flexcan_data_entry(0, 0), | ||
29 | mx28_flexcan_data_entry(1, 1), | ||
30 | }; | ||
31 | #endif /* ifdef CONFIG_SOC_IMX28 */ | ||
32 | |||
33 | struct platform_device *__init mxs_add_flexcan( | ||
34 | const struct mxs_flexcan_data *data, | ||
35 | const struct flexcan_platform_data *pdata) | ||
36 | { | ||
37 | struct resource res[] = { | ||
38 | { | ||
39 | .start = data->iobase, | ||
40 | .end = data->iobase + data->iosize - 1, | ||
41 | .flags = IORESOURCE_MEM, | ||
42 | }, { | ||
43 | .start = data->irq, | ||
44 | .end = data->irq, | ||
45 | .flags = IORESOURCE_IRQ, | ||
46 | }, | ||
47 | }; | ||
48 | |||
49 | return mxs_add_platform_device("flexcan", data->id, | ||
50 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); | ||
51 | } | ||
diff --git a/arch/arm/mach-mxs/include/mach/devices-common.h b/arch/arm/mach-mxs/include/mach/devices-common.h index bed40021e2c2..e7aefb467ab3 100644 --- a/arch/arm/mach-mxs/include/mach/devices-common.h +++ b/arch/arm/mach-mxs/include/mach/devices-common.h | |||
@@ -51,3 +51,15 @@ struct mxs_fec_data { | |||
51 | struct platform_device *__init mxs_add_fec( | 51 | struct platform_device *__init mxs_add_fec( |
52 | const struct mxs_fec_data *data, | 52 | const struct mxs_fec_data *data, |
53 | const struct fec_platform_data *pdata); | 53 | const struct fec_platform_data *pdata); |
54 | |||
55 | /* flexcan */ | ||
56 | #include <linux/can/platform/flexcan.h> | ||
57 | struct mxs_flexcan_data { | ||
58 | int id; | ||
59 | resource_size_t iobase; | ||
60 | resource_size_t iosize; | ||
61 | resource_size_t irq; | ||
62 | }; | ||
63 | struct platform_device *__init mxs_add_flexcan( | ||
64 | const struct mxs_flexcan_data *data, | ||
65 | const struct flexcan_platform_data *pdata); | ||