Path: blob/master/arch/arm/mach-mxs/devices/platform-mxs-i2c.c
10819 views
/*1* Copyright (C) 2011 Pengutronix2* Wolfram Sang <[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_i2c_data_entry_single(soc, _id) \13{ \14.id = _id, \15.iobase = soc ## _I2C ## _id ## _BASE_ADDR, \16.errirq = soc ## _INT_I2C ## _id ## _ERROR, \17.dmairq = soc ## _INT_I2C ## _id ## _DMA, \18}1920#define mxs_i2c_data_entry(soc, _id) \21[_id] = mxs_i2c_data_entry_single(soc, _id)2223#ifdef CONFIG_SOC_IMX2824const struct mxs_mxs_i2c_data mx28_mxs_i2c_data[] __initconst = {25mxs_i2c_data_entry(MX28, 0),26mxs_i2c_data_entry(MX28, 1),27};28#endif2930struct platform_device *__init mxs_add_mxs_i2c(31const struct mxs_mxs_i2c_data *data)32{33struct resource res[] = {34{35.start = data->iobase,36.end = data->iobase + SZ_8K - 1,37.flags = IORESOURCE_MEM,38}, {39.start = data->errirq,40.end = data->errirq,41.flags = IORESOURCE_IRQ,42}, {43.start = data->dmairq,44.end = data->dmairq,45.flags = IORESOURCE_IRQ,46},47};4849return mxs_add_platform_device("mxs-i2c", data->id, res,50ARRAY_SIZE(res), NULL, 0);51}525354