Path: blob/master/arch/arm/mach-mxs/devices/platform-flexcan.c
10819 views
/*1* Copyright (C) 2010, 2011 Pengutronix,2* Marc Kleine-Budde <[email protected]>3*4* This program is free software; you can redistribute it and/or modify it under5* the terms of the GNU General Public License version 2 as published by the6* Free Software Foundation.7*/8#include <asm/sizes.h>9#include <mach/mx28.h>10#include <mach/devices-common.h>1112#define mxs_flexcan_data_entry_single(soc, _id, _hwid, _size) \13{ \14.id = _id, \15.iobase = soc ## _CAN ## _hwid ## _BASE_ADDR, \16.iosize = _size, \17.irq = soc ## _INT_CAN ## _hwid, \18}1920#define mxs_flexcan_data_entry(soc, _id, _hwid, _size) \21[_id] = mxs_flexcan_data_entry_single(soc, _id, _hwid, _size)2223#ifdef CONFIG_SOC_IMX2824const struct mxs_flexcan_data mx28_flexcan_data[] __initconst = {25#define mx28_flexcan_data_entry(_id, _hwid) \26mxs_flexcan_data_entry_single(MX28, _id, _hwid, SZ_8K)27mx28_flexcan_data_entry(0, 0),28mx28_flexcan_data_entry(1, 1),29};30#endif /* ifdef CONFIG_SOC_IMX28 */3132struct platform_device *__init mxs_add_flexcan(33const struct mxs_flexcan_data *data,34const struct flexcan_platform_data *pdata)35{36struct resource res[] = {37{38.start = data->iobase,39.end = data->iobase + data->iosize - 1,40.flags = IORESOURCE_MEM,41}, {42.start = data->irq,43.end = data->irq,44.flags = IORESOURCE_IRQ,45},46};4748return mxs_add_platform_device("flexcan", data->id,49res, ARRAY_SIZE(res), pdata, sizeof(*pdata));50}515253