diff options
| -rw-r--r-- | arch/arm/plat-omap/i2c.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index 78d1cea9118d..eec2b4993c69 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | #define OMAP2_I2C_BASE1 0x48070000 | 38 | #define OMAP2_I2C_BASE1 0x48070000 |
| 39 | #define OMAP2_I2C_BASE2 0x48072000 | 39 | #define OMAP2_I2C_BASE2 0x48072000 |
| 40 | #define OMAP2_I2C_BASE3 0x48060000 | 40 | #define OMAP2_I2C_BASE3 0x48060000 |
| 41 | #define OMAP4_I2C_BASE4 0x48350000 | ||
| 41 | 42 | ||
| 42 | static const char name[] = "i2c_omap"; | 43 | static const char name[] = "i2c_omap"; |
| 43 | 44 | ||
| @@ -54,11 +55,14 @@ static const char name[] = "i2c_omap"; | |||
| 54 | 55 | ||
| 55 | static struct resource i2c_resources[][2] = { | 56 | static struct resource i2c_resources[][2] = { |
| 56 | { I2C_RESOURCE_BUILDER(0, 0) }, | 57 | { I2C_RESOURCE_BUILDER(0, 0) }, |
| 57 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 58 | #if defined(CONFIG_ARCH_OMAP2PLUS) |
| 58 | { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, INT_24XX_I2C2_IRQ) }, | 59 | { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, 0) }, |
| 59 | #endif | 60 | #endif |
| 60 | #if defined(CONFIG_ARCH_OMAP3) | 61 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) |
| 61 | { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, INT_34XX_I2C3_IRQ) }, | 62 | { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, 0) }, |
| 63 | #endif | ||
| 64 | #if defined(CONFIG_ARCH_OMAP4) | ||
| 65 | { I2C_RESOURCE_BUILDER(OMAP4_I2C_BASE4, 0) }, | ||
| 62 | #endif | 66 | #endif |
| 63 | }; | 67 | }; |
| 64 | 68 | ||
| @@ -76,12 +80,15 @@ static struct resource i2c_resources[][2] = { | |||
| 76 | static struct omap_i2c_bus_platform_data i2c_pdata[ARRAY_SIZE(i2c_resources)]; | 80 | static struct omap_i2c_bus_platform_data i2c_pdata[ARRAY_SIZE(i2c_resources)]; |
| 77 | static struct platform_device omap_i2c_devices[] = { | 81 | static struct platform_device omap_i2c_devices[] = { |
| 78 | I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]), | 82 | I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]), |
| 79 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) | 83 | #if defined(CONFIG_ARCH_OMAP2PLUS) |
| 80 | I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_pdata[1]), | 84 | I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_pdata[1]), |
| 81 | #endif | 85 | #endif |
| 82 | #if defined(CONFIG_ARCH_OMAP3) | 86 | #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) |
| 83 | I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_pdata[2]), | 87 | I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_pdata[2]), |
| 84 | #endif | 88 | #endif |
| 89 | #if defined(CONFIG_ARCH_OMAP4) | ||
| 90 | I2C_DEV_BUILDER(4, i2c_resources[3], &i2c_pdata[3]), | ||
| 91 | #endif | ||
| 85 | }; | 92 | }; |
| 86 | 93 | ||
| 87 | #define OMAP_I2C_CMDLINE_SETUP (BIT(31)) | 94 | #define OMAP_I2C_CMDLINE_SETUP (BIT(31)) |
| @@ -96,6 +103,8 @@ static int __init omap_i2c_nr_ports(void) | |||
| 96 | ports = 2; | 103 | ports = 2; |
| 97 | else if (cpu_is_omap34xx()) | 104 | else if (cpu_is_omap34xx()) |
| 98 | ports = 3; | 105 | ports = 3; |
| 106 | else if (cpu_is_omap44xx()) | ||
| 107 | ports = 4; | ||
| 99 | 108 | ||
| 100 | return ports; | 109 | return ports; |
| 101 | } | 110 | } |
| @@ -107,6 +116,13 @@ static resource_size_t omap2_i2c_irq[3] __initdata = { | |||
| 107 | INT_34XX_I2C3_IRQ, | 116 | INT_34XX_I2C3_IRQ, |
| 108 | }; | 117 | }; |
| 109 | 118 | ||
| 119 | static resource_size_t omap4_i2c_irq[4] __initdata = { | ||
| 120 | OMAP44XX_IRQ_I2C1, | ||
| 121 | OMAP44XX_IRQ_I2C2, | ||
| 122 | OMAP44XX_IRQ_I2C3, | ||
| 123 | OMAP44XX_IRQ_I2C4, | ||
| 124 | }; | ||
| 125 | |||
| 110 | static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id) | 126 | static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id) |
| 111 | { | 127 | { |
| 112 | struct omap_i2c_bus_platform_data *pd; | 128 | struct omap_i2c_bus_platform_data *pd; |
| @@ -129,7 +145,10 @@ static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id) | |||
| 129 | 145 | ||
| 130 | res = pdev->resource; | 146 | res = pdev->resource; |
| 131 | 147 | ||
| 132 | irq = omap2_i2c_irq; | 148 | if (!cpu_is_omap44xx()) |
| 149 | irq = omap2_i2c_irq; | ||
| 150 | else | ||
| 151 | irq = omap4_i2c_irq; | ||
| 133 | 152 | ||
| 134 | if (bus_id == 1) { | 153 | if (bus_id == 1) { |
| 135 | res[0].start = OMAP2_I2C_BASE1; | 154 | res[0].start = OMAP2_I2C_BASE1; |
