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> |
41561f28 | 19 | |
1451ba3a RS |
20 | static struct resource i2c0_resources[] = { |
21 | { | |
22 | .start = PNX4008_I2C1_BASE, | |
23 | .end = PNX4008_I2C1_BASE + SZ_4K - 1, | |
24 | .flags = IORESOURCE_MEM, | |
25 | }, { | |
26 | .start = I2C_1_INT, | |
27 | .end = I2C_1_INT, | |
28 | .flags = IORESOURCE_IRQ, | |
29 | }, | |
41561f28 VW |
30 | }; |
31 | ||
1451ba3a RS |
32 | static struct resource i2c1_resources[] = { |
33 | { | |
34 | .start = PNX4008_I2C2_BASE, | |
35 | .end = PNX4008_I2C2_BASE + SZ_4K - 1, | |
36 | .flags = IORESOURCE_MEM, | |
37 | }, { | |
38 | .start = I2C_2_INT, | |
39 | .end = I2C_2_INT, | |
40 | .flags = IORESOURCE_IRQ, | |
41 | }, | |
41561f28 VW |
42 | }; |
43 | ||
1451ba3a RS |
44 | static struct resource i2c2_resources[] = { |
45 | { | |
46 | .start = PNX4008_USB_CONFIG_BASE + 0x300, | |
47 | .end = PNX4008_USB_CONFIG_BASE + 0x300 + SZ_4K - 1, | |
48 | .flags = IORESOURCE_MEM, | |
49 | }, { | |
50 | .start = USB_I2C_INT, | |
51 | .end = USB_I2C_INT, | |
52 | .flags = IORESOURCE_IRQ, | |
53 | }, | |
41561f28 VW |
54 | }; |
55 | ||
56 | static struct platform_device i2c0_device = { | |
1451ba3a | 57 | .name = "pnx-i2c.0", |
41561f28 | 58 | .id = 0, |
1451ba3a RS |
59 | .resource = i2c0_resources, |
60 | .num_resources = ARRAY_SIZE(i2c0_resources), | |
41561f28 VW |
61 | }; |
62 | ||
63 | static struct platform_device i2c1_device = { | |
1451ba3a | 64 | .name = "pnx-i2c.1", |
41561f28 | 65 | .id = 1, |
1451ba3a RS |
66 | .resource = i2c1_resources, |
67 | .num_resources = ARRAY_SIZE(i2c1_resources), | |
41561f28 VW |
68 | }; |
69 | ||
70 | static struct platform_device i2c2_device = { | |
1451ba3a | 71 | .name = "pnx-i2c.2", |
41561f28 | 72 | .id = 2, |
1451ba3a RS |
73 | .resource = i2c2_resources, |
74 | .num_resources = ARRAY_SIZE(i2c2_resources), | |
41561f28 VW |
75 | }; |
76 | ||
77 | static struct platform_device *devices[] __initdata = { | |
78 | &i2c0_device, | |
79 | &i2c1_device, | |
80 | &i2c2_device, | |
81 | }; | |
82 | ||
83 | void __init pnx4008_register_i2c_devices(void) | |
84 | { | |
85 | platform_add_devices(devices, ARRAY_SIZE(devices)); | |
86 | } |