From: Joshua Yeong <joshua.yeong@starfivetech.com> To: <alexandre.belloni@bootlin.com>, <miquel.raynal@bootlin.com> Cc: <linux-i3c@lists.infradead.org>, <linux-kernel@vger.kernel.org>, "Joshua Yeong" <joshua.yeong@starfivetech.com> Subject: [PATCH v3 1/1] i3c: Add fallback method for GETMXDS CCC Date: Tue, 14 Nov 2023 16:55:25 +0800 [thread overview] Message-ID: <20231114085525.6271-2-joshua.yeong@starfivetech.com> (raw) In-Reply-To: <20231114085525.6271-1-joshua.yeong@starfivetech.com> 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. 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 95caa162706f..718b643cb54d 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -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; -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Joshua Yeong <joshua.yeong@starfivetech.com> To: <alexandre.belloni@bootlin.com>, <miquel.raynal@bootlin.com> Cc: <linux-i3c@lists.infradead.org>, <linux-kernel@vger.kernel.org>, "Joshua Yeong" <joshua.yeong@starfivetech.com> Subject: [PATCH v3 1/1] i3c: Add fallback method for GETMXDS CCC Date: Tue, 14 Nov 2023 16:55:25 +0800 [thread overview] Message-ID: <20231114085525.6271-2-joshua.yeong@starfivetech.com> (raw) In-Reply-To: <20231114085525.6271-1-joshua.yeong@starfivetech.com> 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. 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 95caa162706f..718b643cb54d 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -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; -- 2.25.1 -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2023-11-14 8:56 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-14 8:55 [PATCH v3 0/1] Fallback mechanism for GETMXDS CCC Joshua Yeong 2023-11-14 8:55 ` Joshua Yeong 2023-11-14 8:55 ` Joshua Yeong [this message] 2023-11-14 8:55 ` [PATCH v3 1/1] i3c: Add fallback method " Joshua Yeong 2023-11-14 8:57 ` Miquel Raynal 2023-11-14 8:57 ` Miquel Raynal 2023-11-16 22:40 ` [PATCH v3 0/1] Fallback mechanism " Alexandre Belloni 2023-11-16 22:40 ` Alexandre Belloni
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231114085525.6271-2-joshua.yeong@starfivetech.com \ --to=joshua.yeong@starfivetech.com \ --cc=alexandre.belloni@bootlin.com \ --cc=linux-i3c@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=miquel.raynal@bootlin.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.