Commit | Line | Data |
---|---|---|
41561f28 VW |
1 | /* |
2 | * I2C initialization for PNX4008. | |
3 | * | |
4 | * Author: Vitaly Wool <vitalywool@gmail.com> | |
5 | * | |
6 | * 2005-2006 (c) MontaVista Software, Inc. This file is licensed under | |
7 | * the terms of the GNU General Public License version 2. This program | |
8 | * is licensed "as is" without any warranty of any kind, whether express | |
9 | * or implied. | |
10 | */ | |
11 | ||
12 | #include <linux/clk.h> | |
13 | #include <linux/i2c.h> | |
14 | #include <linux/i2c-pnx.h> | |
15 | #include <linux/platform_device.h> | |
16 | #include <linux/err.h> | |
a09e64fb | 17 | #include <mach/platform.h> |
18b2085e | 18 | #include <mach/irqs.h> |
a09e64fb | 19 | #include <mach/i2c.h> |
41561f28 | 20 | |
41561f28 | 21 | static struct i2c_pnx_data i2c0_data = { |
9d7f7363 | 22 | .name = I2C_CHIP_NAME "0", |
44c5d739 RK |
23 | .base = PNX4008_I2C1_BASE, |
24 | .irq = I2C_1_INT, | |
41561f28 VW |
25 | }; |
26 | ||
27 | static struct i2c_pnx_data i2c1_data = { | |
9d7f7363 | 28 | .name = I2C_CHIP_NAME "1", |
44c5d739 RK |
29 | .base = PNX4008_I2C2_BASE, |
30 | .irq = I2C_2_INT, | |
41561f28 VW |
31 | }; |
32 | ||
33 | static struct i2c_pnx_data i2c2_data = { | |
9d7f7363 | 34 | .name = "USB-I2C", |
44c5d739 RK |
35 | .base = (PNX4008_USB_CONFIG_BASE + 0x300), |
36 | .irq = USB_I2C_INT, | |
41561f28 VW |
37 | }; |
38 | ||
39 | static struct platform_device i2c0_device = { | |
40 | .name = "pnx-i2c", | |
41 | .id = 0, | |
42 | .dev = { | |
43 | .platform_data = &i2c0_data, | |
44 | }, | |
45 | }; | |
46 | ||
47 | static struct platform_device i2c1_device = { | |
48 | .name = "pnx-i2c", | |
49 | .id = 1, | |
50 | .dev = { | |
51 | .platform_data = &i2c1_data, | |
52 | }, | |
53 | }; | |
54 | ||
55 | static struct platform_device i2c2_device = { | |
56 | .name = "pnx-i2c", | |
57 | .id = 2, | |
58 | .dev = { | |
59 | .platform_data = &i2c2_data, | |
60 | }, | |
61 | }; | |
62 | ||
63 | static struct platform_device *devices[] __initdata = { | |
64 | &i2c0_device, | |
65 | &i2c1_device, | |
66 | &i2c2_device, | |
67 | }; | |
68 | ||
69 | void __init pnx4008_register_i2c_devices(void) | |
70 | { | |
71 | platform_add_devices(devices, ARRAY_SIZE(devices)); | |
72 | } |