Re: [PATCH] i3c: master: svc: report timeout waiting for STOP idle

From: Frank Li

Date: Tue Jun 23 2026 - 10:24:00 EST


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@xxxxxxxxxxx>
> ---

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@xxxxxxx>

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