aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2010-07-22 05:45:34 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-07-26 09:05:29 -0400
commit61c68502321d94a421f9a2a32f6789ecb27f382d (patch)
treef11a63bf01c5438d5c44deb14e45f38d85aec243 /arch/arm
parenta7d945a469ee566bde26217362c95f29acfbd14a (diff)
imx: dynamically register flexcan devices for mx25 and mx35
In order to make this patch compile, even if the flexcan driver with it's header defining the platform data isn't merged yet, two ifdefs have been added. They effect that the "imx_add_flexcan" function results in a no-op function if the driver hasn't been activated. These ifdefs can be removed after the flexcan driver has been merged. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-mx25/devices-imx25.h5
-rw-r--r--arch/arm/mach-mx3/devices-imx35.h5
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig4
-rw-r--r--arch/arm/plat-mxc/devices/Makefile4
-rw-r--r--arch/arm/plat-mxc/devices/platform-flexcan.c30
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h18
6 files changed, 66 insertions, 0 deletions
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h
index 2025cb947fcf..d86a7c3ca8b0 100644
--- a/arch/arm/mach-mx25/devices-imx25.h
+++ b/arch/arm/mach-mx25/devices-imx25.h
@@ -9,6 +9,11 @@
9#include <mach/mx25.h> 9#include <mach/mx25.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx25_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata)
14#define imx25_add_flexcan1(pdata) \
15 imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata)
16
12#define imx25_add_imx_i2c0(pdata) \ 17#define imx25_add_imx_i2c0(pdata) \
13 imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata) 18 imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata)
14#define imx25_add_imx_i2c1(pdata) \ 19#define imx25_add_imx_i2c1(pdata) \
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h
index 536d9b9a250b..f6a431a4c3d2 100644
--- a/arch/arm/mach-mx3/devices-imx35.h
+++ b/arch/arm/mach-mx3/devices-imx35.h
@@ -9,6 +9,11 @@
9#include <mach/mx35.h> 9#include <mach/mx35.h>
10#include <mach/devices-common.h> 10#include <mach/devices-common.h>
11 11
12#define imx35_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata)
14#define imx35_add_flexcan1(pdata) \
15 imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata)
16
12#define imx35_add_imx_i2c0(pdata) \ 17#define imx35_add_imx_i2c0(pdata) \
13 imx_add_imx_i2c(0, MX35_I2C1_BASE_ADDR, SZ_4K, MX35_INT_I2C1, pdata) 18 imx_add_imx_i2c(0, MX35_I2C1_BASE_ADDR, SZ_4K, MX35_INT_I2C1, pdata)
14#define imx35_add_imx_i2c1(pdata) \ 19#define imx35_add_imx_i2c1(pdata) \
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 09230f8c802a..9ab784b776f9 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -1,3 +1,7 @@
1config IMX_HAVE_PLATFORM_FLEXCAN
2 select HAVE_CAN_FLEXCAN
3 bool
4
1config IMX_HAVE_PLATFORM_IMX_I2C 5config IMX_HAVE_PLATFORM_IMX_I2C
2 bool 6 bool
3 7
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 5ecbb244d210..347da5161f7e 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -1,3 +1,7 @@
1ifdef CONFIG_CAN_FLEXCAN
2# the ifdef can be removed once the flexcan driver has been merged
3obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
4endif
1obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o 5obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
2obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o 6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
3obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o 7obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
diff --git a/arch/arm/plat-mxc/devices/platform-flexcan.c b/arch/arm/plat-mxc/devices/platform-flexcan.c
new file mode 100644
index 000000000000..5e97a01f14f3
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-flexcan.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2010 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8
9#include <mach/devices-common.h>
10
11struct platform_device *__init imx_add_flexcan(int id,
12 resource_size_t iobase, resource_size_t iosize,
13 resource_size_t irq,
14 const struct flexcan_platform_data *pdata)
15{
16 struct resource res[] = {
17 {
18 .start = iobase,
19 .end = iobase + iosize - 1,
20 .flags = IORESOURCE_MEM,
21 }, {
22 .start = irq,
23 .end = irq,
24 .flags = IORESOURCE_IRQ,
25 },
26 };
27
28 return imx_add_platform_device("flexcan", id, res, ARRAY_SIZE(res),
29 pdata, sizeof(*pdata));
30}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 05c8d3f0a08f..c5f68c587309 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -14,6 +14,24 @@ struct platform_device *imx_add_platform_device(const char *name, int id,
14 const struct resource *res, unsigned int num_resources, 14 const struct resource *res, unsigned int num_resources,
15 const void *data, size_t size_data); 15 const void *data, size_t size_data);
16 16
17#if defined (CONFIG_CAN_FLEXCAN) || defined (CONFIG_CAN_FLEXCAN_MODULE)
18#include <linux/can/platform/flexcan.h>
19struct platform_device *__init imx_add_flexcan(int id,
20 resource_size_t iobase, resource_size_t iosize,
21 resource_size_t irq,
22 const struct flexcan_platform_data *pdata);
23#else
24/* the ifdef can be removed once the flexcan driver has been merged */
25struct flexcan_platform_data;
26static inline struct platform_device *__init imx_add_flexcan(int id,
27 resource_size_t iobase, resource_size_t iosize,
28 resource_size_t irq,
29 const struct flexcan_platform_data *pdata)
30{
31 return NULL;
32}
33#endif
34
17#include <mach/i2c.h> 35#include <mach/i2c.h>
18struct platform_device *__init imx_add_imx_i2c(int id, 36struct platform_device *__init imx_add_imx_i2c(int id,
19 resource_size_t iobase, resource_size_t iosize, int irq, 37 resource_size_t iobase, resource_size_t iosize, int irq,