From 9d84b7ca76f00fc71a2fb4e32f4a172b0dd95b0d Mon Sep 17 00:00:00 2001
From: Steve Kipisz <s-kipisz2@ti.com>
Date: Wed, 16 Nov 2011 07:23:37 -0600
Subject: [PATCH 2/3] omap:hwmod:33xx: Add support for third i2c bus

Signed-off-by: Steve Kipisz <s-kipisz2@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
 arch/arm/mach-omap2/omap_hwmod_33xx_data.c |   50 ++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index cad59f0e..663bd26 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -59,6 +59,7 @@ static struct omap_hwmod am33xx_gpio2_hwmod;
 static struct omap_hwmod am33xx_gpio3_hwmod;
 static struct omap_hwmod am33xx_i2c1_hwmod;
 static struct omap_hwmod am33xx_i2c2_hwmod;
+static struct omap_hwmod am33xx_i2c3_hwmod;
 static struct omap_hwmod am33xx_usbss_hwmod;
 static struct omap_hwmod am33xx_mmc0_hwmod;
 static struct omap_hwmod am33xx_mmc1_hwmod;
@@ -800,6 +801,54 @@ static struct omap_hwmod am33xx_i2c2_hwmod = {
 	.class          = &i2c_class,
 };
 
+/* i2c3 */
+/* l4 per -> i2c3 */
+static struct omap_hwmod_addr_space am33xx_i2c3_addr_space[] = {
+	{
+		.pa_start       = 0x4819C000,
+		.pa_end         = 0x4819C000 + SZ_4K - 1,
+		.flags          = ADDR_MAP_ON_INIT | ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if am335_l4_per_i2c3 = {
+	.master         = &am33xx_l4per_hwmod,
+	.slave          = &am33xx_i2c3_hwmod,
+	.addr           = am33xx_i2c3_addr_space,
+	.user           = OCP_USER_MPU,
+};
+
+static struct omap_hwmod_irq_info i2c3_mpu_irqs[] = {
+	{ .irq = 30 },
+	{ .irq = -1 }
+};
+
+static struct omap_hwmod_dma_info i2c3_edma_reqs[] = {
+	{ .name = "tx", .dma_req = 0, },
+	{ .name = "rx", .dma_req = 0, },
+};
+
+static struct omap_hwmod_ocp_if *am33xx_i2c3_slaves[] = {
+	&am335_l4_per_i2c3,
+};
+
+static struct omap_hwmod am33xx_i2c3_hwmod = {
+	.name           = "i2c3",
+	.mpu_irqs       = i2c3_mpu_irqs,
+	.sdma_reqs      = i2c3_edma_reqs,
+	.main_clk       = "i2c3_fck",
+	.clkdm_name	= "l4ls_clkdm",
+	.prcm           = {
+		.omap4 = {
+			.clkctrl_offs	= AM33XX_CM_PER_I2C2_CLKCTRL_OFFSET,
+			.modulemode	= MODULEMODE_SWCTRL,
+		},
+	},
+	.slaves         = am33xx_i2c3_slaves,
+	.slaves_cnt     = ARRAY_SIZE(am33xx_i2c3_slaves),
+	.class          = &i2c_class,
+};
+
 /* 'icss' class */
 static struct omap_hwmod_class am33xx_icss_hwmod_class = {
 	.name = "icss",
@@ -2430,6 +2479,7 @@ static __initdata struct omap_hwmod *am33xx_hwmods[] = {
 	/* i2c class */
 	&am33xx_i2c1_hwmod,
 	&am33xx_i2c2_hwmod,
+	&am33xx_i2c3_hwmod,
 	/* icss class */
 	&am33xx_icss_hwmod,
 	/* ieee5000 class */
-- 
1.7.2.5

