From: Frank Li <Frank.li@oss.nxp.com>
To: tze.yee.ng@altera.com
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Frank Li <Frank.Li@nxp.com>,
Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>,
Felix Gu <ustc.gu@gmail.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Manikanta Guntupalli <manikanta.guntupalli@amd.com>,
Jorge Marques <jorge.marques@analog.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] i3c: master: dw: Report actual GET CCC payload length on success
Date: Fri, 19 Jun 2026 15:21:14 -0400 [thread overview]
Message-ID: <ajWWqkwDzzhEMXZO@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <b7dff215ce161fbff18949a12442eac5d189347e.1781142158.git.tze.yee.ng@altera.com>
On Wed, Jun 10, 2026 at 06:54:06PM -0700, tze.yee.ng@altera.com wrote:
> From: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
>
> On successful GET CCC transfers, set dests[0].payload.len from
> RESPONSE_PORT_DATA_LEN so the I3C core receives the number of bytes
> actually read. Core helpers such as i3c_master_getmrl_locked() use
> dest.payload.len after the transfer to interpret the response.
>
> Save the requested length in a local variable before programming the
> hardware so the caller's buffer size is not conflated with the bytes
> received.
>
> Signed-off-by: Adrian Ng Ho Yin <adrian.ho.yin.ng@altera.com>
> Signed-off-by: Tze Yee Ng <tze.yee.ng@altera.com>
> ---
> drivers/i3c/master/dw-i3c-master.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 655693a2187e..06fdf8857b9c 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -751,21 +751,24 @@ static int dw_i3c_ccc_set(struct dw_i3c_master *master,
> static int dw_i3c_ccc_get(struct dw_i3c_master *master, struct i3c_ccc_cmd *ccc)
> {
> struct dw_i3c_cmd *cmd;
> + u16 req_len;
> int ret, pos;
>
> pos = dw_i3c_master_get_addr_pos(master, ccc->dests[0].addr);
> if (pos < 0)
> return pos;
>
> + req_len = ccc->dests[0].payload.len;
> +
> struct dw_i3c_xfer *xfer __free(kfree) = dw_i3c_master_alloc_xfer(master, 1);
> if (!xfer)
> return -ENOMEM;
>
> cmd = xfer->cmds;
> cmd->rx_buf = ccc->dests[0].payload.data;
> - cmd->rx_len = ccc->dests[0].payload.len;
> + cmd->rx_len = req_len;
>
> - cmd->cmd_hi = COMMAND_PORT_ARG_DATA_LEN(ccc->dests[0].payload.len) |
> + cmd->cmd_hi = COMMAND_PORT_ARG_DATA_LEN(req_len) |
> COMMAND_PORT_TRANSFER_ARG;
not sure how req_len help it. Prevously everything copy into cmd. now copy
req_len then copy to cmd,
No difference?
>
> cmd->cmd_lo = COMMAND_PORT_READ_TRANSFER |
> @@ -780,7 +783,10 @@ static int dw_i3c_ccc_get(struct dw_i3c_master *master, struct i3c_ccc_cmd *ccc)
> dw_i3c_master_dequeue_xfer(master, xfer);
>
> ret = xfer->ret;
> - if (xfer->cmds[0].error == RESPONSE_ERROR_IBA_NACK)
> + cmd = &xfer->cmds[0];
> + if (!ret)
> + ccc->dests[0].payload.len = cmd->rx_len;
Only this line is validate.
Frank
> + if (cmd->error == RESPONSE_ERROR_IBA_NACK)
> ccc->err = I3C_ERROR_M2;
>
> return ret;
> --
> 2.43.7
>
next prev parent reply other threads:[~2026-06-19 19:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 1:54 [PATCH v3 0/3] i3c: Improve CCC reliability for DesignWare master tze.yee.ng
2026-06-11 1:54 ` [PATCH v3 1/3] i3c: master: dw: Report actual GET CCC payload length on success tze.yee.ng
2026-06-19 19:21 ` Frank Li [this message]
2026-06-24 6:30 ` NG, TZE YEE
2026-06-11 1:54 ` [PATCH v3 2/3] i3c: master: dw: Map CCC hardware errors to I3C M0/M2 tze.yee.ng
2026-06-19 19:26 ` Frank Li
2026-06-24 6:30 ` NG, TZE YEE
2026-06-11 1:54 ` [PATCH v3 3/3] i3c: master: Validate GET CCC payload length and retry M0/M2 once tze.yee.ng
2026-06-16 7:41 ` Adrian Hunter
2026-06-19 8:09 ` NG, TZE YEE
2026-06-23 12:29 ` Adrian Hunter
2026-06-24 8:28 ` NG, TZE YEE
2026-06-24 12:22 ` Adrian Hunter
2026-06-19 19:28 ` Frank Li
2026-06-25 2:03 ` NG, TZE YEE
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=ajWWqkwDzzhEMXZO@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=adrian.ho.yin.ng@altera.com \
--cc=alexandre.belloni@bootlin.com \
--cc=jorge.marques@analog.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manikanta.guntupalli@amd.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tze.yee.ng@altera.com \
--cc=ustc.gu@gmail.com \
--cc=wsa+renesas@sang-engineering.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®