[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250819090831.3009647-1-yschu@nuvoton.com>
Date: Tue, 19 Aug 2025 17:08:31 +0800
From: Stanley Chu <stanley.chuys@...il.com>
To: frank.li@....com,
miquel.raynal@...tlin.com,
alexandre.belloni@...tlin.com,
linux-i3c@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org,
tomer.maimon@...oton.com,
kwliu@...oton.com,
yschu@...oton.com
Subject: [PATCH v1] i3c: master: svc: Use manual response for IBI events
From: Stanley Chu <yschu@...oton.com>
Using IBIRESP_AUTO causes the hardware to ACK IBI requests even when the
target is not in the device list. The svc_i3c_master_nack_ibi() has no
effect in such case.
AutoIBI has another issue that the controller doesn't quit AutoIBI state
after an IBIWON polling timeout. The following sequence is the case:
1. Target pulls SDA low
2. SLVSTART interrupt triggers the IBI ISR
3. Target releases SDA
4. Driver writes AutoIBI request to MCTRL
5. SDA is high, so AutoIBI process does not start
6. IBIWON polling times out
7. Controller state is AutoIBI and doesn't accept EmitStop request
Emitting broadcast address with IBIRESP_MANUAL avoids both issues.
Signed-off-by: Stanley Chu <yschu@...oton.com>
---
drivers/i3c/master/svc-i3c-master.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 701ae165b25b..17644e041b44 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -517,9 +517,10 @@ static void svc_i3c_master_ibi_isr(struct svc_i3c_master *master)
*/
writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS);
- /* Acknowledge the incoming interrupt with the AUTOIBI mechanism */
- writel(SVC_I3C_MCTRL_REQUEST_AUTO_IBI |
- SVC_I3C_MCTRL_IBIRESP_AUTO,
+ /* Emit broadcast address for arbitration */
+ writel(SVC_I3C_MCTRL_REQUEST_START_ADDR |
+ SVC_I3C_MCTRL_IBIRESP_MANUAL |
+ SVC_I3C_MCTRL_ADDR(I3C_BROADCAST_ADDR),
master->regs + SVC_I3C_MCTRL);
/* Wait for IBIWON, should take approximately 100us */
@@ -539,10 +540,15 @@ static void svc_i3c_master_ibi_isr(struct svc_i3c_master *master)
switch (ibitype) {
case SVC_I3C_MSTATUS_IBITYPE_IBI:
dev = svc_i3c_master_dev_from_addr(master, ibiaddr);
- if (!dev || !is_events_enabled(master, SVC_I3C_EVENT_IBI))
+ if (!dev || !is_events_enabled(master, SVC_I3C_EVENT_IBI)) {
svc_i3c_master_nack_ibi(master);
- else
+ } else {
+ if (dev->info.bcr & I3C_BCR_IBI_PAYLOAD)
+ svc_i3c_master_ack_ibi(master, true);
+ else
+ svc_i3c_master_ack_ibi(master, false);
svc_i3c_master_handle_ibi(master, dev);
+ }
break;
case SVC_I3C_MSTATUS_IBITYPE_HOT_JOIN:
if (is_events_enabled(master, SVC_I3C_EVENT_HOTJOIN))
--
2.34.1
Powered by blists - more mailing lists