Skip to contentSkip to conversation

i3c: Fix default I2C adapter timeout value

PATCH Superseded Jarkko Nikula 3 participants 5 messages Sep 4, 2025 – Sep 5, 2025 I3C

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i3c: Fix default I2C adapter timeout value

Commit 3a379bbcea0a ("i3c: Add core I3C infrastructure") set the default adapter timeout for I2C transfers as 1000 (ms). However that parameter is defined in jiffies not in milliseconds.

With mipi-i3c-hci driver this wasn't visible until commit c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers").

Fix this by setting the default timeout as HZ (CONFIG_HZ) not 1000.

Fixes 1b84691e7870 ("i3c: dw: use adapter timeout value for I2C transfers")
Fixes be27ed672878 ("i3c: master: cdns: use adapter timeout value for I2C transfers")
Fixes c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers")
Fixes a747e01adad2 ("i3c: master: svc: use adapter timeout value for I2C transfers")
Fixes 3a379bbcea0a ("i3c: Add core I3C infrastructure")
---
 drivers/i3c/master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master.c +1 -1
index 2ef898a8fd80..67a18e437f83 100644
@@ -2492,7 +2492,7 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
 	strscpy(adap->name, dev_name(master->dev.parent), sizeof(adap->name));
 
 	/* FIXME: Should we allow i3c masters to override these values? */
-	adap->timeout = 1000;
+	adap->timeout = HZ;
 	adap->retries = 3;
 
 	id = of_alias_get_id(master->dev.of_node, "i2c");
Signature · 7 lines
2.47.2


-- 
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jarkko Nikula

Commit 3a379bbcea0a ("i3c: Add core I3C infrastructure") set the default adapter timeout for I2C transfers as 1000 (ms). However that parameter is defined in jiffies not in milliseconds.

With mipi-i3c-hci driver this wasn't visible until commit c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers").

Quoted 8 lines

Fix this by setting the default timeout as HZ (CONFIG_HZ) not 1000.

Fixes 1b84691e7870 ("i3c: dw: use adapter timeout value for I2C transfers")
Fixes be27ed672878 ("i3c: master: cdns: use adapter timeout value for I2C transfers")
Fixes c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers")
Fixes a747e01adad2 ("i3c: master: svc: use adapter timeout value for I2C transfers")
Fixes 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Fixes d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")

Thank you!

Signature · 3 lines
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
#2 lore raw
Quoted 17 lines · Wolfram Sang
Quoted 7 lines · Jarkko Nikula

Commit 3a379bbcea0a ("i3c: Add core I3C infrastructure") set the default adapter timeout for I2C transfers as 1000 (ms). However that parameter is defined in jiffies not in milliseconds.

With mipi-i3c-hci driver this wasn't visible until commit c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers").

Quoted 8 lines

Fix this by setting the default timeout as HZ (CONFIG_HZ) not 1000.

Fixes 1b84691e7870 ("i3c: dw: use adapter timeout value for I2C transfers")
Fixes be27ed672878 ("i3c: master: cdns: use adapter timeout value for I2C transfers")
Fixes c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers")
Fixes a747e01adad2 ("i3c: master: svc: use adapter timeout value for I2C transfers")
Fixes 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Quoted 5 lines
Fixes d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")

Thank you!

Ah, thanks! Somehow my eyes only saw the 1st call to the wait_for_completion_timeout() in renesas-i3c.c passing msecs_to_jiffies(1000) :-)

I didn't Cc stable since I don't think any of your patches cause any other issue than extra long wait in case of I2C transfer error on configurations where CONFIG_HZ is less than 1000 but now I'm unsure should it be Cc'ed?

Signature · 3 lines
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
#3 lore raw
Quoted 4 lines

I didn't Cc stable since I don't think any of your patches cause any other issue than extra long wait in case of I2C transfer error on configurations where CONFIG_HZ is less than 1000 but now I'm unsure should it be Cc'ed?

Hmm, while it is not really a bug, it is a regression because my patch reveals the wrong initialization. Maybe it is better to CC stable, at least for versions containing my patch?

Signature · 3 lines
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c
reviewer Reviewed-by on v1 1/1
#4 lore raw
In reply to Jarkko Nikula
Quoted 7 lines · Jarkko Nikula

Commit 3a379bbcea0a ("i3c: Add core I3C infrastructure") set the default adapter timeout for I2C transfers as 1000 (ms). However that parameter is defined in jiffies not in milliseconds.

With mipi-i3c-hci driver this wasn't visible until commit c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers").

Quoted 8 lines

Fix this by setting the default timeout as HZ (CONFIG_HZ) not 1000.

Fixes 1b84691e7870 ("i3c: dw: use adapter timeout value for I2C transfers")
Fixes be27ed672878 ("i3c: master: cdns: use adapter timeout value for I2C transfers")
Fixes c0a90eb55a69 ("i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers")
Fixes a747e01adad2 ("i3c: master: svc: use adapter timeout value for I2C transfers")
Fixes 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Quoted 25 lines
---
 drivers/i3c/master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master.c +1 -2
index 2ef898a8fd80..67a18e437f83 100644
@@ -2492,7 +2492,7 @@ static int i3c_master_i2c_adapter_init(struct i3c_master_controller *master)
 	strscpy(adap->name, dev_name(master->dev.parent), sizeof(adap->name));
 
 	/* FIXME: Should we allow i3c masters to override these values? */
-	adap->timeout = 1000;
+	adap->timeout = HZ;
 	adap->retries = 3;
 
 	id = of_alias_get_id(master->dev.of_node, "i2c");
--

2.47.2

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c

Signature · 3 lines
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c