* [PATCH v2 0/1] Fallback mechanism for GETMXDS CCC
@ 2023-11-14 3:34 Joshua Yeong
2023-11-14 3:34 ` [PATCH v2 1/1] i3c: Add fallback method " Joshua Yeong
0 siblings, 1 reply; 5+ messages in thread
From: Joshua Yeong @ 2023-11-14 3:34 UTC (permalink / raw)
To: alexandre.belloni, miquel.raynal; +Cc: linux-i3c, linux-kernel, 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
drivers/i3c/master.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
--
2.25.1
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/1] i3c: Add fallback method for GETMXDS CCC
2023-11-14 3:34 [PATCH v2 0/1] Fallback mechanism for GETMXDS CCC Joshua Yeong
@ 2023-11-14 3:34 ` Joshua Yeong
2023-11-14 8:19 ` Miquel Raynal
0 siblings, 1 reply; 5+ messages in thread
From: Joshua Yeong @ 2023-11-14 3:34 UTC (permalink / raw)
To: alexandre.belloni, miquel.raynal; +Cc: linux-i3c, linux-kernel, Joshua Yeong
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.
Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
---
drivers/i3c/master.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 0cdc94e4cb77..2fc04d97f07e 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -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;
--
2.25.1
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] i3c: Add fallback method for GETMXDS CCC
2023-11-14 3:34 ` [PATCH v2 1/1] i3c: Add fallback method " Joshua Yeong
@ 2023-11-14 8:19 ` Miquel Raynal
2023-11-14 8:42 ` Joshua Yeong
0 siblings, 1 reply; 5+ messages in thread
From: Miquel Raynal @ 2023-11-14 8:19 UTC (permalink / raw)
To: Joshua Yeong; +Cc: alexandre.belloni, linux-i3c, linux-kernel
Hi Joshua,
joshua.yeong@starfivetech.com wrote on Tue, 14 Nov 2023 11:34:30 +0800:
> Some I3C hardware will report error when incorrect length is received from
an
> device. GETMXDS CCC are availble in 2 formats; without turnaround time (format
available :
> 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?
> failure, try sending GETMXDS CCC format 1 instead.
in a
>
> Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
> ---
> drivers/i3c/master.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index 0cdc94e4cb77..2fc04d97f07e 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -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
> + * Retry when the device does not support max read turnaround
> + * while expecting shorter length from this CCC command
period?
> + */
> + 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?
>
> if (dest.payload.len != 2 && dest.payload.len != 5) {
> ret = -EIO;
Thanks,
Miquèl
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] i3c: Add fallback method for GETMXDS CCC
2023-11-14 8:19 ` Miquel Raynal
@ 2023-11-14 8:42 ` Joshua Yeong
2023-11-14 8:56 ` Miquel Raynal
0 siblings, 1 reply; 5+ messages in thread
From: Joshua Yeong @ 2023-11-14 8:42 UTC (permalink / raw)
To: Miquel Raynal; +Cc: alexandre.belloni, linux-i3c, linux-kernel
Hi Miquel,
On 14-Nov-23 4:19 PM, Miquel Raynal wrote:
> Hi Joshua,
>
> joshua.yeong@starfivetech.com wrote on Tue, 14 Nov 2023 11:34:30 +0800:
>
>> Some I3C hardware will report error when incorrect length is received from
> an
>
>> device. GETMXDS CCC are availble in 2 formats; without turnaround time (format
> available :
>
>> 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?
>
>> failure, try sending GETMXDS CCC format 1 instead.
> in a
>
>> Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
>> ---
>> drivers/i3c/master.c | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
>> index 0cdc94e4cb77..2fc04d97f07e 100644
>> --- a/drivers/i3c/master.c
>> +++ b/drivers/i3c/master.c
>> @@ -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
>> + * Retry when the device does not support max read turnaround
>> + * while expecting shorter length from this CCC command
> period?
>
>> + */
>> + 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?
>
>>
>> if (dest.payload.len != 2 && dest.payload.len != 5) {
>> ret = -EIO;
>
> Thanks,
> Miquèl
>
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/1] i3c: Add fallback method for GETMXDS CCC
2023-11-14 8:42 ` Joshua Yeong
@ 2023-11-14 8:56 ` Miquel Raynal
0 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2023-11-14 8:56 UTC (permalink / raw)
To: Joshua Yeong; +Cc: alexandre.belloni, linux-i3c, linux-kernel
Hi Joshua,
joshua.yeong@starfivetech.com wrote on Tue, 14 Nov 2023 16:42:44 +0800:
> Hi Miquel,
>
> On 14-Nov-23 4:19 PM, Miquel Raynal wrote:
> > Hi Joshua,
> >
> > joshua.yeong@starfivetech.com wrote on Tue, 14 Nov 2023 11:34:30 +0800:
> >
> >> Some I3C hardware will report error when incorrect length is received from
> > an
> >
> >> device. GETMXDS CCC are availble in 2 formats; without turnaround time
> (format
> > available :
> >
> >> 1) and with turnaround time (format 2). There is no mechanics to deter
> mine which
> >> format is supported by device. In case sending GETMXDS CCC format 2 re
> sulted
> > So in case?
> >
> >> failure, try sending GETMXDS CCC format 1 instead.
> > in a
> >
> >> Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
> >> ---
> >> drivers/i3c/master.c | 12 ++++++++++--
> >> 1 file changed, 10 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> >> index 0cdc94e4cb77..2fc04d97f07e 100644
> >> --- a/drivers/i3c/master.c
> >> +++ b/drivers/i3c/master.c
> >> @@ -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
> >> + * Retry when the device does not support max read turnaround
> >> + * while expecting shorter length from this CCC command
> > period?
> >
> >> + */
> >> + 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.
Yes, I got the logic.
> 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.
> >> >> if (dest.payload.len != 2 && dest.payload.len != 5) {
> >> ret = -EIO;
Thanks,
Miquèl
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-14 8:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14 3:34 [PATCH v2 0/1] Fallback mechanism for GETMXDS CCC Joshua Yeong
2023-11-14 3:34 ` [PATCH v2 1/1] i3c: Add fallback method " Joshua Yeong
2023-11-14 8:19 ` Miquel Raynal
2023-11-14 8:42 ` Joshua Yeong
2023-11-14 8:56 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox