-
Notifications
You must be signed in to change notification settings - Fork 8.4k
drivers: i3c: npcx: add support for target reset request handling #90717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
drivers/i3c/i3c_npcx.c
Outdated
| /* Currently handle broadcast RSTACT command only */ | ||
| if (payload->ccc.id == I3C_CCC_RSTACT(true)) { | ||
| /* Only process defined reset-action bytes (0x00 ~ 0x04) */ | ||
| if (payload->ccc.data[0] <= I3C_CCC_RSTACT_VIRTUAL_TARGET_DETECT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swap the condition, handle the error in the branch and normal execution inline, plus I suppose the error condition should also sett err and goto out_do_ccc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
drivers/i3c/i3c_npcx.c
Outdated
| if (payload->ccc.id == I3C_CCC_RSTACT(true)) { | ||
| /* Only process defined reset-action bytes (0x00 ~ 0x04) */ | ||
| if (payload->ccc.data[0] <= I3C_CCC_RSTACT_VIRTUAL_TARGET_DETECT) { | ||
| ret = npcx_i3c_request_tgt_reset(inst); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit of a weird pattern, is it ok to override ret here? it was xferd_len, now it becomes an actual return value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s a little ambiguous at first glance, but the intention here is:
In npcx_i3c_xfer_write_fifo(), xfered_len is used to capture the result of a FIFO transfer, which can either be:
a positive number, meaning the number of bytes transferred, or a negative value, representing an error code
(e.g. -ETIMEDOUT, etc.).
We only assign xfered_len to ret when it’s xfered_len < 0, meaning an actual error occurred. Otherwise, we intentionally preserve the previous value of ret (which is usually 0) to avoid mistakenly returning a positive length as an error code.
This patch introduces handling for the target reset request (RSTACT) in the I3C controller. It enables the controller to send a broadcast RSTACT command along with the target reset pattern in a single frame. Signed-off-by: Alvis Sun <yfsun@nuvoton.com>
8fa90f4 to
f3eb8f1
Compare
|



This patch introduces handling for the target reset request (RSTACT) in the I3C controller.
It enables the controller to send a broadcast RSTACT command along with the target reset pattern in a single frame.