Skip to content

Commit 42247ff

Browse files
gastmaieralexandrebelloni
authored andcommitted
i3c: master: Move entdaa error suppression
Prepare 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(). Reviewed-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Jorge Marques <jorge.marques@analog.com> Link: https://patch.msgid.link/20260323-ad4062-positive-error-fix-v3-2-30bdc68004be@analog.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 19a1b61 commit 42247ff

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/i3c/master.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,10 @@ int i3c_master_entdaa_locked(struct i3c_master_controller *master)
10771077
ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
10781078
i3c_ccc_cmd_dest_cleanup(&dest);
10791079

1080+
/* No active devices need an address. */
1081+
if (ret && cmd.err == I3C_ERROR_M2)
1082+
ret = 0;
1083+
10801084
return ret;
10811085
}
10821086
EXPORT_SYMBOL_GPL(i3c_master_entdaa_locked);

drivers/i3c/master/adi-i3c-master.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,7 @@ static int adi_i3c_master_do_daa(struct i3c_master_controller *m)
655655

656656
writel(irq_mask, master->regs + REG_IRQ_MASK);
657657

658-
/* DAA always finishes with CE2_ERROR or NACK_RESP */
659-
if (ret && ret != I3C_ERROR_M2)
658+
if (ret)
660659
return ret;
661660

662661
/* Add I3C devices discovered */

drivers/i3c/master/i3c-master-cdns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ static int cdns_i3c_master_do_daa(struct i3c_master_controller *m)
11431143
}
11441144

11451145
ret = i3c_master_entdaa_locked(&master->base);
1146-
if (ret && ret != I3C_ERROR_M2)
1146+
if (ret)
11471147
return ret;
11481148

11491149
newdevs = readl(master->regs + DEVS_CTRL) & DEVS_CTRL_DEVS_ACTIVE_MASK;

0 commit comments

Comments
 (0)