<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/i2c, branch v6.17</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.17</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.17'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-09-27T22:23:34Z</updated>
<entry>
<title>i2c: rtl9300: Drop unsupported I2C_FUNC_SMBUS_I2C_BLOCK</title>
<updated>2025-09-27T22:23:34Z</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2025-09-27T09:52:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=095530512152e6811278de9c30f170f0ac9705eb'/>
<id>urn:sha1:095530512152e6811278de9c30f170f0ac9705eb</id>
<content type='text'>
While applying the patch for commit ede965fd555a ("i2c: rtl9300: remove
broken SMBus Quick operation support"), a conflict was incorrectly solved
by adding the I2C_FUNC_SMBUS_I2C_BLOCK feature flag. But the code to handle
I2C_SMBUS_I2C_BLOCK_DATA requests will be added by a separate commit.

Fixes: ede965fd555a ("i2c: rtl9300: remove broken SMBus Quick operation support")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
</content>
</entry>
<entry>
<title>i2c: riic: Allow setting frequencies lower than 50KHz</title>
<updated>2025-09-23T19:14:53Z</updated>
<author>
<name>Claudiu Beznea</name>
<email>claudiu.beznea.uj@bp.renesas.com</email>
</author>
<published>2025-09-23T14:18:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dde9a38195b0c268ff55d3a8aa62faefd0e988c8'/>
<id>urn:sha1:dde9a38195b0c268ff55d3a8aa62faefd0e988c8</id>
<content type='text'>
The MR1.CKS field is 3 bits wide and all the possible values (from 0 to
7) are valid. This is true for all the SoCs currently integrated in
upstream Linux. Take into account CKS=7 which allows setting bus
frequencies lower than 50KHz. This may be useful at least for debugging.

Fixes: d982d6651419 ("i2c: riic: remove clock and frequency restrictions")
Signed-off-by: Claudiu Beznea &lt;claudiu.beznea.uj@bp.renesas.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
</content>
</entry>
<entry>
<title>i2c: rtl9300: remove broken SMBus Quick operation support</title>
<updated>2025-09-03T22:31:34Z</updated>
<author>
<name>Jonas Jelonek</name>
<email>jelonek.jonas@gmail.com</email>
</author>
<published>2025-08-31T10:04:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ede965fd555ac2536cf651893a998dbfd8e57b86'/>
<id>urn:sha1:ede965fd555ac2536cf651893a998dbfd8e57b86</id>
<content type='text'>
Remove the SMBus Quick operation from this driver because it is not
natively supported by the hardware and is wrongly implemented in the
driver.

The I2C controllers in Realtek RTL9300 and RTL9310 are SMBus-compliant
but there doesn't seem to be native support for the SMBus Quick
operation. It is not explicitly mentioned in the documentation but
looking at the registers which configure an SMBus transaction, one can
see that the data length cannot be set to 0. This suggests that the
hardware doesn't allow any SMBus message without data bytes (except for
those it does on it's own, see SMBus Block Read).

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.

This caused issues like soft-bricked SFP modules after a simple probe
with i2cdetect which uses Quick by default. Running this with SFP
modules whose EEPROM isn't write-protected, some of the initial bytes
are overwritten because a 16-byte write operation is executed instead of
a Quick Write. (This temporarily soft-bricked one of my DAC cables.)

Because SMBus Quick operation is obviously not supported on these
controllers (because a length of 0 cannot be set, even when no register
address is set), remove that instead of claiming there is support. There
also shouldn't be any kind of emulated 'Quick' which just does another
kind of operation in the background. Otherwise, specific issues occur
in case of a 'Quick' Write which actually writes unknown data to an
unknown register.

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Cc: stable@vger.kernel.org # v6.13+
Signed-off-by: Jonas Jelonek &lt;jelonek.jonas@gmail.com&gt;
Tested-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Tested-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt; # On RTL9302C based board
Tested-by: Markus Stockhausen &lt;markus.stockhausen@gmx.de&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250831100457.3114-4-jelonek.jonas@gmail.com
</content>
</entry>
<entry>
<title>i2c: rtl9300: ensure data length is within supported range</title>
<updated>2025-09-03T22:31:28Z</updated>
<author>
<name>Jonas Jelonek</name>
<email>jelonek.jonas@gmail.com</email>
</author>
<published>2025-08-31T10:04:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=06418cb5a1a542a003fdb4ad8e76ea542d57cfba'/>
<id>urn:sha1:06418cb5a1a542a003fdb4ad8e76ea542d57cfba</id>
<content type='text'>
Add an explicit check for the xfer length to 'rtl9300_i2c_config_xfer'
to ensure the data length isn't within the supported range. In
particular a data length of 0 is not supported by the hardware and
causes unintended or destructive behaviour.

This limitation becomes obvious when looking at the register
documentation [1]. 4 bits are reserved for DATA_WIDTH and the value
of these 4 bits is used as N + 1, allowing a data length range of
1 &lt;= len &lt;= 16.

Affected by this is the SMBus Quick Operation which works with a data
length of 0. Passing 0 as the length causes an underflow of the value
due to:

(len - 1) &amp; 0xf

and effectively specifying a transfer length of 16 via the registers.
This causes a 16-byte write operation instead of a Quick Write. For
example, on SFP modules without write-protected EEPROM this soft-bricks
them by overwriting some initial bytes.

For completeness, also add a quirk for the zero length.

[1] https://svanheule.net/realtek/longan/register/i2c_mst1_ctrl2

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Cc: stable@vger.kernel.org # v6.13+
Signed-off-by: Jonas Jelonek &lt;jelonek.jonas@gmail.com&gt;
Tested-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Tested-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt; # On RTL9302C based board
Tested-by: Markus Stockhausen &lt;markus.stockhausen@gmx.de&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250831100457.3114-3-jelonek.jonas@gmail.com
</content>
</entry>
<entry>
<title>i2c: rtl9300: fix channel number bound check</title>
<updated>2025-09-03T22:31:23Z</updated>
<author>
<name>Jonas Jelonek</name>
<email>jelonek.jonas@gmail.com</email>
</author>
<published>2025-08-31T10:04:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cd6c956fbc13156bcbcca084b46a8380caebc2a8'/>
<id>urn:sha1:cd6c956fbc13156bcbcca084b46a8380caebc2a8</id>
<content type='text'>
Fix the current check for number of channels (child nodes in the device
tree). Before, this was:

if (device_get_child_node_count(dev) &gt;= RTL9300_I2C_MUX_NCHAN)

RTL9300_I2C_MUX_NCHAN gives the maximum number of channels so checking
with '&gt;=' isn't correct because it doesn't allow the last channel
number. Thus, fix it to:

if (device_get_child_node_count(dev) &gt; RTL9300_I2C_MUX_NCHAN)

Issue occured on a TP-Link TL-ST1008F v2.0 device (8 SFP+ ports) and fix
is tested there.

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Cc: stable@vger.kernel.org # v6.13+
Signed-off-by: Jonas Jelonek &lt;jelonek.jonas@gmail.com&gt;
Tested-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Tested-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt; # On RTL9302C based board
Tested-by: Markus Stockhausen &lt;markus.stockhausen@gmx.de&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250831100457.3114-2-jelonek.jonas@gmail.com
</content>
</entry>
<entry>
<title>i2c: i801: Hide Intel Birch Stream SoC TCO WDT</title>
<updated>2025-09-02T16:22:29Z</updated>
<author>
<name>Chiasheng Lee</name>
<email>chiasheng.lee@linux.intel.com</email>
</author>
<published>2025-09-01T12:59:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=664596bd98bb251dd417dfd3f9b615b661e1e44a'/>
<id>urn:sha1:664596bd98bb251dd417dfd3f9b615b661e1e44a</id>
<content type='text'>
Hide the Intel Birch Stream SoC TCO WDT feature since it was removed.

On platforms with PCH TCO WDT, this redundant device might be rendering
errors like this:

[   28.144542] sysfs: cannot create duplicate filename '/bus/platform/devices/iTCO_wdt'

Fixes: 8c56f9ef25a3 ("i2c: i801: Add support for Intel Birch Stream SoC")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=220320
Signed-off-by: Chiasheng Lee &lt;chiasheng.lee@linux.intel.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v6.7+
Reviewed-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Reviewed-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250901125943.916522-1-chiasheng.lee@linux.intel.com
</content>
</entry>
<entry>
<title>i2c: rtl9300: Add missing count byte for SMBus Block Ops</title>
<updated>2025-08-19T21:21:03Z</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2025-08-10T18:05:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=82b350dd8185ce790e61555c436f90b6501af23c'/>
<id>urn:sha1:82b350dd8185ce790e61555c436f90b6501af23c</id>
<content type='text'>
The expected on-wire format of an SMBus Block Write is

  S Addr Wr [A] Comm [A] Count [A] Data [A] Data [A] ... [A] Data [A] P

Everything starting from the Count byte is provided by the I2C subsystem in
the array data-&gt;block. But the driver was skipping the Count byte
(data-&gt;block[0]) when sending it to the RTL93xx I2C controller.

Only the actual data could be seen on the wire:

  S Addr Wr [A] Comm [A] Data [A] Data [A] ... [A] Data [A] P

This wire format is not SMBus Block Write compatible but matches the format
of an I2C Block Write. Simply adding the count byte to the buffer for the
I2C controller is enough to fix the transmission.

This also affects read because the I2C controller must receive the count
byte + $count * data bytes.

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v6.13+
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Tested-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250810-i2c-rtl9300-multi-byte-v5-4-cd9dca0db722@narfation.org
</content>
</entry>
<entry>
<title>i2c: rtl9300: Increase timeout for transfer polling</title>
<updated>2025-08-19T21:20:02Z</updated>
<author>
<name>Sven Eckelmann</name>
<email>sven@narfation.org</email>
</author>
<published>2025-08-10T18:05:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ceee7776c010c5f09d30985c9e5223b363a6172a'/>
<id>urn:sha1:ceee7776c010c5f09d30985c9e5223b363a6172a</id>
<content type='text'>
The timeout for transfers was only set to 2ms. Because of this relatively
low limit, 12-byte read operations to the frontend MCU of a RTL8239 POE PSE
chip cluster was consistently resulting in a timeout.

The original OpenWrt downstream driver [1] was not using any timeout limit
at all. This is also possible by setting the timeout_us parameter of
regmap_read_poll_timeout() to 0. But since the driver currently implements
the ETIMEDOUT error, it is more sensible to increase the timeout in such a
way that communication with the (quite common) Realtek I2C-connected POE
management solution is possible.

[1] https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/realtek/files-6.12/drivers/i2c/busses/i2c-rtl9300.c;h=c4d973195ef39dc56d6207e665d279745525fcac#l202

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v6.13+
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Tested-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250810-i2c-rtl9300-multi-byte-v5-3-cd9dca0db722@narfation.org
</content>
</entry>
<entry>
<title>i2c: rtl9300: Fix multi-byte I2C write</title>
<updated>2025-08-19T21:19:14Z</updated>
<author>
<name>Harshal Gohel</name>
<email>hg@simonwunderlich.de</email>
</author>
<published>2025-08-10T18:05:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d67b740b9edfa46310355e2b68050f79ebf05a4c'/>
<id>urn:sha1:d67b740b9edfa46310355e2b68050f79ebf05a4c</id>
<content type='text'>
The RTL93xx I2C controller has 4 32 bit registers to store the bytes for
the upcoming I2C transmission. The first byte is stored in the
least-significant byte of the first register. And the last byte in the most
significant byte of the last register. A map of the transferred bytes to
their order in the registers is:

reg 0: 0x04_03_02_01
reg 1: 0x08_07_06_05
reg 2: 0x0c_0b_0a_09
reg 3: 0x10_0f_0e_0d

The i2c_read() function basically demonstrates how the hardware would pick
up bytes from this register set. But the i2c_write() function was just
pushing bytes one after another to the least significant byte of a register
AFTER shifting the last one to the next more significant byte position.

If you would then have tried to send a buffer with numbers 1-11 using
i2c_write(), you would have ended up with following register content:

reg 0: 0x01_02_03_04
reg 1: 0x05_06_07_08
reg 2: 0x00_09_0a_0b
reg 3: 0x00_00_00_00

On the wire, you would then have seen:

  Sr Addr Wr [A] 04 A 03 A 02 A 01 A 08 A 07 A 06 A 05 A 0b A 0a A 09 A P

But the correct data transmission was expected to be

  Sr Addr Wr [A] 01 A 02 A 03 A 04 A 05 A 06 A 07 A 08 A 09 A 0a A 0b A P

Because of this multi-byte ordering problem, only single byte i2c_write()
operations were executed correctly (on the wire).

By shifting the byte directly to the correct end position in the register,
it is possible to avoid this incorrect byte ordering and fix multi-byte
transmissions.

The second initialization (to 0) of vals was also be dropped because this
array is initialized to 0 on the stack by using `= {};`. This makes the
fix a lot more readable.

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Signed-off-by: Harshal Gohel &lt;hg@simonwunderlich.de&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v6.13+
Co-developed-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Tested-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250810-i2c-rtl9300-multi-byte-v5-2-cd9dca0db722@narfation.org
</content>
</entry>
<entry>
<title>i2c: rtl9300: Fix out-of-bounds bug in rtl9300_i2c_smbus_xfer</title>
<updated>2025-08-19T21:17:56Z</updated>
<author>
<name>Alex Guo</name>
<email>alexguo1023@gmail.com</email>
</author>
<published>2025-08-10T18:05:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=57f312b955938fc4663f430cb57a71f2414f601b'/>
<id>urn:sha1:57f312b955938fc4663f430cb57a71f2414f601b</id>
<content type='text'>
The data-&gt;block[0] variable comes from user. Without proper check,
the variable may be very large to cause an out-of-bounds bug.

Fix this bug by checking the value of data-&gt;block[0] first.

1. commit 39244cc75482 ("i2c: ismt: Fix an out-of-bounds bug in
   ismt_access()")
2. commit 92fbb6d1296f ("i2c: xgene-slimpro: Fix out-of-bounds bug in
   xgene_slimpro_i2c_xfer()")

Fixes: c366be720235 ("i2c: Add driver for the RTL9300 I2C controller")
Signed-off-by: Alex Guo &lt;alexguo1023@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v6.13+
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Tested-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Reviewed-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Signed-off-by: Sven Eckelmann &lt;sven@narfation.org&gt;
Signed-off-by: Andi Shyti &lt;andi.shyti@kernel.org&gt;
Link: https://lore.kernel.org/r/20250810-i2c-rtl9300-multi-byte-v5-1-cd9dca0db722@narfation.org
</content>
</entry>
</feed>
