Skip to contentSkip to conversation

OMAP I2C: fix handling of alen = 0

PATCH New Daniel Mack 2 participants 2 messages Mar 26, 2012 – Apr 30, 2012 I2C

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP I2C: fix handling of alen = 0

Allow raw I2C message transfers by setting the alen parameter to 0. Currently, this doesn't work due to false assumptions to what is appearantly considered a corner case.

With this patch applied, it is possible to send multibyte transfers in one single transaction instead of using multiple STOP-bit-ommited transfers.

Cc Dirk Behme <[email protected]>
Cc Igor Grinberg <[email protected]>
Cc Tom Rini <[email protected]>
Cc Steve Sakoman <[email protected]>
Cc Michal Simek <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Tom Rix <[email protected]>

---

On a OMAP3-based board, I needed raw I2C messages to configure peripheral devices, and it turned out that the current omap-i2c driver is not capable of send such due to assumption that are made wrt register/payload data on the wire.

I couldn't figure who's best to take care for such a patch, so I picked some people who have been working on this driver and similar boards before.

Thanks for routing this in the right direction :)

 drivers/i2c/omap24xx_i2c.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/omap24xx_i2c.c +2 -2
index f06af02..30914df 100644
@@ -401,7 +401,7 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
 		i2c_error = 1;
 
 	if (!i2c_error) {
-		if (status & I2C_STAT_XRDY) {
+		if (status & I2C_STAT_XRDY && alen > 0) {
 			switch (alen) {
 #if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
 			defined(CONFIG_AM33XX)
@@ -445,7 +445,7 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
 			i2c_error = 1;
 
 		if (!i2c_error) {
-			for (i = ((alen > 1) ? 0 : 1); i < len; i++) {
+			for (i = ((alen == 1) ? 1 : 0); i < len; i++) {
 				if (status & I2C_STAT_XRDY) {
 #if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX) || \
 				defined(CONFIG_AM33XX)
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/1 OMAP I2C: fix handling of alen = 0

Quoted 7 lines · Daniel Mack

Allow raw I2C message transfers by setting the alen parameter to 0. Currently, this doesn't work due to false assumptions to what is appearantly considered a corner case.

With this patch applied, it is possible to send multibyte transfers in one single transaction instead of using multiple STOP-bit-ommited transfers.

Sorry for the late reply. While I appricate your patch, it's against a TI-specific tree rather than mainline and as such doesn't apply (the i2c driver is a bit different and reconsiliation is on my list). I'll make sure this ends up in the TI tree and isn't lost. Thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120430/4340d77e/attachment.pgp>