Skip to contentSkip to conversation

Fallback mechanism for GETMXDS CCC

PATCH Applied Joshua Yeong 3 participants 4 messages Nov 14, 2023 – Nov 16, 2023 I3C

lore
Share & tools
lore
#0 lore raw

v3 cover Fallback mechanism for GETMXDS CCC

Some I3C hardware does not support turnaround time in GETMXDS. Cadence IPs will perform validation against length of CCC returned. Similar hardware error were not seen in other IPs DW/SVC.

Joshua Yeong (1):
i3c: Add fallback method for GETMXDS CCC

 drivers/i3c/master.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

--
2.25.1

#1 lore raw

PATCH v3 1/1 i3c: Add fallback method for GETMXDS CCC

Some I3C hardware will report error when an incorrect length is received from device. GETMXDS CCC are available in 2 formats: without turnaround time (format
1) and with turnaround time (format 2). There is no mechanics to determine which format is supported by device. So in case sending GETMXDS CCC format 2 resulted in a failure, try sending GETMXDS CCC format 1 instead.

---
 drivers/i3c/master.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/i3c/master.c +10 -2
index 95caa162706f..718b643cb54d 100644
@@ -1130,8 +1130,16 @@ static int i3c_master_getmxds_locked(struct i3c_master_controller *master,
 
 	i3c_ccc_cmd_init(&cmd, true, I3C_CCC_GETMXDS, &dest, 1);
 	ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
-	if (ret)
-		goto out;
+	if (ret) {
+		/*
+		 * Retry when the device does not support max read turnaround
+		 * while expecting shorter length from this CCC command.
+		 */
+		dest->payload.len -= 3;
+		ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
+		if (ret)
+			goto out;
+	}
 
 	if (dest.payload.len != 2 && dest.payload.len != 5) {
 		ret = -EIO;
Signature · 1 line
2.25.1
Reviewed-by on v3 1/1
#2 lore raw

Re: [PATCH v3 1/1] i3c: Add fallback method for GETMXDS CCC

Hi Joshua,

[email protected] wrote on Tue, 14 Nov 2023 16:55:25 +0800:

Quoted 6 lines

Some I3C hardware will report error when an incorrect length is received from device. GETMXDS CCC are available in 2 formats: without turnaround time (format
1) and with turnaround time (format 2). There is no mechanics to determine which format is supported by device. So in case sending GETMXDS CCC format 2 resulted in a failure, try sending GETMXDS CCC format 1 instead.

Quoted 2 lines

---

Thanks,
Miquèl

maintainer Applied
#3 lore raw
In reply to Joshua Yeong
Quoted 8 lines · Joshua Yeong

Some I3C hardware does not support turnaround time in GETMXDS. Cadence IPs will perform validation against length of CCC returned. Similar hardware error were not seen in other IPs DW/SVC.

Joshua Yeong (1):
i3c: Add fallback method for GETMXDS CCC

[...]

Applied, thanks!

[1/1] i3c: Add fallback method for GETMXDS CCC

      commit: 2aac0bf4ebc8e09941bb2a40c0ce725437d9a82c

Best regards,

Signature · 8 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-- 
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c