2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
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.
9 #include "../hardware.h"
10 #include "devices-common.h"
12 #define imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size) \
16 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR, \
18 .irq = soc ## _INT_I2C ## _hwid, \
21 #define imx_imx_i2c_data_entry(soc, _devid, _id, _hwid, _size) \
22 [_id] = imx_imx_i2c_data_entry_single(soc, _devid, _id, _hwid, _size)
24 #ifdef CONFIG_SOC_IMX1
25 const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst
=
26 imx_imx_i2c_data_entry_single(MX1
, "imx1-i2c", 0, , SZ_4K
);
27 #endif /* ifdef CONFIG_SOC_IMX1 */
29 #ifdef CONFIG_SOC_IMX21
30 const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst
=
31 imx_imx_i2c_data_entry_single(MX21
, "imx21-i2c", 0, , SZ_4K
);
32 #endif /* ifdef CONFIG_SOC_IMX21 */
34 #ifdef CONFIG_SOC_IMX27
35 const struct imx_imx_i2c_data imx27_imx_i2c_data
[] __initconst
= {
36 #define imx27_imx_i2c_data_entry(_id, _hwid) \
37 imx_imx_i2c_data_entry(MX27, "imx21-i2c", _id, _hwid, SZ_4K)
38 imx27_imx_i2c_data_entry(0, 1),
39 imx27_imx_i2c_data_entry(1, 2),
41 #endif /* ifdef CONFIG_SOC_IMX27 */
43 #ifdef CONFIG_SOC_IMX31
44 const struct imx_imx_i2c_data imx31_imx_i2c_data
[] __initconst
= {
45 #define imx31_imx_i2c_data_entry(_id, _hwid) \
46 imx_imx_i2c_data_entry(MX31, "imx21-i2c", _id, _hwid, SZ_4K)
47 imx31_imx_i2c_data_entry(0, 1),
48 imx31_imx_i2c_data_entry(1, 2),
49 imx31_imx_i2c_data_entry(2, 3),
51 #endif /* ifdef CONFIG_SOC_IMX31 */
53 #ifdef CONFIG_SOC_IMX35
54 const struct imx_imx_i2c_data imx35_imx_i2c_data
[] __initconst
= {
55 #define imx35_imx_i2c_data_entry(_id, _hwid) \
56 imx_imx_i2c_data_entry(MX35, "imx21-i2c", _id, _hwid, SZ_4K)
57 imx35_imx_i2c_data_entry(0, 1),
58 imx35_imx_i2c_data_entry(1, 2),
59 imx35_imx_i2c_data_entry(2, 3),
61 #endif /* ifdef CONFIG_SOC_IMX35 */
63 struct platform_device
*__init
imx_add_imx_i2c(
64 const struct imx_imx_i2c_data
*data
,
65 const struct imxi2c_platform_data
*pdata
)
67 struct resource res
[] = {
69 .start
= data
->iobase
,
70 .end
= data
->iobase
+ data
->iosize
- 1,
71 .flags
= IORESOURCE_MEM
,
75 .flags
= IORESOURCE_IRQ
,
79 return imx_add_platform_device(data
->devid
, data
->id
,
81 pdata
, sizeof(*pdata
));