* [U-Boot] [PATCH] omap4 i2c: add support for i2c bus 4
@ 2012-08-08 10:57 Koen Kooi
2012-08-27 6:08 ` R, Sricharan
0 siblings, 1 reply; 2+ messages in thread
From: Koen Kooi @ 2012-08-08 10:57 UTC (permalink / raw
To: u-boot
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
arch/arm/include/asm/arch-omap4/cpu.h | 1 +
arch/arm/include/asm/arch-omap4/i2c.h | 2 +-
drivers/i2c/omap24xx_i2c.c | 8 ++++++++
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/arch/arm/include/asm/arch-omap4/cpu.h b/arch/arm/include/asm/arch-omap4/cpu.h
index a8c4c60..3a0bfbf 100644
--- a/arch/arm/include/asm/arch-omap4/cpu.h
+++ b/arch/arm/include/asm/arch-omap4/cpu.h
@@ -138,6 +138,7 @@ struct watchdog {
#define I2C_BASE1 (OMAP44XX_L4_PER_BASE + 0x70000)
#define I2C_BASE2 (OMAP44XX_L4_PER_BASE + 0x72000)
#define I2C_BASE3 (OMAP44XX_L4_PER_BASE + 0x60000)
+#define I2C_BASE4 (OMAP44XX_L4_PER_BASE + 0x350000)
/* MUSB base */
#define MUSB_BASE (OMAP44XX_L4_CORE_BASE + 0xAB000)
diff --git a/arch/arm/include/asm/arch-omap4/i2c.h b/arch/arm/include/asm/arch-omap4/i2c.h
index a91b4c2..02ee2f8 100644
--- a/arch/arm/include/asm/arch-omap4/i2c.h
+++ b/arch/arm/include/asm/arch-omap4/i2c.h
@@ -23,7 +23,7 @@
#ifndef _OMAP4_I2C_H_
#define _OMAP4_I2C_H_
-#define I2C_BUS_MAX 3
+#define I2C_BUS_MAX 4
#define I2C_DEFAULT_BASE I2C_BASE1
struct i2c {
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index 81193b0..df8ab92 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -448,6 +448,14 @@ int i2c_set_bus_num(unsigned int bus)
return -1;
}
+#if I2C_BUS_MAX == 4
+ if (bus == 3)
+ i2c_base = (struct i2c *)I2C_BASE4;
+ else
+ if (bus == 2)
+ i2c_base = (struct i2c *)I2C_BASE3;
+ else
+#endif
#if I2C_BUS_MAX == 3
if (bus == 2)
i2c_base = (struct i2c *)I2C_BASE3;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] omap4 i2c: add support for i2c bus 4
2012-08-08 10:57 [U-Boot] [PATCH] omap4 i2c: add support for i2c bus 4 Koen Kooi
@ 2012-08-27 6:08 ` R, Sricharan
0 siblings, 0 replies; 2+ messages in thread
From: R, Sricharan @ 2012-08-27 6:08 UTC (permalink / raw
To: u-boot
Hi,
-- a/arch/arm/include/asm/arch-omap4/cpu.h
> +++ b/arch/arm/include/asm/arch-omap4/cpu.h
> @@ -138,6 +138,7 @@ struct watchdog {
> #define I2C_BASE1 (OMAP44XX_L4_PER_BASE + 0x70000)
> #define I2C_BASE2 (OMAP44XX_L4_PER_BASE + 0x72000)
> #define I2C_BASE3 (OMAP44XX_L4_PER_BASE + 0x60000)
> +#define I2C_BASE4 (OMAP44XX_L4_PER_BASE + 0x350000)
>
> /* MUSB base */
> #define MUSB_BASE (OMAP44XX_L4_CORE_BASE + 0xAB000)
> diff --git a/arch/arm/include/asm/arch-omap4/i2c.h b/arch/arm/include/asm/arch-omap4/i2c.h
> index a91b4c2..02ee2f8 100644
> --- a/arch/arm/include/asm/arch-omap4/i2c.h
> +++ b/arch/arm/include/asm/arch-omap4/i2c.h
> @@ -23,7 +23,7 @@
> #ifndef _OMAP4_I2C_H_
> #define _OMAP4_I2C_H_
>
> -#define I2C_BUS_MAX 3
> +#define I2C_BUS_MAX 4
> #define I2C_DEFAULT_BASE I2C_BASE1
>
> struct i2c {
> diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
> index 81193b0..df8ab92 100644
> --- a/drivers/i2c/omap24xx_i2c.c
> +++ b/drivers/i2c/omap24xx_i2c.c
> @@ -448,6 +448,14 @@ int i2c_set_bus_num(unsigned int bus)
> return -1;
> }
>
> +#if I2C_BUS_MAX == 4
> + if (bus == 3)
> + i2c_base = (struct i2c *)I2C_BASE4;
> + else
> + if (bus == 2)
> + i2c_base = (struct i2c *)I2C_BASE3;
> + else
> +#endif
How about having a const array of bases and directly index
from that than having #ifdefs and if checks ??
Thanks,
Sricharan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-27 6:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-08 10:57 [U-Boot] [PATCH] omap4 i2c: add support for i2c bus 4 Koen Kooi
2012-08-27 6:08 ` R, Sricharan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.