Skip to contentSkip to conversation

TI OMAP3 Fixing i2c initialization.

U-Boot New Tom Rix 3 participants 8 messages Sep 24, 2009 – Sep 29, 2009

lore
Share & tools
lore

Tom Rix

author
#0 lore raw

This patch is against u-boot-ti/master

This fixes a problem I am seeing with an early i2c access on Beagle.

author
#1 lore raw

PATCH 1/1 TI OMAP3 Use arm init sequence to initialize i2c

This changes fixes an early i2c error.

It appears that I2C is working because once a read or write error is detected, the omap24xx_i2c driver calls i2c_init inside its error handling check.

While it is ok to attempt error handling this way, the boards must not depend on this side effect to initialize it's i2c.

Instead of explicitly calling i2c_init for every board, use the generic arm initialization in lib_arm/board.c. By defining the config variable CONFIG_HARD_I2C, the omap3 i2c initialization is included in the init_sequence table.

Run tested on Beagle.
Compile tested on the omap3's

---
 include/configs/devkit8000.h    |    1 +
 include/configs/omap3_beagle.h  |    1 +
 include/configs/omap3_evm.h     |    1 +
 include/configs/omap3_overo.h   |    1 +
 include/configs/omap3_pandora.h |    1 +
 include/configs/omap3_zoom1.h   |    1 +
 include/configs/omap3_zoom2.h   |    1 +
 7 files changed, 7 insertions(+), 0 deletions(-)
include/configs/devkit8000.h +1 -0
index cd40da6..a8ac786 100644
@@ -98,6 +98,7 @@
 #define CONFIG_DOS_PARTITION		1
 
 /* I2C */
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_beagle.h +1 -0
index 61629f8..55eeb94 100644
@@ -123,6 +123,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_evm.h +1 -0
index 9f0f34b..72e9626 100644
@@ -121,6 +121,7 @@
 #undef CONFIG_CMD_IMLS		/* List all found images	*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_overo.h +1 -0
index 6616b55..c4fd696 100644
@@ -114,6 +114,7 @@
 
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_pandora.h +1 -0
index 1cfd7e9..064c0bc 100644
@@ -112,6 +112,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_zoom1.h +1 -0
index 61a41e7..b55b8f0 100644
@@ -119,6 +119,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_zoom2.h +1 -0
index 03f92f5..75ab980 100644
@@ -140,6 +140,7 @@
 #undef CONFIG_CMD_NFS			/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
Signature · 1 line
1.6.0.6
#2 lore raw

PATCH 1/1 TI OMAP3 Use arm init sequence to initialize i2c

Quoted 14 lines · Tom Rix

This changes fixes an early i2c error.

It appears that I2C is working because once a read or write error is detected, the omap24xx_i2c driver calls i2c_init inside its error handling check.

While it is ok to attempt error handling this way, the boards must not depend on this side effect to initialize it's i2c.

Instead of explicitly calling i2c_init for every board, use the generic arm initialization in lib_arm/board.c. By defining the config variable CONFIG_HARD_I2C, the omap3 i2c initialization is included in the init_sequence table.

Quoted 4 lines

Run tested on Beagle.
Compile tested on the omap3's

Quoted 94 lines
---
 include/configs/devkit8000.h    |    1 +
 include/configs/omap3_beagle.h  |    1 +
 include/configs/omap3_evm.h     |    1 +
 include/configs/omap3_overo.h   |    1 +
 include/configs/omap3_pandora.h |    1 +
 include/configs/omap3_zoom1.h   |    1 +
 include/configs/omap3_zoom2.h   |    1 +
 7 files changed, 7 insertions(+), 0 deletions(-)
include/configs/devkit8000.h +1 -0
index cd40da6..a8ac786 100644
@@ -98,6 +98,7 @@
 #define CONFIG_DOS_PARTITION		1
 
 /* I2C */
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_beagle.h +1 -0
index 61629f8..55eeb94 100644
@@ -123,6 +123,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_evm.h +1 -0
index 9f0f34b..72e9626 100644
@@ -121,6 +121,7 @@
 #undef CONFIG_CMD_IMLS		/* List all found images	*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_overo.h +1 -0
index 6616b55..c4fd696 100644
@@ -114,6 +114,7 @@
 
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_pandora.h +1 -0
index 1cfd7e9..064c0bc 100644
@@ -112,6 +112,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_zoom1.h +1 -0
index 61a41e7..b55b8f0 100644
@@ -119,6 +119,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_zoom2.h +1 -0
index 03f92f5..75ab980 100644
@@ -140,6 +140,7 @@
 #undef CONFIG_CMD_NFS			/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
#3 lore raw

PATCH 1/1 TI OMAP3 Use arm init sequence to initialize i2c

In reply to Tom Rix

Hello Tom,

Quoted 14 lines · Tom Rix

This changes fixes an early i2c error.

It appears that I2C is working because once a read or write error is detected, the omap24xx_i2c driver calls i2c_init inside its error handling check.

While it is ok to attempt error handling this way, the boards must not depend on this side effect to initialize it's i2c.

Instead of explicitly calling i2c_init for every board, use the generic arm initialization in lib_arm/board.c. By defining the config variable CONFIG_HARD_I2C, the omap3 i2c initialization is included in the init_sequence table.

Quoted 5 lines

Run tested on Beagle.
Compile tested on the omap3's

---

Patch does not apply:

$ git am --whitespace=strip ../patches/20090928/\[U-Boot\]\ \[PATCH\ 1_1\]\ TI\ OMAP3\ Use\ arm\ init\ sequence\ to\ initialize\  i2c.eml
Applying: TI OMAP3 Use arm init sequence to initialize i2c
error: patch failed: include/configs/omap3_overo.h:114
error: include/configs/omap3_overo.h: patch does not apply
Patch failed at 0001.
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
$

please fix

thanks

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH 1/1 TI OMAP3 Use arm init sequence to initialize i2c

Hi Heiko,

Quoted 17 lines · Heiko Schocher

Hello Tom,

Quoted 14 lines · Tom Rix

This changes fixes an early i2c error.

It appears that I2C is working because once a read or write error is detected, the omap24xx_i2c driver calls i2c_init inside its error handling check.

While it is ok to attempt error handling this way, the boards must not depend on this side effect to initialize it's i2c.

Instead of explicitly calling i2c_init for every board, use the generic arm initialization in lib_arm/board.c. By defining the config variable CONFIG_HARD_I2C, the omap3 i2c initialization is included in the init_sequence table.

Quoted 7 lines
Quoted 5 lines

Run tested on Beagle.
Compile tested on the omap3's

---

Patch does not apply:

It seems that it applies to u-boot-ti. Is it ok to move it through u-boot-ti into mainline?

Best regards

Dirk

#5 lore raw

PATCH 1/1 TI OMAP3 Use arm init sequence to initialize i2c

Hello Dirk,

Quoted 21 lines · Dirk Behme
Quoted 20 lines · Heiko Schocher

Hello Tom,

Quoted 17 lines · Tom Rix

This changes fixes an early i2c error.

It appears that I2C is working because once a read or write error is detected, the omap24xx_i2c driver calls i2c_init inside its error handling check.

While it is ok to attempt error handling this way, the boards must not depend on this side effect to initialize it's i2c.

Instead of explicitly calling i2c_init for every board, use the generic arm initialization in lib_arm/board.c. By defining the config variable CONFIG_HARD_I2C, the omap3 i2c initialization is included in the init_sequence table.

Run tested on Beagle.
Compile tested on the omap3's

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

---

Patch does not apply:

It seems that it applies to u-boot-ti. Is it ok to move it through u-boot-ti into mainline?

This is okay for me, so I just make:

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#6 lore raw

PATCH 1/1 TI OMAP3 Use arm init sequence to initialize i2c

In reply to Tom Rix

Tom,

Quoted 1 line · Tom Rix

This changes fixes an early i2c error.

Do you like to update this against recent u-boot-ti?

It applies fine using quilt

-- cut --

Quoted 1 line

quilt push

Applying patch patches/i2c_fix.txt
patching file include/configs/devkit8000.h patching file include/configs/omap3_beagle.h patching file include/configs/omap3_evm.h patching file include/configs/omap3_overo.h Hunk #1 succeeded at 109 with fuzz 1 (offset -5 lines). patching file include/configs/omap3_pandora.h patching file include/configs/omap3_zoom1.h patching file include/configs/omap3_zoom2.h

Now at patch patches/i2c_fix.txt
-- cut --

but 'git am' fails

-- cut --

Quoted 1 line

git am patches/i2c_fix.txt

Applying: TI OMAP3 Use arm init sequence to initialize i2c

error: patch failed: include/configs/omap3_overo.h:114

error: include/configs/omap3_overo.h: patch does not apply

Patch failed at 0001.
-- cut --

Something like 'quilt refresh' and then 'git am' helps :)

Strange, not sure why quilt can resolve this, but git not. I haven't found any option for git am to behave like quilt :(

Best regards

Dirk

Quoted 110 lines

It appears that I2C is working because once a read or write error is detected, the omap24xx_i2c driver calls i2c_init inside its error handling check.

While it is ok to attempt error handling this way, the boards must not depend on this side effect to initialize it's i2c.

Instead of explicitly calling i2c_init for every board, use the generic arm initialization in lib_arm/board.c. By defining the config variable CONFIG_HARD_I2C, the omap3 i2c initialization is included in the init_sequence table.

Run tested on Beagle.
Compile tested on the omap3's

---
 include/configs/devkit8000.h    |    1 +
 include/configs/omap3_beagle.h  |    1 +
 include/configs/omap3_evm.h     |    1 +
 include/configs/omap3_overo.h   |    1 +
 include/configs/omap3_pandora.h |    1 +
 include/configs/omap3_zoom1.h   |    1 +
 include/configs/omap3_zoom2.h   |    1 +
 7 files changed, 7 insertions(+), 0 deletions(-)
include/configs/devkit8000.h +1 -0
index cd40da6..a8ac786 100644
@@ -98,6 +98,7 @@
 #define CONFIG_DOS_PARTITION		1
 
 /* I2C */
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_beagle.h +1 -0
index 61629f8..55eeb94 100644
@@ -123,6 +123,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_evm.h +1 -0
index 9f0f34b..72e9626 100644
@@ -121,6 +121,7 @@
 #undef CONFIG_CMD_IMLS		/* List all found images	*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_overo.h +1 -0
index 6616b55..c4fd696 100644
@@ -114,6 +114,7 @@
 
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_pandora.h +1 -0
index 1cfd7e9..064c0bc 100644
@@ -112,6 +112,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_zoom1.h +1 -0
index 61a41e7..b55b8f0 100644
@@ -119,6 +119,7 @@
 #undef CONFIG_CMD_NFS		/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
include/configs/omap3_zoom2.h +1 -0
index 03f92f5..75ab980 100644
@@ -140,6 +140,7 @@
 #undef CONFIG_CMD_NFS			/* NFS support			*/
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_HARD_I2C			1
 #define CONFIG_SYS_I2C_SPEED		100000
 #define CONFIG_SYS_I2C_SLAVE		1
 #define CONFIG_SYS_I2C_BUS		0
author
#7 lore raw

PATCH 1/1 TI OMAP3 Use arm init sequence to initialize i2c

Quoted 7 lines · Dirk Behme

Tom,

Quoted 1 line · Tom Rix

This changes fixes an early i2c error.

Do you like to update this against recent u-boot-ti?

Yes. I developed against the u-boot-ti branch.
I will rebase the patches.
Tom