[PATCH V2 07/17] i3c: mipi-i3c-hci: Send DISEC before disabling IBIs in hardware
From: Adrian Hunter
Date: Thu Sep 17 2026 - 15:55:48 EST
Reorder i3c_hci_disable_ibi() so that DISEC is sent before IBIs are
disabled at the controller.
This matches the sequence used by other I3C controller drivers. It also
avoids dropping an IBI that races with the disable operation: an IBI
received after DISEC is issued but before the controller disables IBIs
can still be processed normally. Once DISEC has been sent, the hardware
can be updated to NACK subsequent IBIs and complete the teardown.
No functional change is intended beyond aligning the ordering with other
drivers and handling the race window consistently.
Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Reviewed-by: Frank Li <Frank.Li@xxxxxxx>
---
Changes in V2:
Added Frank Li's Reviewed-by tag.
drivers/i3c/master/mipi-i3c-hci/core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c
index 166d9f70f435..f6a34ce7a295 100644
--- a/drivers/i3c/master/mipi-i3c-hci/core.c
+++ b/drivers/i3c/master/mipi-i3c-hci/core.c
@@ -719,13 +719,14 @@ static int i3c_hci_disable_ibi(struct i3c_dev_desc *dev)
struct i3c_master_controller *m = i3c_dev_get_master(dev);
struct i3c_hci *hci = to_i3c_hci(m);
- __i3c_hci_disable_ibi(hci, dev);
/*
- * The DAT entry is now set to NACK and DISEC this target's IBIs, so
+ * The DAT entry will be set to NACK and DISEC this target's IBIs, so
* the IBI teardown can proceed even if DISEC below fails, so ignore
* errors.
*/
i3c_master_disec_locked(m, dev->info.dyn_addr, I3C_CCC_EVENT_SIR);
+
+ __i3c_hci_disable_ibi(hci, dev);
return 0;
}
--
2.53.0