From 61c68502321d94a421f9a2a32f6789ecb27f382d Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Thu, 22 Jul 2010 11:45:34 +0200 Subject: 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 Signed-off-by: Sascha Hauer --- arch/arm/plat-mxc/devices/Kconfig | 4 ++++ arch/arm/plat-mxc/devices/Makefile | 4 ++++ arch/arm/plat-mxc/devices/platform-flexcan.c | 30 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 arch/arm/plat-mxc/devices/platform-flexcan.c (limited to 'arch/arm/plat-mxc/devices') diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 09230f8..9ab784b 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig @@ -1,3 +1,7 @@ +config IMX_HAVE_PLATFORM_FLEXCAN + select HAVE_CAN_FLEXCAN + bool + config IMX_HAVE_PLATFORM_IMX_I2C bool diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 5ecbb24..347da51 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile @@ -1,3 +1,7 @@ +ifdef CONFIG_CAN_FLEXCAN +# the ifdef can be removed once the flexcan driver has been merged +obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o +endif obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o obj-$(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 0000000..5e97a01 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-flexcan.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2010 Pengutronix, Marc Kleine-Budde + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License version 2 as published by the + * Free Software Foundation. + */ + +#include + +struct platform_device *__init imx_add_flexcan(int id, + resource_size_t iobase, resource_size_t iosize, + resource_size_t irq, + const struct flexcan_platform_data *pdata) +{ + struct resource res[] = { + { + .start = iobase, + .end = iobase + iosize - 1, + .flags = IORESOURCE_MEM, + }, { + .start = irq, + .end = irq, + .flags = IORESOURCE_IRQ, + }, + }; + + return imx_add_platform_device("flexcan", id, res, ARRAY_SIZE(res), + pdata, sizeof(*pdata)); +} -- cgit v1.1