From: Daniel Mack <zonque@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] OMAP I2C: fix handling of alen = 0
Date: Mon, 26 Mar 2012 13:06:22 +0200 [thread overview]
Message-ID: <1332759982-9587-1-git-send-email-zonque@gmail.com> (raw)
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
next reply other threads:[~2012-03-26 11:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 11:06 Daniel Mack [this message]
2012-04-30 18:43 ` [U-Boot] [PATCH] OMAP I2C: fix handling of alen = 0 Tom Rini
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=1332759982-9587-1-git-send-email-zonque@gmail.com \
--to=zonque@gmail.com \
--cc=u-boot@lists.denx.de \
/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 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.