From: Tony Lindgren <tony@atomide.com>
To: linux-omap@vger.kernel.org
Cc: Tony Lindgren <tony@atomide.com>
Subject: [PATCH] I2C: Fix twl4030 timeouts on omap3430
Date: Fri, 28 Mar 2008 13:46:39 +0200 [thread overview]
Message-ID: <1206704800-6768-5-git-send-email-tony@atomide.com> (raw)
In-Reply-To: <1206704800-6768-4-git-send-email-tony@atomide.com>
For some reason doing a twl4030 write-read cycle can hang the I2C bus
on omap3430. And doing the write and read separately in twl4030_i2c_read()
seems to fix the problem...
Not intended for applying, just a temporary workaround.
diff --git a/drivers/i2c/chips/twl4030-core.c b/drivers/i2c/chips/twl4030-core.c
index ded86e7..62868b0 100644
--- a/drivers/i2c/chips/twl4030-core.c
+++ b/drivers/i2c/chips/twl4030-core.c
@@ -327,6 +327,7 @@ int twl4030_i2c_read(u8 mod_no, u8 * value, u8 reg, u8 num_bytes)
return -EPERM;
}
mutex_lock(&twl->xfer_lock);
+
/* [MSG1] fill the register address data */
msg = &twl->xfer_msg[0];
msg->addr = twl->address;
@@ -334,18 +335,25 @@ int twl4030_i2c_read(u8 mod_no, u8 * value, u8 reg, u8 num_bytes)
msg->flags = 0; /* Read the register value */
val = twl4030_map[mod_no].base + reg;
msg->buf = &val;
+ ret = i2c_transfer(twl->client.adapter, twl->xfer_msg, 1);
+ if (ret < 0)
+ goto out;
+
/* [MSG2] fill the data rx buffer */
msg = &twl->xfer_msg[1];
msg->addr = twl->address;
msg->flags = I2C_M_RD; /* Read the register value */
msg->len = num_bytes; /* only n bytes */
msg->buf = value;
- ret = i2c_transfer(twl->client.adapter, twl->xfer_msg, 2);
+ ret = i2c_transfer(twl->client.adapter, twl->xfer_msg, 1);
+
+out:
mutex_unlock(&twl->xfer_lock);
/* i2cTransfer returns num messages.translate it pls.. */
if (ret >= 0)
ret = 0;
+
return ret;
}
next prev parent reply other threads:[~2008-03-28 11:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-28 11:46 [PATCH 0/2] Add sram34xx.S Tony Lindgren
2008-03-28 11:46 ` [PATCH 1/2] ARM: OMAP3: Add 34xx SRAM functions Tony Lindgren
2008-03-28 11:46 ` [PATCH 2/2] ARCH: OMAP3: Make SRAM code from TI CDP compile and work Tony Lindgren
[not found] ` <1206704800-6768-4-git-send-email-tony@atomide.com>
2008-03-28 11:46 ` Tony Lindgren [this message]
2008-03-28 11:46 ` [PATCH] I2C: Fix twl4030 timeouts on omap3430 Tony Lindgren
2008-03-28 11:49 ` Tony Lindgren
2008-03-28 11:48 ` Tony Lindgren
2008-05-15 21:40 ` [PATCH 0/2] Add sram34xx.S Tony Lindgren
-- strict thread matches above, loose matches on Subject: below --
2008-03-28 8:41 [PATCH] I2C: Fix twl4030 timeouts on omap3430 Tony Lindgren
2008-03-31 10:43 ` Tony Lindgren
2008-03-31 14:30 ` Tony Lindgren
2008-04-01 12:43 ` Tony Lindgren
2008-04-01 13:00 ` Peter 'p2' De Schrijver
2008-04-01 13:38 ` Tony Lindgren
2008-04-01 14:04 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1206704800-6768-5-git-send-email-tony@atomide.com \
--to=tony@atomide.com \
--cc=linux-omap@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox