aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs/devices/platform-mxs-i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mxs/devices/platform-mxs-i2c.c')
-rw-r--r--arch/arm/mach-mxs/devices/platform-mxs-i2c.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-i2c.c b/arch/arm/mach-mxs/devices/platform-mxs-i2c.c
new file mode 100644
index 000000000000..eab3a06836d6
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/platform-mxs-i2c.c
@@ -0,0 +1,51 @@
1/*
2 * Copyright (C) 2011 Pengutronix
3 * Wolfram Sang <w.sang@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <asm/sizes.h>
10#include <mach/mx28.h>
11#include <mach/devices-common.h>
12
13#define mxs_i2c_data_entry_single(soc, _id) \
14 { \
15 .id = _id, \
16 .iobase = soc ## _I2C ## _id ## _BASE_ADDR, \
17 .errirq = soc ## _INT_I2C ## _id ## _ERROR, \
18 .dmairq = soc ## _INT_I2C ## _id ## _DMA, \
19 }
20
21#define mxs_i2c_data_entry(soc, _id) \
22 [_id] = mxs_i2c_data_entry_single(soc, _id)
23
24#ifdef CONFIG_SOC_IMX28
25const struct mxs_i2c_data mx28_mxs_i2c_data[] __initconst = {
26 mxs_i2c_data_entry(MX28, 0),
27 mxs_i2c_data_entry(MX28, 1),
28};
29#endif
30
31struct platform_device *__init mxs_add_mxs_i2c(const struct mxs_i2c_data *data)
32{
33 struct 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 };
48
49 return mxs_add_platform_device("mxs-i2c", data->id, res,
50 ARRAY_SIZE(res), NULL, 0);
51}