Re: [PATCH v2 2/5] i3c: master: Move entdaa error suppression
From: Frank Li
Date: Wed Mar 18 2026 - 10:29:44 EST
On Thu, Mar 12, 2026 at 05:38:05PM +0100, Jorge Marques wrote:
> Prepares to fix improper Mx positive error propagation in later commits
> by handling Mx error codes where the i3c_ccc_cmd command is allocated.
> The CCC ENTDAA is invoked with i3c_master_entdaa_locked() and yields
> error I3C_ERROR_M2 if there are no devices active on the bus. Some
> controllers may also yield if there are no more devices need an dynamic
> address, since the sequence do always end in a NACK. Handle inside
> i3c_master_entdaa_locked(), checking cmd->err directly. Both call sites
> are updated, adi_i3c_master_do_daa() and cdns_i3c_master_do_daa().
>
> Signed-off-by: Jorge Marques <jorge.marques@xxxxxxxxxx>
> ---
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
> drivers/i3c/master.c | 4 ++++
> drivers/i3c/master/adi-i3c-master.c | 3 +--
> drivers/i3c/master/i3c-master-cdns.c | 2 +-
> 3 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index c66f2655eb404..d4f9e7df4adc5 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -1050,6 +1050,10 @@ int i3c_master_entdaa_locked(struct i3c_master_controller *master)
> ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
> i3c_ccc_cmd_dest_cleanup(&dest);
>
> + /* No active devices need an address. */
> + if (ret && cmd.err == I3C_ERROR_M2)
> + ret = 0;
> +
> return ret;
> }
> EXPORT_SYMBOL_GPL(i3c_master_entdaa_locked);
> diff --git a/drivers/i3c/master/adi-i3c-master.c b/drivers/i3c/master/adi-i3c-master.c
> index 6616f751075ae..fb9a488304469 100644
> --- a/drivers/i3c/master/adi-i3c-master.c
> +++ b/drivers/i3c/master/adi-i3c-master.c
> @@ -655,8 +655,7 @@ static int adi_i3c_master_do_daa(struct i3c_master_controller *m)
>
> writel(irq_mask, master->regs + REG_IRQ_MASK);
>
> - /* DAA always finishes with CE2_ERROR or NACK_RESP */
> - if (ret && ret != I3C_ERROR_M2)
> + if (ret)
> return ret;
>
> /* Add I3C devices discovered */
> diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-master-cdns.c
> index b78aebf6b2ca4..5cfec6761494d 100644
> --- a/drivers/i3c/master/i3c-master-cdns.c
> +++ b/drivers/i3c/master/i3c-master-cdns.c
> @@ -1143,7 +1143,7 @@ static int cdns_i3c_master_do_daa(struct i3c_master_controller *m)
> }
>
> ret = i3c_master_entdaa_locked(&master->base);
> - if (ret && ret != I3C_ERROR_M2)
> + if (ret)
> return ret;
>
> newdevs = readl(master->regs + DEVS_CTRL) & DEVS_CTRL_DEVS_ACTIVE_MASK;
>
> --
> 2.51.1
>