* [PATCH] i3c: master: svc: report timeout waiting for STOP idle
@ 2026-06-23 6:08 Pengpeng Hou
2026-06-23 9:16 ` Miquel Raynal
2026-06-23 14:23 ` Frank Li
0 siblings, 2 replies; 3+ messages in thread
From: Pengpeng Hou @ 2026-06-23 6:08 UTC (permalink / raw)
To: Miquel Raynal, Frank Li, Alexandre Belloni, linux-i3c, imx,
linux-kernel
Cc: Pengpeng Hou
svc_i3c_master_xfer() emits STOP or force-exit for the final transfer
and then waits for the controller state to become idle, but ignores
readl_poll_timeout(). The function can therefore return success while
the controller is still not idle.
Return the idle-wait error through the existing warning/FIFO cleanup
path so the caller observes the failed transfer without emitting a
second STOP after the final STOP or force-exit has already been sent.
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
drivers/i3c/master/svc-i3c-master.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 93805df8a940..93ae6eb1a355 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -1488,8 +1488,11 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
svc_i3c_master_emit_force_exit(master);
/* Wait idle if stop is sent. */
- readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
- SVC_I3C_MSTATUS_STATE_IDLE(reg), 0, 1000);
+ ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
+ SVC_I3C_MSTATUS_STATE_IDLE(reg),
+ 0, 1000);
+ if (ret)
+ goto cleanup;
}
return 0;
@@ -1502,6 +1505,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
else
svc_i3c_master_emit_force_exit(master);
+cleanup:
svc_i3c_master_clear_merrwarn(master);
svc_i3c_master_flush_fifo(master);
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i3c: master: svc: report timeout waiting for STOP idle
2026-06-23 6:08 [PATCH] i3c: master: svc: report timeout waiting for STOP idle Pengpeng Hou
@ 2026-06-23 9:16 ` Miquel Raynal
2026-06-23 14:23 ` Frank Li
1 sibling, 0 replies; 3+ messages in thread
From: Miquel Raynal @ 2026-06-23 9:16 UTC (permalink / raw)
To: Pengpeng Hou; +Cc: Frank Li, Alexandre Belloni, linux-i3c, imx, linux-kernel
Hello,
On 23/06/2026 at 14:08:21 +08, Pengpeng Hou <pengpeng@iscas.ac.cn> wrote:
> svc_i3c_master_xfer() emits STOP or force-exit for the final transfer
> and then waits for the controller state to become idle, but ignores
> readl_poll_timeout(). The function can therefore return success while
> the controller is still not idle.
>
> Return the idle-wait error through the existing warning/FIFO cleanup
> path so the caller observes the failed transfer without emitting a
> second STOP after the final STOP or force-exit has already been sent.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i3c: master: svc: report timeout waiting for STOP idle
2026-06-23 6:08 [PATCH] i3c: master: svc: report timeout waiting for STOP idle Pengpeng Hou
2026-06-23 9:16 ` Miquel Raynal
@ 2026-06-23 14:23 ` Frank Li
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2026-06-23 14:23 UTC (permalink / raw)
To: Pengpeng Hou
Cc: Miquel Raynal, Frank Li, Alexandre Belloni, linux-i3c, imx,
linux-kernel
On Tue, Jun 23, 2026 at 02:08:21PM +0800, Pengpeng Hou wrote:
>
> svc_i3c_master_xfer() emits STOP or force-exit for the final transfer
> and then waits for the controller state to become idle, but ignores
> readl_poll_timeout(). The function can therefore return success while
> the controller is still not idle.
>
> Return the idle-wait error through the existing warning/FIFO cleanup
> path so the caller observes the failed transfer without emitting a
> second STOP after the final STOP or force-exit has already been sent.
>
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
Dose you really met timeout? if yes, what step to reproduce it. Suppose
only few FCLK to emit STOP or force-exit unconditional.
Any way not harmful to add check it.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/i3c/master/svc-i3c-master.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index 93805df8a940..93ae6eb1a355 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -1488,8 +1488,11 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
> svc_i3c_master_emit_force_exit(master);
>
> /* Wait idle if stop is sent. */
> - readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
> - SVC_I3C_MSTATUS_STATE_IDLE(reg), 0, 1000);
> + ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
> + SVC_I3C_MSTATUS_STATE_IDLE(reg),
> + 0, 1000);
> + if (ret)
> + goto cleanup;
> }
>
> return 0;
> @@ -1502,6 +1505,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
> else
> svc_i3c_master_emit_force_exit(master);
>
> +cleanup:
> svc_i3c_master_clear_merrwarn(master);
> svc_i3c_master_flush_fifo(master);
>
> --
> 2.50.1 (Apple Git-155)
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-23 14:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 6:08 [PATCH] i3c: master: svc: report timeout waiting for STOP idle Pengpeng Hou
2026-06-23 9:16 ` Miquel Raynal
2026-06-23 14:23 ` Frank Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox