Commit 6daa642d authored by Tony Lindgren's avatar Tony Lindgren

omap4: Add support for i2c init

Add support for i2c init for omap4.

This patch is based on and earlier patch by
Santosh Shilimkar <santosh.shilimkar@ti.com>.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent b32dd41e
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#define OMAP2_I2C_BASE1 0x48070000 #define OMAP2_I2C_BASE1 0x48070000
#define OMAP2_I2C_BASE2 0x48072000 #define OMAP2_I2C_BASE2 0x48072000
#define OMAP2_I2C_BASE3 0x48060000 #define OMAP2_I2C_BASE3 0x48060000
#define OMAP4_I2C_BASE4 0x48350000
static const char name[] = "i2c_omap"; static const char name[] = "i2c_omap";
...@@ -54,11 +55,14 @@ static const char name[] = "i2c_omap"; ...@@ -54,11 +55,14 @@ static const char name[] = "i2c_omap";
static struct resource i2c_resources[][2] = { static struct resource i2c_resources[][2] = {
{ I2C_RESOURCE_BUILDER(0, 0) }, { I2C_RESOURCE_BUILDER(0, 0) },
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) #if defined(CONFIG_ARCH_OMAP2PLUS)
{ I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, INT_24XX_I2C2_IRQ) }, { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE2, 0) },
#endif #endif
#if defined(CONFIG_ARCH_OMAP3) #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
{ I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, INT_34XX_I2C3_IRQ) }, { I2C_RESOURCE_BUILDER(OMAP2_I2C_BASE3, 0) },
#endif
#if defined(CONFIG_ARCH_OMAP4)
{ I2C_RESOURCE_BUILDER(OMAP4_I2C_BASE4, 0) },
#endif #endif
}; };
...@@ -76,12 +80,15 @@ static struct resource i2c_resources[][2] = { ...@@ -76,12 +80,15 @@ static struct resource i2c_resources[][2] = {
static struct omap_i2c_bus_platform_data i2c_pdata[ARRAY_SIZE(i2c_resources)]; static struct omap_i2c_bus_platform_data i2c_pdata[ARRAY_SIZE(i2c_resources)];
static struct platform_device omap_i2c_devices[] = { static struct platform_device omap_i2c_devices[] = {
I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]), I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]),
#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) #if defined(CONFIG_ARCH_OMAP2PLUS)
I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_pdata[1]), I2C_DEV_BUILDER(2, i2c_resources[1], &i2c_pdata[1]),
#endif #endif
#if defined(CONFIG_ARCH_OMAP3) #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_pdata[2]), I2C_DEV_BUILDER(3, i2c_resources[2], &i2c_pdata[2]),
#endif #endif
#if defined(CONFIG_ARCH_OMAP4)
I2C_DEV_BUILDER(4, i2c_resources[3], &i2c_pdata[3]),
#endif
}; };
#define OMAP_I2C_CMDLINE_SETUP (BIT(31)) #define OMAP_I2C_CMDLINE_SETUP (BIT(31))
...@@ -96,6 +103,8 @@ static int __init omap_i2c_nr_ports(void) ...@@ -96,6 +103,8 @@ static int __init omap_i2c_nr_ports(void)
ports = 2; ports = 2;
else if (cpu_is_omap34xx()) else if (cpu_is_omap34xx())
ports = 3; ports = 3;
else if (cpu_is_omap44xx())
ports = 4;
return ports; return ports;
} }
...@@ -107,6 +116,13 @@ static resource_size_t omap2_i2c_irq[3] __initdata = { ...@@ -107,6 +116,13 @@ static resource_size_t omap2_i2c_irq[3] __initdata = {
INT_34XX_I2C3_IRQ, INT_34XX_I2C3_IRQ,
}; };
static resource_size_t omap4_i2c_irq[4] __initdata = {
OMAP44XX_IRQ_I2C1,
OMAP44XX_IRQ_I2C2,
OMAP44XX_IRQ_I2C3,
OMAP44XX_IRQ_I2C4,
};
static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id) static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id)
{ {
struct omap_i2c_bus_platform_data *pd; 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,7 +145,10 @@ static inline int omap2_i2c_add_bus(struct platform_device *pdev, int bus_id)
res = pdev->resource; res = pdev->resource;
irq = omap2_i2c_irq; if (!cpu_is_omap44xx())
irq = omap2_i2c_irq;
else
irq = omap4_i2c_irq;
if (bus_id == 1) { if (bus_id == 1) {
res[0].start = OMAP2_I2C_BASE1; res[0].start = OMAP2_I2C_BASE1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment