* [PATCH v2] i3c: dw: reduce do_daa time if there's no client
@ 2026-08-14 4:20 ` Jisheng Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2026-08-14 4:20 UTC (permalink / raw)
To: Alexandre Belloni, Frank Li; +Cc: linux-i3c, linux-kernel
dw_i3c_master_daa() derives the number of newly assigned dynamic
addresses from cmd->rx_len, the ISR sets it to the number of address
slots ENTDAA left unassigned. It starts out as zero, which already
means "every address was assigned", so a timed out transfer leaves
that value in place and it gets used as a result.
If there's no client connected, the addr assign cmd times out, then
the driver calls i3c_master_add_i3c_dev_locked() to add devices that
are not there, each costing about 1s, thus adds non necessary boot
time up to (maxdev * 1)s.
Start from maxdevs instead: no address is assigned before ENTDAA runs,
and make newdevs as 0 if the existing rx_len >= maxdevs.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
since v1:
- use another method to remove the non-necessary calling of
i3c_master_add_i3c_dev_locked() if there's no client
- update commit msg
drivers/i3c/master/dw-i3c-master.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 1053cfb05c05..883b542c7bfc 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -876,6 +876,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
goto rpm_out;
}
cmd = &xfer->cmds[0];
+ cmd->rx_len = master->maxdevs;
cmd->cmd_hi = COMMAND_PORT_TRANSFER_ARG;
cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |
COMMAND_PORT_DEV_INDEX(pos) |
@@ -888,7 +889,10 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
dw_i3c_master_dequeue_xfer(master, xfer);
- newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
+ if (cmd->rx_len >= master->maxdevs)
+ newdevs = 0;
+ else
+ newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
newdevs &= ~olddevs;
for (pos = 0; pos < master->maxdevs; pos++) {
--
2.51.0
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] i3c: dw: reduce do_daa time if there's no client
@ 2026-08-14 4:20 ` Jisheng Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Jisheng Zhang @ 2026-08-14 4:20 UTC (permalink / raw)
To: Alexandre Belloni, Frank Li; +Cc: linux-i3c, linux-kernel
dw_i3c_master_daa() derives the number of newly assigned dynamic
addresses from cmd->rx_len, the ISR sets it to the number of address
slots ENTDAA left unassigned. It starts out as zero, which already
means "every address was assigned", so a timed out transfer leaves
that value in place and it gets used as a result.
If there's no client connected, the addr assign cmd times out, then
the driver calls i3c_master_add_i3c_dev_locked() to add devices that
are not there, each costing about 1s, thus adds non necessary boot
time up to (maxdev * 1)s.
Start from maxdevs instead: no address is assigned before ENTDAA runs,
and make newdevs as 0 if the existing rx_len >= maxdevs.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
since v1:
- use another method to remove the non-necessary calling of
i3c_master_add_i3c_dev_locked() if there's no client
- update commit msg
drivers/i3c/master/dw-i3c-master.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 1053cfb05c05..883b542c7bfc 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -876,6 +876,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
goto rpm_out;
}
cmd = &xfer->cmds[0];
+ cmd->rx_len = master->maxdevs;
cmd->cmd_hi = COMMAND_PORT_TRANSFER_ARG;
cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |
COMMAND_PORT_DEV_INDEX(pos) |
@@ -888,7 +889,10 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
dw_i3c_master_dequeue_xfer(master, xfer);
- newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
+ if (cmd->rx_len >= master->maxdevs)
+ newdevs = 0;
+ else
+ newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
newdevs &= ~olddevs;
for (pos = 0; pos < master->maxdevs; pos++) {
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] i3c: dw: reduce do_daa time if there's no client
2026-08-14 4:20 ` Jisheng Zhang
@ 2026-08-14 16:38 ` Frank Li
-1 siblings, 0 replies; 6+ messages in thread
From: Frank Li @ 2026-08-14 16:38 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: Alexandre Belloni, Frank Li, linux-i3c, linux-kernel
On Fri, Aug 14, 2026 at 12:20:15PM +0800, Jisheng Zhang wrote:
> dw_i3c_master_daa() derives the number of newly assigned dynamic
> addresses from cmd->rx_len, the ISR sets it to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already
> means "every address was assigned", so a timed out transfer leaves
> that value in place and it gets used as a result.
>
> If there's no client connected, the addr assign cmd times out, then
> the driver calls i3c_master_add_i3c_dev_locked() to add devices that
> are not there, each costing about 1s, thus adds non necessary boot
> time up to (maxdev * 1)s.
>
> Start from maxdevs instead: no address is assigned before ENTDAA runs,
> and make newdevs as 0 if the existing rx_len >= maxdevs.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> since v1:
> - use another method to remove the non-necessary calling of
> i3c_master_add_i3c_dev_locked() if there's no client
> - update commit msg
>
> drivers/i3c/master/dw-i3c-master.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 1053cfb05c05..883b542c7bfc 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -876,6 +876,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> goto rpm_out;
> }
> cmd = &xfer->cmds[0];
> + cmd->rx_len = master->maxdevs;
> cmd->cmd_hi = COMMAND_PORT_TRANSFER_ARG;
> cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |
> COMMAND_PORT_DEV_INDEX(pos) |
> @@ -888,7 +889,10 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
> dw_i3c_master_dequeue_xfer(master, xfer);
>
> - newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> + if (cmd->rx_len >= master->maxdevs)
> + newdevs = 0;
> + else
> + newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> newdevs &= ~olddevs;
>
> for (pos = 0; pos < master->maxdevs; pos++) {
> --
> 2.51.0
>
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] i3c: dw: reduce do_daa time if there's no client
@ 2026-08-14 16:38 ` Frank Li
0 siblings, 0 replies; 6+ messages in thread
From: Frank Li @ 2026-08-14 16:38 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: Alexandre Belloni, Frank Li, linux-i3c, linux-kernel
On Fri, Aug 14, 2026 at 12:20:15PM +0800, Jisheng Zhang wrote:
> dw_i3c_master_daa() derives the number of newly assigned dynamic
> addresses from cmd->rx_len, the ISR sets it to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already
> means "every address was assigned", so a timed out transfer leaves
> that value in place and it gets used as a result.
>
> If there's no client connected, the addr assign cmd times out, then
> the driver calls i3c_master_add_i3c_dev_locked() to add devices that
> are not there, each costing about 1s, thus adds non necessary boot
> time up to (maxdev * 1)s.
>
> Start from maxdevs instead: no address is assigned before ENTDAA runs,
> and make newdevs as 0 if the existing rx_len >= maxdevs.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> since v1:
> - use another method to remove the non-necessary calling of
> i3c_master_add_i3c_dev_locked() if there's no client
> - update commit msg
>
> drivers/i3c/master/dw-i3c-master.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 1053cfb05c05..883b542c7bfc 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -876,6 +876,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> goto rpm_out;
> }
> cmd = &xfer->cmds[0];
> + cmd->rx_len = master->maxdevs;
> cmd->cmd_hi = COMMAND_PORT_TRANSFER_ARG;
> cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |
> COMMAND_PORT_DEV_INDEX(pos) |
> @@ -888,7 +889,10 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
> dw_i3c_master_dequeue_xfer(master, xfer);
>
> - newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> + if (cmd->rx_len >= master->maxdevs)
> + newdevs = 0;
> + else
> + newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> newdevs &= ~olddevs;
>
> for (pos = 0; pos < master->maxdevs; pos++) {
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] i3c: dw: reduce do_daa time if there's no client
2026-08-14 4:20 ` Jisheng Zhang
@ 2026-08-18 21:18 ` Alexandre Belloni
-1 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2026-08-18 21:18 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: Frank Li, linux-i3c, linux-kernel
Hi Jisheng,
On 14/08/2026 12:20:15+0800, Jisheng Zhang wrote:
> dw_i3c_master_daa() derives the number of newly assigned dynamic
> addresses from cmd->rx_len, the ISR sets it to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already
> means "every address was assigned", so a timed out transfer leaves
> that value in place and it gets used as a result.
>
> If there's no client connected, the addr assign cmd times out, then
> the driver calls i3c_master_add_i3c_dev_locked() to add devices that
> are not there, each costing about 1s, thus adds non necessary boot
> time up to (maxdev * 1)s.
>
> Start from maxdevs instead: no address is assigned before ENTDAA runs,
> and make newdevs as 0 if the existing rx_len >= maxdevs.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>
> since v1:
> - use another method to remove the non-necessary calling of
> i3c_master_add_i3c_dev_locked() if there's no client
> - update commit msg
>
> drivers/i3c/master/dw-i3c-master.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
You'd have to rebase this one on i3c/next as it doesn't apply cleanly
anymore.
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 1053cfb05c05..883b542c7bfc 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -876,6 +876,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> goto rpm_out;
> }
> cmd = &xfer->cmds[0];
> + cmd->rx_len = master->maxdevs;
> cmd->cmd_hi = COMMAND_PORT_TRANSFER_ARG;
> cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |
> COMMAND_PORT_DEV_INDEX(pos) |
> @@ -888,7 +889,10 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
> dw_i3c_master_dequeue_xfer(master, xfer);
>
> - newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> + if (cmd->rx_len >= master->maxdevs)
> + newdevs = 0;
> + else
> + newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> newdevs &= ~olddevs;
>
> for (pos = 0; pos < master->maxdevs; pos++) {
> --
> 2.51.0
>
--
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] 6+ messages in thread
* Re: [PATCH v2] i3c: dw: reduce do_daa time if there's no client
@ 2026-08-18 21:18 ` Alexandre Belloni
0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2026-08-18 21:18 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: Frank Li, linux-i3c, linux-kernel
Hi Jisheng,
On 14/08/2026 12:20:15+0800, Jisheng Zhang wrote:
> dw_i3c_master_daa() derives the number of newly assigned dynamic
> addresses from cmd->rx_len, the ISR sets it to the number of address
> slots ENTDAA left unassigned. It starts out as zero, which already
> means "every address was assigned", so a timed out transfer leaves
> that value in place and it gets used as a result.
>
> If there's no client connected, the addr assign cmd times out, then
> the driver calls i3c_master_add_i3c_dev_locked() to add devices that
> are not there, each costing about 1s, thus adds non necessary boot
> time up to (maxdev * 1)s.
>
> Start from maxdevs instead: no address is assigned before ENTDAA runs,
> and make newdevs as 0 if the existing rx_len >= maxdevs.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>
> since v1:
> - use another method to remove the non-necessary calling of
> i3c_master_add_i3c_dev_locked() if there's no client
> - update commit msg
>
> drivers/i3c/master/dw-i3c-master.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
You'd have to rebase this one on i3c/next as it doesn't apply cleanly
anymore.
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 1053cfb05c05..883b542c7bfc 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -876,6 +876,7 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> goto rpm_out;
> }
> cmd = &xfer->cmds[0];
> + cmd->rx_len = master->maxdevs;
> cmd->cmd_hi = COMMAND_PORT_TRANSFER_ARG;
> cmd->cmd_lo = COMMAND_PORT_DEV_COUNT(master->maxdevs - pos) |
> COMMAND_PORT_DEV_INDEX(pos) |
> @@ -888,7 +889,10 @@ static int dw_i3c_master_daa(struct i3c_master_controller *m)
> if (!wait_for_completion_timeout(&xfer->comp, XFER_TIMEOUT))
> dw_i3c_master_dequeue_xfer(master, xfer);
>
> - newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> + if (cmd->rx_len >= master->maxdevs)
> + newdevs = 0;
> + else
> + newdevs = GENMASK(master->maxdevs - cmd->rx_len - 1, 0);
> newdevs &= ~olddevs;
>
> for (pos = 0; pos < master->maxdevs; pos++) {
> --
> 2.51.0
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-18 21:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 4:20 [PATCH v2] i3c: dw: reduce do_daa time if there's no client Jisheng Zhang
2026-08-14 4:20 ` Jisheng Zhang
2026-08-14 16:38 ` Frank Li
2026-08-14 16:38 ` Frank Li
2026-08-18 21:18 ` Alexandre Belloni
2026-08-18 21:18 ` Alexandre Belloni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.