blob: 8103f9644e2d0af099ccadb0b80b29440574119c [file] [log] [blame]
Vitaly Wool41561f22006-12-10 21:21:29 +01001/*
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 Kinga09e64f2008-08-05 16:14:15 +010017#include <mach/platform.h>
Russell King18b20852009-01-08 11:00:03 +000018#include <mach/irqs.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010019#include <mach/i2c.h>
Vitaly Wool41561f22006-12-10 21:21:29 +010020
Vitaly Wool41561f22006-12-10 21:21:29 +010021static struct i2c_pnx_data i2c0_data = {
Russell King9d7f7362009-11-21 12:25:27 +000022 .name = I2C_CHIP_NAME "0",
Russell King44c5d732009-11-21 12:10:54 +000023 .base = PNX4008_I2C1_BASE,
24 .irq = I2C_1_INT,
Vitaly Wool41561f22006-12-10 21:21:29 +010025};
26
27static struct i2c_pnx_data i2c1_data = {
Russell King9d7f7362009-11-21 12:25:27 +000028 .name = I2C_CHIP_NAME "1",
Russell King44c5d732009-11-21 12:10:54 +000029 .base = PNX4008_I2C2_BASE,
30 .irq = I2C_2_INT,
Vitaly Wool41561f22006-12-10 21:21:29 +010031};
32
33static struct i2c_pnx_data i2c2_data = {
Russell King9d7f7362009-11-21 12:25:27 +000034 .name = "USB-I2C",
Russell King44c5d732009-11-21 12:10:54 +000035 .base = (PNX4008_USB_CONFIG_BASE + 0x300),
36 .irq = USB_I2C_INT,
Vitaly Wool41561f22006-12-10 21:21:29 +010037};
38
39static struct platform_device i2c0_device = {
40 .name = "pnx-i2c",
41 .id = 0,
42 .dev = {
43 .platform_data = &i2c0_data,
44 },
45};
46
47static struct platform_device i2c1_device = {
48 .name = "pnx-i2c",
49 .id = 1,
50 .dev = {
51 .platform_data = &i2c1_data,
52 },
53};
54
55static struct platform_device i2c2_device = {
56 .name = "pnx-i2c",
57 .id = 2,
58 .dev = {
59 .platform_data = &i2c2_data,
60 },
61};
62
63static struct platform_device *devices[] __initdata = {
64 &i2c0_device,
65 &i2c1_device,
66 &i2c2_device,
67};
68
69void __init pnx4008_register_i2c_devices(void)
70{
71 platform_add_devices(devices, ARRAY_SIZE(devices));
72}