Vitaly Wool | 41561f2 | 2006-12-10 21:21:29 +0100 | [diff] [blame] | 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> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 17 | #include <mach/platform.h> |
Russell King | 18b2085 | 2009-01-08 11:00:03 +0000 | [diff] [blame] | 18 | #include <mach/irqs.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 19 | #include <mach/i2c.h> |
Vitaly Wool | 41561f2 | 2006-12-10 21:21:29 +0100 | [diff] [blame] | 20 | |
Vitaly Wool | 41561f2 | 2006-12-10 21:21:29 +0100 | [diff] [blame] | 21 | static struct i2c_pnx_data i2c0_data = { |
Russell King | 9d7f736 | 2009-11-21 12:25:27 +0000 | [diff] [blame] | 22 | .name = I2C_CHIP_NAME "0", |
Russell King | 44c5d73 | 2009-11-21 12:10:54 +0000 | [diff] [blame] | 23 | .base = PNX4008_I2C1_BASE, |
| 24 | .irq = I2C_1_INT, |
Vitaly Wool | 41561f2 | 2006-12-10 21:21:29 +0100 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | static struct i2c_pnx_data i2c1_data = { |
Russell King | 9d7f736 | 2009-11-21 12:25:27 +0000 | [diff] [blame] | 28 | .name = I2C_CHIP_NAME "1", |
Russell King | 44c5d73 | 2009-11-21 12:10:54 +0000 | [diff] [blame] | 29 | .base = PNX4008_I2C2_BASE, |
| 30 | .irq = I2C_2_INT, |
Vitaly Wool | 41561f2 | 2006-12-10 21:21:29 +0100 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | static struct i2c_pnx_data i2c2_data = { |
Russell King | 9d7f736 | 2009-11-21 12:25:27 +0000 | [diff] [blame] | 34 | .name = "USB-I2C", |
Russell King | 44c5d73 | 2009-11-21 12:10:54 +0000 | [diff] [blame] | 35 | .base = (PNX4008_USB_CONFIG_BASE + 0x300), |
| 36 | .irq = USB_I2C_INT, |
Vitaly Wool | 41561f2 | 2006-12-10 21:21:29 +0100 | [diff] [blame] | 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 | } |