Fallback mechanism for GETMXDS CCC
v2 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
PATCH v2 1/1 i3c: Add fallback method for GETMXDS CCC
Some I3C hardware will report error when incorrect length is received from device. GETMXDS CCC are availble 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. In case sending GETMXDS CCC format 2 resulted 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
@@ -1099,8 +1099,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
Re: [PATCH v2 1/1] i3c: Add fallback method for GETMXDS CCC
Hi Joshua,
[email protected] wrote on Tue, 14 Nov 2023 11:34:30 +0800:
Quoted 1 line
Some I3C hardware will report error when incorrect length is received from
an
Quoted 1 line
device. GETMXDS CCC are availble in 2 formats; without turnaround time (format
available :
Quoted 2 lines
1) and with turnaround time (format 2). There is no mechanics to determine which format is supported by device. In case sending GETMXDS CCC format 2 resulted
So in case?
Quoted 1 line
failure, try sending GETMXDS CCC format 1 instead.
in a
Quoted 11 lines
Signed-off-by Joshua Yeong <[email protected]>--- drivers/i3c/master.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/i3c/master.c +0
-0
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1103
Quoted 7 lines
drivers/i3c/master.c +2
-2@@ -1099,8 +1099,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) { +/*
^
Wrong alignment of the starts below
v
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1105
Quoted 2 lines
drivers/i3c/master.c +2
-0+* Retry when the device does not support max read turnaround +* while expecting shorter length from this CCC command
period?
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1111
Quoted 6 lines
drivers/i3c/master.c +6
-0+*/ + dest->payload.len -=3 ; + ret =i3c_master_send_ccc_cmd_locked (master, &cmd); +if (ret) + goto out; + }
I believe this is a per-device configuration and we should save this in order to only fail once, no?
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1114
Quoted 3 lines
drivers/i3c/master.c +0
-0if (dest.payload.len !=2 && dest.payload.len !=5 ) { ret = -EIO ;
Thanks,
Miquèl
Re: [PATCH v2 1/1] i3c: Add fallback method for GETMXDS CCC
Hi Miquel,
Quoted 41 lines · Miquel Raynal
Hi Joshua,
[email protected] wrote on Tue, 14 Nov 2023 11:34:30 +0800:
Quoted 1 line
Some I3C hardware will report error when incorrect length is received from
an
Quoted 1 line
device. GETMXDS CCC are availble in 2 formats; without turnaround time (format
available :
Quoted 2 lines
1) and with turnaround time (format 2). There is no mechanics to determine which format is supported by device. In case sending GETMXDS CCC format 2 resulted
So in case?
Quoted 1 line
failure, try sending GETMXDS CCC format 1 instead.
in a
Quoted 10 lines
Signed-off-by Joshua Yeong <[email protected]>--- drivers/i3c/master.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/i3c/master.c +0
-0drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1103
Quoted 7 lines
drivers/i3c/master.c +2
-2@@ -1099,8 +1099,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) { +/* ^Wrong alignment of the starts below
vdrivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1105
Quoted 2 lines
drivers/i3c/master.c +2
-0+* Retry when the device does not support max read turnaround +* while expecting shorter length from this CCC command period?
Quoted 8 lines
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1111
Quoted 6 lines
drivers/i3c/master.c +6
-0+*/ + dest->payload.len -=3 ; + ret =i3c_master_send_ccc_cmd_locked (master, &cmd); +if (ret) + goto out; + }I believe this is a per-device configuration and we should save this in order to only fail once, no?
This behavior depends on the hardware designed whether it will return an error in case of shorter length from i3c devices in dest->payload.len. I made it so it will retry by expecting a shorter length instead, in case it still fails then it means GETMXDS CCC really failed.
We do not have to initialize the same hardware twice and do GETMXDS CCC more than once as far as I know?
Quoted 8 lines
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1114
Quoted 4 lines
drivers/i3c/master.c +0
-0if (dest.payload.len !=2 && dest.payload.len !=5 ) { ret = -EIO ;Thanks,
Miquèl
Re: [PATCH v2 1/1] i3c: Add fallback method for GETMXDS CCC
Hi Joshua,
[email protected] wrote on Tue, 14 Nov 2023 16:42:44 +0800:
Quoted 56 lines
Hi Miquel,
Quoted 8 lines · Miquel Raynal
Hi Joshua,
[email protected] wrote on Tue, 14 Nov 2023 11:34:30 +0800:
Quoted 1 line
Some I3C hardware will report error when incorrect length is received from
an
Quoted 1 line
device. GETMXDS CCC are availble in 2 formats; without turnaround time
(format
Quoted 3 lines
available :
Quoted 1 line
1) and with turnaround time (format 2). There is no mechanics to deter
mine which
Quoted 1 line
Quoted 1 line
format is supported by device. In case sending GETMXDS CCC format 2 re
sulted
Quoted 10 lines
So in case?
Quoted 1 line
failure, try sending GETMXDS CCC format 1 instead.
in a
Quoted 5 lines
Signed-off-by Joshua Yeong <[email protected]>--- drivers/i3c/master.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)Quoted 5 lines
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c
Quoted 5 lines
drivers/i3c/master.c +0
-0@@ -1099,8 +1099,16 @@ static int i3c_master_getmxds_locked(struct i3c
_master_controller*master,Quoted 13 lines
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1103
Quoted 6 lines
drivers/i3c/master.c +2
-2>> 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) { +/* ^Wrong alignment of the starts below
vdrivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1105
Quoted 2 lines
drivers/i3c/master.c +2
-0+* Retry when the device does not support max read turnaround +* while expecting shorter length from this CCC command period?
Quoted 8 lines
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c_master_controller *master, · line 1111
Quoted 6 lines
drivers/i3c/master.c +6
-0+*/ + dest->payload.len -=3 ; + ret =i3c_master_send_ccc_cmd_locked (master, &cmd); +if (ret) + goto out; + }I believe this is a per-device configuration and we should save this in order to only fail once, no?
Quoted 4 lines
This behavior depends on the hardware designed whether it will return an error in case of shorter length from i3c devices in
dest->payload.len. I made it so it will retry by expecting a shorter length instead, in case it still fails then it means GETMXDS CCC really failed.
Yes, I got the logic.
Quoted 3 lines
We do not have to initialize the same hardware twice and do GETMXDS CCC m ore
than once as far as I know?
I don't remember. If you say so, then it's fine like this.
Quoted 2 lines
Quoted 2 lines
drivers/i3c/master.c static int i3c_master_getmxds_locked(struct i3c · line 1112
Quoted 2 lines
drivers/i3c/master.c +0
-0>> if (dest.payload.len != 2 && dest.payload.len != 5) { ret = -EIO ;
Thanks,
Miquèl
Signature · 3 lines
linux-i3c mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-i3c