public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] i3c: Fix default I2C adapter timeout value
@ 2025-09-04 12:42 Jarkko Nikula
  2025-09-04 14:17 ` Wolfram Sang
  2025-09-04 16:48 ` Frank Li
  0 siblings, 2 replies; 5+ messages in thread
From: Jarkko Nikula @ 2025-09-04 12:42 UTC (permalink / raw)
  To: linux-i3c
  Cc: Alexandre Belloni, Frank Li, Wolfram Sang, Boris Brezillon,
	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").

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")
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i3c/master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 2ef898a8fd80..67a18e437f83 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -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
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] i3c: Fix default I2C adapter timeout value
  2025-09-04 12:42 [PATCH] i3c: Fix default I2C adapter timeout value Jarkko Nikula
@ 2025-09-04 14:17 ` Wolfram Sang
  2025-09-05  7:38   ` Jarkko Nikula
  2025-09-04 16:48 ` Frank Li
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2025-09-04 14:17 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i3c, Alexandre Belloni, Frank Li, Boris Brezillon

On Thu, Sep 04, 2025 at 03:42:26PM +0300, Jarkko Nikula wrote:
> 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")
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thank you!


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] i3c: Fix default I2C adapter timeout value
  2025-09-04 12:42 [PATCH] i3c: Fix default I2C adapter timeout value Jarkko Nikula
  2025-09-04 14:17 ` Wolfram Sang
@ 2025-09-04 16:48 ` Frank Li
  1 sibling, 0 replies; 5+ messages in thread
From: Frank Li @ 2025-09-04 16:48 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i3c, Alexandre Belloni, Wolfram Sang, Boris Brezillon

On Thu, Sep 04, 2025 at 03:42:26PM +0300, Jarkko Nikula wrote:
> 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")
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
>  drivers/i3c/master.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 2ef898a8fd80..67a18e437f83 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -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
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] i3c: Fix default I2C adapter timeout value
  2025-09-04 14:17 ` Wolfram Sang
@ 2025-09-05  7:38   ` Jarkko Nikula
  2025-09-05  9:13     ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2025-09-05  7:38 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i3c, Alexandre Belloni, Frank Li, Boris Brezillon

On 9/4/25 5:17 PM, Wolfram Sang wrote:
> On Thu, Sep 04, 2025 at 03:42:26PM +0300, Jarkko Nikula wrote:
>> 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")
>> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> 
> Fixes: d028219a9f14 ("i3c: master: Add basic driver for the Renesas I3C controller")
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> 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?

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] i3c: Fix default I2C adapter timeout value
  2025-09-05  7:38   ` Jarkko Nikula
@ 2025-09-05  9:13     ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2025-09-05  9:13 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: linux-i3c, Alexandre Belloni, Frank Li, Boris Brezillon


> 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?


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-05 14:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 12:42 [PATCH] i3c: Fix default I2C adapter timeout value Jarkko Nikula
2025-09-04 14:17 ` Wolfram Sang
2025-09-05  7:38   ` Jarkko Nikula
2025-09-05  9:13     ` Wolfram Sang
2025-09-04 16:48 ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox