From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-i2c@vger.kernel.org,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>,
review list <kernel-list@raspberrypi.com>
Subject: Re: i2c-designware: not possible to write to different i2c addresses in one transfer?
Date: Mon, 20 Oct 2025 14:29:31 +0200 [thread overview]
Message-ID: <90d52cf9-e3e3-437e-ae00-fc2a2bfbb0a9@kernel.org> (raw)
In-Reply-To: <20251020115959.GM2912318@black.igk.intel.com>
+CC kernel-list@raspberrypi.com since I wonder if the RPi devs are aware of this.
On 20/10/2025 13:59, Mika Westerberg wrote:
> Hi,
>
> On Wed, Oct 15, 2025 at 01:25:02PM +0200, Hans Verkuil wrote:
>> Hi,
>>
>> I have this code in a driver (writing display EDID data into an EDID EEPROM):
>>
>> struct i2c_msg msg[] = {
>> {
>> .addr = state->seg_client->addr, // 0x30
>> .buf = &seg,
>> .len = 1,
>> .flags = 0,
>> },
>> {
>> .addr = state->data_client->addr, // 0x50
>> .buf = data,
>> .len = len,
>> .flags = 0,
>> },
>> };
>>
>> err = i2c_transfer(state->dev_client->adapter, msg, ARRAY_SIZE(msg));
>>
>> This worked fine for the Raspberry Pi 4B using the broadcom i2c driver, but for
>> the Raspberry Pi 5 using the designware driver it fails with -EINVAL and these
>> kernel messages:
>>
>> [ 272.284689] i2c_designware 1f00074000.i2c: i2c_dw_xfer_msg: invalid target address
>> [ 272.305788] i2c_designware 1f00074000.i2c: controller active
>>
>> Looking in i2c-designware-master.c it seems it cannot handle consecutive messages for
>> different addresses.
>>
>> The i2c device I'm using is this one:
>>
>> https://www.onsemi.com/pdf/datasheet/cat24c208-d.pdf
>>
>> Is this a hardware limitation? Or is this a corner case that was never implemented?
>> Or just simply a bug?
>
> I'm catching up what has happened to this driver since I last did something
> for it so please excuse me if I'm stating obvious things ;-) Also was on
> vacation last week, sorry for the delay.
>
> The Intel I2C DW datasheets say that the I2C_TAR register must be
> programmed only when the controller is disabled (I2C_ENABLE=0) or no
> initiator mode operations are active.
>
> I think this explains why the driver does what it does.
>
> Since this is I2C EEPROM, pretty standard I guess. I wonder if you have
> tried the at24.c driver instead? If I read it right it splits the chip into
> multiple "clients" per segments thus avoiding limitations like this. IIRC
> this works fine with Intel controllers at least.
It's not a standard EEPROM, it's an EEPROM specifically meant for storing
display EDIDs. The host (in my case a Raspberry Pi 5) can write an EDID to it
over i2c, and it is also connected to the HDMI DDC lines so a video source can
read the EDID using the E-DDC standard. So the cat24c208 has two i2c ports,
one towards the host, one towards the HDMI connector. We use the cat24c208 to
emulate a display so we can easily debug various EDID issues.
It all worked fine with the RPi 4 and the Broadcom i2c driver, but not with
the RPi 5 designware i2c driver. It took a while before I noticed this since
most EDIDs are <= 256 bytes, and you don't need the segment address for that.
So is this a hardware limitation? I.e., there is no workaround and this simply
can't be supported?
If it is, then I will have to look for alternatives.
Regards,
Hans
next prev parent reply other threads:[~2025-10-20 12:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 11:25 i2c-designware: not possible to write to different i2c addresses in one transfer? Hans Verkuil
2025-10-15 11:51 ` Wolfram Sang
2025-10-15 13:40 ` Andy Shevchenko
2025-10-18 18:17 ` Hans Verkuil
2025-10-18 19:21 ` Andy Shevchenko
2025-10-20 9:41 ` Hans Verkuil
2025-10-19 17:53 ` Wolfram Sang
2025-10-20 7:15 ` Hans Verkuil
2025-10-20 11:59 ` Mika Westerberg
2025-10-20 12:29 ` Hans Verkuil [this message]
2025-10-20 12:45 ` Mika Westerberg
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=90d52cf9-e3e3-437e-ae00-fc2a2bfbb0a9@kernel.org \
--to=hverkuil+cisco@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=kernel-list@raspberrypi.com \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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