From: Alexander Atanasov <alex@ssi.bg>
To: Jean Delvare <khali@linux-fr.org>
Cc: linux-kernel@vger.kernel.org, jordan.crouse@amd.com
Subject: Re: [PATCH] I2C block read
Date: Thu, 8 Jun 2006 16:29:26 +0300 [thread overview]
Message-ID: <20060608162926.625aad8b.alex@ssi.bg> (raw)
In-Reply-To: <20060607205025.b2529800.khali@linux-fr.org>
Hello,
On Wed, 7 Jun 2006 20:50:25 +0200
Jean Delvare wrote:
> As for the problem you encounter, it looks like a bug in the
> scx200_acb driver to me. It advertises the I2C_FUNC_SMBUS_BLOCK_DATA
> functionality, but due to its implementation it can only support SMBus
> block writes and not SMBus block reads. I see no reason why the chip
> itself couldn't do it, but right now the driver can't. The state
> machine the driver is based on would need some rework before the
> functionality can be added. In the meantime, the quickest fix is to
>
OK, i got it now. Untested patch that should do it.
>
> May I ask for what slave SMBus chip you need the SMBus block read
> transaction? It's only rarely used, so it could be that it's not what
> you need after all.
It's custom developed board with using some motorola processor,
and the implementation there is buggy doesn't send the lenght but
this is fixable. So i'll have to fix the state machine after that.
Guy who is developing the board says that he doesn't get the ACK
after the last byte is read too - one more thing to investigate.
Also i use some pc engines board which has geode cpu on it
and have two access busses one is at 0x820 and the second is at 0x810
but the second is not in the list of probed devices, can it be added?
>
> The scx200_acb code would probably benefit from a general review. It
> looks to me like quick command with data bit == 1 would fail, for
> example. It's not a very popular transaction either, but i2c bus
> drivers should handle all transactions they advertise as supported.
>
--
have fun,
alex
--- drivers/i2c/busses/scx200_acb.c.orig 2006-06-08 15:57:38.000000000 +0300
+++ drivers/i2c/busses/scx200_acb.c 2006-06-08 16:24:32.000000000 +0300
@@ -175,12 +175,22 @@
iface->state = state_read;
} else {
outb(iface->address_byte, ACBSDA);
-
iface->state = state_write;
}
break;
case state_read:
+ if (iface->len == 42) {
+ outb(inb(ACBCTL1) & ~ACBCTL1_ACK, ACBCTL1);
+ iface->len = inb(ACBSDA);
+ if (iface->len > 31) {
+ dev_dbg(&iface->adapter.dev, "Invalid read lenght %d in state %s\n",
+ iface->len, scx200_acb_state_name[iface->state]);
+ errmsg = "Invalid read lenght";
+ goto error;
+ }
+ break;
+ }
/* Set ACK if receiving the last byte */
if (iface->len == 1)
outb(inb(ACBCTL1) | ACBCTL1_ACK, ACBCTL1);
@@ -305,7 +315,11 @@
break;
case I2C_SMBUS_BLOCK_DATA:
- len = data->block[0];
+ /* 42 is invalid lenght max 32, use it to get real lenght from data */
+ if (rw == I2C_SMBUS_READ)
+ len = 42;
+ else
+ len = data->block[0];
buffer = &data->block[1];
break;
next prev parent reply other threads:[~2006-06-08 13:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-07 17:33 Alexander Atanasov
2006-06-07 17:49 ` Jean Delvare
2006-06-07 18:06 ` Alexander Atanasov
2006-06-07 18:50 ` Jean Delvare
2006-06-07 19:53 ` Jordan Crouse
2006-06-08 13:29 ` Alexander Atanasov [this message]
2006-06-11 13:30 ` [PATCH] " Jean Delvare
2006-06-12 14:16 ` Alexander Atanasov
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=20060608162926.625aad8b.alex@ssi.bg \
--to=alex@ssi.bg \
--cc=jordan.crouse@amd.com \
--cc=khali@linux-fr.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®