All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] OMAP I2C: fix handling of alen = 0
@ 2012-03-26 11:06 Daniel Mack
  2012-04-30 18:43 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Mack @ 2012-03-26 11:06 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Cc: Dirk Behme <dirk.behme@gmail.com>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Tom Rini <trini@ti.com>
Cc: Steve Sakoman <sakoman@gmail.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rix <Tom.Rix@windriver.com>

---

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(-)

diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index f06af02..30914df 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -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)
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] OMAP I2C: fix handling of alen = 0
  2012-03-26 11:06 [U-Boot] [PATCH] OMAP I2C: fix handling of alen = 0 Daniel Mack
@ 2012-04-30 18:43 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2012-04-30 18:43 UTC (permalink / raw)
  To: u-boot

On Mon, Mar 26, 2012 at 01:06:22PM +0200, Daniel Mack wrote:

> 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.

-- 
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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-30 18:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-26 11:06 [U-Boot] [PATCH] OMAP I2C: fix handling of alen = 0 Daniel Mack
2012-04-30 18:43 ` Tom Rini

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.