Commit 61c68502 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde Committed by Sascha Hauer
Browse files

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: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent a7d945a4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -9,6 +9,11 @@
#include <mach/mx25.h>
#include <mach/devices-common.h>

#define imx25_add_flexcan0(pdata)	\
	imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata)
#define imx25_add_flexcan1(pdata)	\
	imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata)

#define imx25_add_imx_i2c0(pdata)	\
	imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata)
#define imx25_add_imx_i2c1(pdata)	\
+5 −0
Original line number Diff line number Diff line
@@ -9,6 +9,11 @@
#include <mach/mx35.h>
#include <mach/devices-common.h>

#define imx35_add_flexcan0(pdata)	\
	imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata)
#define imx35_add_flexcan1(pdata)	\
	imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata)

#define imx35_add_imx_i2c0(pdata)	\
	imx_add_imx_i2c(0, MX35_I2C1_BASE_ADDR, SZ_4K, MX35_INT_I2C1, pdata)
#define imx35_add_imx_i2c1(pdata)	\
+4 −0
Original line number Diff line number Diff line
config IMX_HAVE_PLATFORM_FLEXCAN
	select HAVE_CAN_FLEXCAN
	bool

config IMX_HAVE_PLATFORM_IMX_I2C
	bool

+4 −0
Original line number Diff line number Diff line
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
+30 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
 *
 * 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 <mach/devices-common.h>

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));
}
Loading