devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Jelonek <jelonek.jonas@gmail.com>
To: Sven Eckelmann <sven@narfation.org>,
	Chris Packham <chris.packham@alliedtelesis.co.nz>,
	Andi Shyti <andi.shyti@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: linux-i2c@vger.kernel.org, Conor Dooley <conor+dt@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Markus Stockhausen <markus.stockhausen@gmx.de>,
	Harshal Gohel <hg@simonwunderlich.de>
Subject: Re: [PATCH v5 06/11] i2c: rtl9300: remove SMBus Quick operation support
Date: Sun, 10 Aug 2025 11:31:53 +0200	[thread overview]
Message-ID: <d01e5498-b2b0-473b-b8e7-339825c45043@gmail.com> (raw)
In-Reply-To: <3644932.iIbC2pHGDl@sven-desktop>



On 10.08.2025 09:13, Sven Eckelmann wrote:
> On Sunday, 10 August 2025 00:07:07 CEST Jonas Jelonek wrote:
> [...]
>> The current implementation of SMBus Quick operation passes a length of
>> 0 (which is actually invalid). Before the fix of a bug in a previous
>> commit, this led to a read operation of 16 bytes from any register (the
>> one of a former transaction or any other value.
>>
>> Although there are currently no reports of actual issues this caused.
>> However, as an example, i2cdetect by default uses Quick Write operation
>> to probe the bus and this may already write anything to some register
>> of a device, causing unintended behaviour. This could be the cause of a
>> recent brick of one of my DAC cables where there was a checksum mismatch
>> of the EEPROM after having run 'i2cdetect -l' before.
> [...]
>
> Nice find. I've actually observed odd behavior after/during probing and 
> attributed it only to the other problems (especially the low timeout + missing 
> check) we found and never did a deep dive to figure out what happened on the 
> bus during the probe. Possible that this could be related.

Haven't actually described my issue in detail in the commit message (may add
this in the next version) but it perfectly makes sense. Quick operation in the
driver passed a length of 0 to config_xfer. Internally, this leads to a value of
0xf in the DATA_WIDTH register meaning 16 bytes to be read/written because
of:

(len - 1) & 0xf

The register value obviously was assumed to be 0 by the hardware and data
was completely zeroed too. Then it did a 16-byte write of that. Unfortunately,
the EEPROM of my DAC isn't write-protected so it was written to the EEPROM
causing checksum error on next boot (was able to fix that though).

> Reviewed-by: Sven Eckelmann <sven@narfation.org>

Thanks!

> Kind regards,
> 	Sven

Best,
Jonas

  reply	other threads:[~2025-08-10  9:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-09 22:07 [PATCH v5 00/11] i2c: rework and extend RTL9300 I2C driver Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 01/11] i2c: rtl9300: use regmap fields and API for registers Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 02/11] i2c: rtl9300: fix channel number bound check Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 03/11] dt-bindings: i2c: realtek,rtl9301-i2c: fix wording and typos Jonas Jelonek
2025-08-18 15:10   ` Rob Herring (Arm)
2025-08-09 22:07 ` [PATCH v5 04/11] i2c: rtl9300: rename internal sda_pin to sda_num Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 05/11] i2c: rtl9300: check if xfer length is valid Jonas Jelonek
2025-08-10  5:51   ` Wolfram Sang
2025-08-10  7:01     ` Sven Eckelmann
2025-08-10  9:22       ` Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 06/11] i2c: rtl9300: remove SMBus Quick operation support Jonas Jelonek
2025-08-10  7:13   ` Sven Eckelmann
2025-08-10  9:31     ` Jonas Jelonek [this message]
2025-08-09 22:07 ` [PATCH v5 07/11] i2c: rtl9300: move setting SCL frequency to config_io Jonas Jelonek
2025-08-10  8:49   ` Markus Elfring
2025-08-10  8:54     ` Sven Eckelmann
2025-08-10  9:10     ` Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 08/11] i2c: rtl9300: do not set read mode on every transfer Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 09/11] i2c: rtl9300: separate xfer configuration and execution Jonas Jelonek
2025-08-09 22:07 ` [PATCH v5 10/11] dt-bindings: i2c: realtek,rtl9301-i2c: extend for RTL9310 support Jonas Jelonek
2025-08-18 15:13   ` Rob Herring (Arm)
2025-08-09 22:07 ` [PATCH v5 11/11] i2c: rtl9300: add support for RTL9310 I2C controller Jonas Jelonek
2025-08-10 10:39   ` Sven Eckelmann

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=d01e5498-b2b0-473b-b8e7-339825c45043@gmail.com \
    --to=jelonek.jonas@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hg@simonwunderlich.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus.stockhausen@gmx.de \
    --cc=robh@kernel.org \
    --cc=sven@narfation.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;
as well as URLs for NNTP newsgroup(s).