Skip to contentSkip to conversation

i3c: master: svc: skip address resend on repeat START

PATCH Superseded Frank Li 2 participants 2 messages Apr 16, 2025 – Apr 23, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Frank Li

author maintainer
#0 lore raw

PATCH 1/1 i3c: master: svc: skip address resend on repeat START

According to the I3C specification, address arbitration only happens during the START. Repeated START do not initiate arbitration, and In-Band Interrupts (IBIs) cannot occur at this stage.

Resending the address upon a NACK in a repeat START is therefore redundant and unnecessary. Avoid redundant retries, improving efficiency and ensuring protocol compliance.

---
 drivers/i3c/master/svc-i3c-master.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i3c/master/svc-i3c-master.c +3 -3
index 85e16de208d3b..5212c2cc6855f 100644
@@ -1281,9 +1281,9 @@ static int svc_i3c_master_write(struct svc_i3c_master *master,
 static int svc_i3c_master_xfer(struct svc_i3c_master *master,
 			       bool rnw, unsigned int xfer_type, u8 addr,
 			       u8 *in, const u8 *out, unsigned int xfer_len,
-			       unsigned int *actual_len, bool continued)
+			       unsigned int *actual_len, bool continued, bool repeat_start)
 {
-	int retry = 2;
+	int retry = repeat_start ? 1 : 2;
 	u32 reg;
 	int ret;
 
@@ -1468,7 +1468,7 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master)
 		ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type,
 					  cmd->addr, cmd->in, cmd->out,
 					  cmd->len, &cmd->actual_len,
-					  cmd->continued);
+					  cmd->continued, !!i);
 		/* cmd->xfer is NULL if I2C or CCC transfer */
 		if (cmd->xfer)
 			cmd->xfer->actual_len = cmd->actual_len;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 30 lines · Frank Li

According to the I3C specification, address arbitration only happens during the START. Repeated START do not initiate arbitration, and In-Band Interrupts (IBIs) cannot occur at this stage.

Resending the address upon a NACK in a repeat START is therefore redundant and unnecessary. Avoid redundant retries, improving efficiency and ensuring protocol compliance.

---
 drivers/i3c/master/svc-i3c-master.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i3c/master/svc-i3c-master.c +2 -2
index 85e16de208d3b..5212c2cc6855f 100644
@@ -1281,9 +1281,9 @@ static int svc_i3c_master_write(struct svc_i3c_master *master,
 static int svc_i3c_master_xfer(struct svc_i3c_master *master,
 			       bool rnw, unsigned int xfer_type, u8 addr,
 			       u8 *in, const u8 *out, unsigned int xfer_len,
-			       unsigned int *actual_len, bool continued)
+			       unsigned int *actual_len, bool continued, bool repeat_start)
 {
-	int retry = 2;
+	int retry = repeat_start ? 1 : 2;
 	u32 reg;
 	int ret;
 

drivers/i3c/master/svc-i3c-master.c static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) · line 1471

Quoted 5 lines
drivers/i3c/master/svc-i3c-master.c +1 -1
@@ -1468,7 +1468,7 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master)
 		ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type,
 					  cmd->addr, cmd->in, cmd->out,
 					  cmd->len, &cmd->actual_len,
-					  cmd->continued);
+					  cmd->continued, !!i);

Could we just pass 'i' here? Or maybe 'i > 0' which might be even clearer.

drivers/i3c/master/svc-i3c-master.c static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master) · line 1474

Quoted 3 lines
drivers/i3c/master/svc-i3c-master.c +0 -0
 		/* cmd->xfer is NULL if I2C or CCC transfer */
 		if (cmd->xfer)
 			cmd->xfer->actual_len = cmd->actual_len;

Thanks,
Miquèl