public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: Codrin.Ciubotariu@microchip.com
Cc: Tudor.Ambarus@microchip.com, linux-i2c@vger.kernel.org
Subject: Re: wrong assumption in i2c-at91-master.c ?
Date: Mon, 07 Mar 2022 18:23:57 +0100	[thread overview]
Message-ID: <554fbcb82bd9803a8ba13cf732771c7b@walle.cc> (raw)
In-Reply-To: <988d9fb8-eaab-13f1-db5e-189825a16097@microchip.com>

Hi Codrin,

Am 2022-03-07 18:09, schrieb Codrin.Ciubotariu@microchip.com:
> On 07.03.2022 17:57, Michael Walle wrote:
>> I saw that the at91 i2c driver has some kind of heuristic in
>> at91_twi_xfer(). It assumes that if there are exactly two
>> messages to transfer, the first is the address write of a
>> common i2c write address, read data transaction. I don't
>> think that assumption is correct.
>> 
>> Also there is no check if msg->len is actually smaller
>> than the width of the address which can be written to
>> AT91_TWI_IADR.
>> 
>> I think, what is at least missing is that, the first
>> one is actually a write and have at max 3 bytes (IIRC
>> thats the max width of AT91_TWI_IADR).
>> 
>> Actually, I don't find any code at all which would
>> handle multiple messages. Looks like it just supports
>> num == 2 (and assumes the first message fits into the
>> AT91_TWI_IADR) and num == 1.
> 
> The constraints are set using the quirks feature [1] of the i2c 
> subsystem.

Ahhh! Now it makes sense. Thanks.

-michael

      reply	other threads:[~2022-03-07 17:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 15:57 wrong assumption in i2c-at91-master.c ? Michael Walle
2022-03-07 17:09 ` Codrin.Ciubotariu
2022-03-07 17:23   ` Michael Walle [this message]

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=554fbcb82bd9803a8ba13cf732771c7b@walle.cc \
    --to=michael@walle.cc \
    --cc=Codrin.Ciubotariu@microchip.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=linux-i2c@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