public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/4] i3c: use adapter timeout value for I2C transfers
@ 2025-06-04 10:18 Wolfram Sang
  2025-06-04 10:18 ` [PATCH 1/4] i3c: dw: " Wolfram Sang
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Wolfram Sang @ 2025-06-04 10:18 UTC (permalink / raw)
  To: linux-i3c
  Cc: Wolfram Sang, Alexandre Belloni, Frank Li, imx, Miquel Raynal,
	Przemysław Gaj

All I3C adapters so far use a timeout of 1 second for I2C transfers. I2C
adapters have their own timeout value which can be changed by userspace
if desired. Use it for I2C transfers. The default is 1Hz, so the default
behaviour is unchanged.

Found while finalizing the RFC for the upcoming Renesas I3C driver.
Looking forward to comments, tests...

Wolfram Sang (4):
  i3c: dw: use adapter timeout value for I2C transfers
  i3c: master: cdns: use adapter timeout value for I2C transfers
  i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers
  i3c: master: svc: use adapter timeout value for I2C transfers

 drivers/i3c/master/dw-i3c-master.c     | 2 +-
 drivers/i3c/master/i3c-master-cdns.c   | 2 +-
 drivers/i3c/master/mipi-i3c-hci/core.c | 2 +-
 drivers/i3c/master/svc-i3c-master.c    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.47.2


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

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

* [PATCH 1/4] i3c: dw: use adapter timeout value for I2C transfers
  2025-06-04 10:18 [PATCH 0/4] i3c: use adapter timeout value for I2C transfers Wolfram Sang
@ 2025-06-04 10:18 ` Wolfram Sang
  2025-06-04 10:18 ` [PATCH 2/4] i3c: master: cdns: " Wolfram Sang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2025-06-04 10:18 UTC (permalink / raw)
  To: linux-i3c; +Cc: Wolfram Sang, Alexandre Belloni, Frank Li

I2C adapters have their own timeout value which can be changed by
userspace if desired. Use it for I2C transfers. The default is 1Hz, so
the default behaviour is unchanged.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i3c/master/dw-i3c-master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 611c22b72c15..0c370672a4fc 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1142,7 +1142,7 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
 	}
 
 	dw_i3c_master_enqueue_xfer(master, xfer);
-	if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
+	if (!wait_for_completion_timeout(&xfer->comp, m->i2c.timeout))
 		dw_i3c_master_dequeue_xfer(master, xfer);
 
 	ret = xfer->ret;
-- 
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] 8+ messages in thread

* [PATCH 2/4] i3c: master: cdns: use adapter timeout value for I2C transfers
  2025-06-04 10:18 [PATCH 0/4] i3c: use adapter timeout value for I2C transfers Wolfram Sang
  2025-06-04 10:18 ` [PATCH 1/4] i3c: dw: " Wolfram Sang
@ 2025-06-04 10:18 ` Wolfram Sang
  2025-06-04 10:18 ` [PATCH 3/4] i3c: mipi-i3c-hci: " Wolfram Sang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2025-06-04 10:18 UTC (permalink / raw)
  To: linux-i3c; +Cc: Wolfram Sang, Przemysław Gaj, Alexandre Belloni, Frank Li

I2C adapters have their own timeout value which can be changed by
userspace if desired. Use it for I2C transfers. The default is 1Hz, so
the default behaviour is unchanged.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i3c/master/i3c-master-cdns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
index fd3752cea654..562e49e930b4 100644
--- a/drivers/i3c/master/i3c-master-cdns.c
+++ b/drivers/i3c/master/i3c-master-cdns.c
@@ -863,7 +863,7 @@ static int cdns_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
 	}
 
 	cdns_i3c_master_queue_xfer(master, xfer);
-	if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000)))
+	if (!wait_for_completion_timeout(&xfer->comp, m->i2c.timeout))
 		cdns_i3c_master_unqueue_xfer(master, xfer);
 
 	ret = xfer->ret;
-- 
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] 8+ messages in thread

* [PATCH 3/4] i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers
  2025-06-04 10:18 [PATCH 0/4] i3c: use adapter timeout value for I2C transfers Wolfram Sang
  2025-06-04 10:18 ` [PATCH 1/4] i3c: dw: " Wolfram Sang
  2025-06-04 10:18 ` [PATCH 2/4] i3c: master: cdns: " Wolfram Sang
@ 2025-06-04 10:18 ` Wolfram Sang
  2025-06-04 10:18 ` [PATCH 4/4] i3c: master: svc: " Wolfram Sang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2025-06-04 10:18 UTC (permalink / raw)
  To: linux-i3c; +Cc: Wolfram Sang, Alexandre Belloni, Frank Li

I2C adapters have their own timeout value which can be changed by
userspace if desired. Use it for I2C transfers. The default is 1Hz, so
the default behaviour is unchanged.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i3c/master/mipi-i3c-hci/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index bc4538694540..60f1175f1f37 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -395,7 +395,7 @@ static int i3c_hci_i2c_xfers(struct i2c_dev_desc *dev,
 	ret = hci->io->queue_xfer(hci, xfer, nxfers);
 	if (ret)
 		goto out;
-	if (!wait_for_completion_timeout(&done, HZ) &&
+	if (!wait_for_completion_timeout(&done, m->i2c.timeout) &&
 	    hci->io->dequeue_xfer(hci, xfer, nxfers)) {
 		ret = -ETIME;
 		goto out;
-- 
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] 8+ messages in thread

* [PATCH 4/4] i3c: master: svc: use adapter timeout value for I2C transfers
  2025-06-04 10:18 [PATCH 0/4] i3c: use adapter timeout value for I2C transfers Wolfram Sang
                   ` (2 preceding siblings ...)
  2025-06-04 10:18 ` [PATCH 3/4] i3c: mipi-i3c-hci: " Wolfram Sang
@ 2025-06-04 10:18 ` Wolfram Sang
  2025-06-04 12:49   ` Miquel Raynal
  2025-06-04 14:53 ` [PATCH 0/4] i3c: " Frank Li
  2025-07-03 23:11 ` Alexandre Belloni
  5 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2025-06-04 10:18 UTC (permalink / raw)
  To: linux-i3c; +Cc: Wolfram Sang, Miquel Raynal, Frank Li, Alexandre Belloni, imx

I2C adapters have their own timeout value which can be changed by
userspace if desired. Use it for I2C transfers. The default is 1Hz, so
the default behaviour is unchanged.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i3c/master/svc-i3c-master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 7e1a7cb94b43..6d0eea80ea34 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -1708,7 +1708,7 @@ static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
 
 	mutex_lock(&master->lock);
 	svc_i3c_master_enqueue_xfer(master, xfer);
-	if (!wait_for_completion_timeout(&xfer->comp, msecs_to_jiffies(1000)))
+	if (!wait_for_completion_timeout(&xfer->comp, m->i2c.timeout))
 		svc_i3c_master_dequeue_xfer(master, xfer);
 	mutex_unlock(&master->lock);
 
-- 
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] 8+ messages in thread

* Re: [PATCH 4/4] i3c: master: svc: use adapter timeout value for I2C transfers
  2025-06-04 10:18 ` [PATCH 4/4] i3c: master: svc: " Wolfram Sang
@ 2025-06-04 12:49   ` Miquel Raynal
  0 siblings, 0 replies; 8+ messages in thread
From: Miquel Raynal @ 2025-06-04 12:49 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i3c, Frank Li, Alexandre Belloni, imx

Hello Wolfram,

On 04/06/2025 at 12:18:30 +02, Wolfram Sang <wsa+renesas@sang-engineering.com> wrote:

> I2C adapters have their own timeout value which can be changed by
> userspace if desired. Use it for I2C transfers. The default is 1Hz, so
> the default behaviour is unchanged.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks,
Miquèl

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

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

* Re: [PATCH 0/4] i3c: use adapter timeout value for I2C transfers
  2025-06-04 10:18 [PATCH 0/4] i3c: use adapter timeout value for I2C transfers Wolfram Sang
                   ` (3 preceding siblings ...)
  2025-06-04 10:18 ` [PATCH 4/4] i3c: master: svc: " Wolfram Sang
@ 2025-06-04 14:53 ` Frank Li
  2025-07-03 23:11 ` Alexandre Belloni
  5 siblings, 0 replies; 8+ messages in thread
From: Frank Li @ 2025-06-04 14:53 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i3c, Alexandre Belloni, imx, Miquel Raynal,
	Przemysław Gaj

On Wed, Jun 04, 2025 at 12:18:26PM +0200, Wolfram Sang wrote:
> All I3C adapters so far use a timeout of 1 second for I2C transfers. I2C
> adapters have their own timeout value which can be changed by userspace
> if desired. Use it for I2C transfers. The default is 1Hz, so the default
> behaviour is unchanged.
>
> Found while finalizing the RFC for the upcoming Renesas I3C driver.
> Looking forward to comments, tests...

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

>
> Wolfram Sang (4):
>   i3c: dw: use adapter timeout value for I2C transfers
>   i3c: master: cdns: use adapter timeout value for I2C transfers
>   i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers
>   i3c: master: svc: use adapter timeout value for I2C transfers
>
>  drivers/i3c/master/dw-i3c-master.c     | 2 +-
>  drivers/i3c/master/i3c-master-cdns.c   | 2 +-
>  drivers/i3c/master/mipi-i3c-hci/core.c | 2 +-
>  drivers/i3c/master/svc-i3c-master.c    | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>
> --
> 2.47.2
>

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

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

* Re: [PATCH 0/4] i3c: use adapter timeout value for I2C transfers
  2025-06-04 10:18 [PATCH 0/4] i3c: use adapter timeout value for I2C transfers Wolfram Sang
                   ` (4 preceding siblings ...)
  2025-06-04 14:53 ` [PATCH 0/4] i3c: " Frank Li
@ 2025-07-03 23:11 ` Alexandre Belloni
  5 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2025-07-03 23:11 UTC (permalink / raw)
  To: linux-i3c, Wolfram Sang; +Cc: Frank Li, imx, Miquel Raynal, Przemysław Gaj

On Wed, 04 Jun 2025 12:18:26 +0200, Wolfram Sang wrote:
> All I3C adapters so far use a timeout of 1 second for I2C transfers. I2C
> adapters have their own timeout value which can be changed by userspace
> if desired. Use it for I2C transfers. The default is 1Hz, so the default
> behaviour is unchanged.
> 
> Found while finalizing the RFC for the upcoming Renesas I3C driver.
> Looking forward to comments, tests...
> 
> [...]

Applied, thanks!

[1/4] i3c: dw: use adapter timeout value for I2C transfers
      https://git.kernel.org/abelloni/c/1b84691e7870
[2/4] i3c: master: cdns: use adapter timeout value for I2C transfers
      https://git.kernel.org/abelloni/c/be27ed672878
[3/4] i3c: mipi-i3c-hci: use adapter timeout value for I2C transfers
      https://git.kernel.org/abelloni/c/c0a90eb55a69
[4/4] i3c: master: svc: use adapter timeout value for I2C transfers
      https://git.kernel.org/abelloni/c/a747e01adad2

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

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

end of thread, other threads:[~2025-07-03 23:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04 10:18 [PATCH 0/4] i3c: use adapter timeout value for I2C transfers Wolfram Sang
2025-06-04 10:18 ` [PATCH 1/4] i3c: dw: " Wolfram Sang
2025-06-04 10:18 ` [PATCH 2/4] i3c: master: cdns: " Wolfram Sang
2025-06-04 10:18 ` [PATCH 3/4] i3c: mipi-i3c-hci: " Wolfram Sang
2025-06-04 10:18 ` [PATCH 4/4] i3c: master: svc: " Wolfram Sang
2025-06-04 12:49   ` Miquel Raynal
2025-06-04 14:53 ` [PATCH 0/4] i3c: " Frank Li
2025-07-03 23:11 ` Alexandre Belloni

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