]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i3c: master: Move entdaa error suppression
authorJorge Marques <jorge.marques@analog.com>
Mon, 23 Mar 2026 16:11:30 +0000 (17:11 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 12 Apr 2026 14:54:37 +0000 (16:54 +0200)
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>
drivers/i3c/master.c
drivers/i3c/master/adi-i3c-master.c
drivers/i3c/master/i3c-master-cdns.c

index fc2e91ea8e1cfda42919c4ac8d12798e68e21033..19e33d12c558299698509f1dd52713fb5485294f 100644 (file)
@@ -1077,6 +1077,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);
index 6616f751075ae296bf0c81b50a9182d042220ec5..fb9a488304469107690fb4febf470e43cc876bbf 100644 (file)
@@ -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 */
index b78aebf6b2ca4d42670e7bfdcc6647c0290afa0e..5cfec6761494dc681a9f2ebf9da153150caa2c24 100644 (file)
@@ -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;