* [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver
@ 2025-03-18 5:36 Stanley Chu
2025-03-18 5:36 ` [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules Stanley Chu
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Stanley Chu @ 2025-03-18 5:36 UTC (permalink / raw)
To: frank.li, miquel.raynal, alexandre.belloni, linux-i3c
Cc: linux-kernel, tomer.maimon, kwliu, yschu
This patchset adds some fixes for the Silvaco I3C controller driver.
Stanley Chu (3):
i3c: master: svc: Fix missing the IBI rules
i3c: master: svc: Use readsb helper for reading MDB
i3c: master: svc: Fix missing STOP for master request
drivers/i3c/master/svc-i3c-master.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules
2025-03-18 5:36 [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Stanley Chu
@ 2025-03-18 5:36 ` Stanley Chu
2025-03-18 13:33 ` Frank Li
2025-03-18 5:36 ` [PATCH v2 2/3] i3c: master: svc: Use readsb helper for reading MDB Stanley Chu
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Stanley Chu @ 2025-03-18 5:36 UTC (permalink / raw)
To: frank.li, miquel.raynal, alexandre.belloni, linux-i3c
Cc: linux-kernel, tomer.maimon, kwliu, yschu
From: Stanley Chu <yschu@nuvoton.com>
The code does not add IBI rules for devices with controller capability.
However, the secondary controller has the controller capability and works
at target mode when the device is probed. Therefore, add IBI rules for
such devices.
Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
Signed-off-by: Stanley Chu <yschu@nuvoton.com>
---
drivers/i3c/master/svc-i3c-master.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 1d1f351b9a85..a72ba5a7edd4 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -1106,7 +1106,7 @@ static int svc_i3c_update_ibirules(struct svc_i3c_master *master)
/* Create the IBIRULES register for both cases */
i3c_bus_for_each_i3cdev(&master->base.bus, dev) {
- if (I3C_BCR_DEVICE_ROLE(dev->info.bcr) == I3C_BCR_I3C_MASTER)
+ if (!(dev->info.bcr & I3C_BCR_IBI_REQ_CAP))
continue;
if (dev->info.bcr & I3C_BCR_IBI_PAYLOAD) {
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] i3c: master: svc: Use readsb helper for reading MDB
2025-03-18 5:36 [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Stanley Chu
2025-03-18 5:36 ` [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules Stanley Chu
@ 2025-03-18 5:36 ` Stanley Chu
2025-03-18 13:34 ` Frank Li
2025-03-18 5:36 ` [PATCH v2 3/3] i3c: master: svc: Fix missing STOP for master request Stanley Chu
2025-03-18 16:17 ` [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Alexandre Belloni
3 siblings, 1 reply; 8+ messages in thread
From: Stanley Chu @ 2025-03-18 5:36 UTC (permalink / raw)
To: frank.li, miquel.raynal, alexandre.belloni, linux-i3c
Cc: linux-kernel, tomer.maimon, kwliu, yschu, stable
From: Stanley Chu <yschu@nuvoton.com>
The target can send the MDB byte followed by additional data bytes.
The readl on MRDATAB reads one actual byte, but the readsl advances
the destination pointer by 4 bytes. This causes the subsequent payload
to be copied to wrong position in the destination buffer.
Cc: stable@kernel.org
Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
Signed-off-by: Stanley Chu <yschu@nuvoton.com>
---
drivers/i3c/master/svc-i3c-master.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index a72ba5a7edd4..57b9dec6b5a8 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -425,7 +425,7 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,
slot->len < SVC_I3C_FIFO_SIZE) {
mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL);
count = SVC_I3C_MDATACTRL_RXCOUNT(mdatactrl);
- readsl(master->regs + SVC_I3C_MRDATAB, buf, count);
+ readsb(master->regs + SVC_I3C_MRDATAB, buf, count);
slot->len += count;
buf += count;
}
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] i3c: master: svc: Fix missing STOP for master request
2025-03-18 5:36 [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Stanley Chu
2025-03-18 5:36 ` [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules Stanley Chu
2025-03-18 5:36 ` [PATCH v2 2/3] i3c: master: svc: Use readsb helper for reading MDB Stanley Chu
@ 2025-03-18 5:36 ` Stanley Chu
2025-03-18 13:35 ` Frank Li
2025-03-18 16:17 ` [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Alexandre Belloni
3 siblings, 1 reply; 8+ messages in thread
From: Stanley Chu @ 2025-03-18 5:36 UTC (permalink / raw)
To: frank.li, miquel.raynal, alexandre.belloni, linux-i3c
Cc: linux-kernel, tomer.maimon, kwliu, yschu
From: Stanley Chu <yschu@nuvoton.com>
The controller driver nacked the master request but didn't emit a
STOP to end the transaction. The driver shall refuse the unsupported
requests and return the controller state to IDLE by emitting a STOP.
Signed-off-by: Stanley Chu <yschu@nuvoton.com>
---
drivers/i3c/master/svc-i3c-master.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
index 57b9dec6b5a8..e0cd3ce28b7f 100644
--- a/drivers/i3c/master/svc-i3c-master.c
+++ b/drivers/i3c/master/svc-i3c-master.c
@@ -592,6 +592,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work)
queue_work(master->base.wq, &master->hj_work);
break;
case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST:
+ svc_i3c_master_emit_stop(master);
default:
break;
}
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules
2025-03-18 5:36 ` [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules Stanley Chu
@ 2025-03-18 13:33 ` Frank Li
0 siblings, 0 replies; 8+ messages in thread
From: Frank Li @ 2025-03-18 13:33 UTC (permalink / raw)
To: Stanley Chu
Cc: miquel.raynal, alexandre.belloni, linux-i3c, linux-kernel,
tomer.maimon, kwliu, yschu
On Tue, Mar 18, 2025 at 01:36:04PM +0800, Stanley Chu wrote:
> From: Stanley Chu <yschu@nuvoton.com>
>
> The code does not add IBI rules for devices with controller capability.
> However, the secondary controller has the controller capability and works
> at target mode when the device is probed. Therefore, add IBI rules for
> such devices.
>
> Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
> Signed-off-by: Stanley Chu <yschu@nuvoton.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/i3c/master/svc-i3c-master.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index 1d1f351b9a85..a72ba5a7edd4 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -1106,7 +1106,7 @@ static int svc_i3c_update_ibirules(struct svc_i3c_master *master)
>
> /* Create the IBIRULES register for both cases */
> i3c_bus_for_each_i3cdev(&master->base.bus, dev) {
> - if (I3C_BCR_DEVICE_ROLE(dev->info.bcr) == I3C_BCR_I3C_MASTER)
> + if (!(dev->info.bcr & I3C_BCR_IBI_REQ_CAP))
> continue;
>
> if (dev->info.bcr & I3C_BCR_IBI_PAYLOAD) {
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/3] i3c: master: svc: Use readsb helper for reading MDB
2025-03-18 5:36 ` [PATCH v2 2/3] i3c: master: svc: Use readsb helper for reading MDB Stanley Chu
@ 2025-03-18 13:34 ` Frank Li
0 siblings, 0 replies; 8+ messages in thread
From: Frank Li @ 2025-03-18 13:34 UTC (permalink / raw)
To: Stanley Chu
Cc: miquel.raynal, alexandre.belloni, linux-i3c, linux-kernel,
tomer.maimon, kwliu, yschu, stable
On Tue, Mar 18, 2025 at 01:36:05PM +0800, Stanley Chu wrote:
> From: Stanley Chu <yschu@nuvoton.com>
>
> The target can send the MDB byte followed by additional data bytes.
> The readl on MRDATAB reads one actual byte, but the readsl advances
> the destination pointer by 4 bytes. This causes the subsequent payload
> to be copied to wrong position in the destination buffer.
>
> Cc: stable@kernel.org
> Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
> Signed-off-by: Stanley Chu <yschu@nuvoton.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/i3c/master/svc-i3c-master.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index a72ba5a7edd4..57b9dec6b5a8 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -425,7 +425,7 @@ static int svc_i3c_master_handle_ibi(struct svc_i3c_master *master,
> slot->len < SVC_I3C_FIFO_SIZE) {
> mdatactrl = readl(master->regs + SVC_I3C_MDATACTRL);
> count = SVC_I3C_MDATACTRL_RXCOUNT(mdatactrl);
> - readsl(master->regs + SVC_I3C_MRDATAB, buf, count);
> + readsb(master->regs + SVC_I3C_MRDATAB, buf, count);
> slot->len += count;
> buf += count;
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] i3c: master: svc: Fix missing STOP for master request
2025-03-18 5:36 ` [PATCH v2 3/3] i3c: master: svc: Fix missing STOP for master request Stanley Chu
@ 2025-03-18 13:35 ` Frank Li
0 siblings, 0 replies; 8+ messages in thread
From: Frank Li @ 2025-03-18 13:35 UTC (permalink / raw)
To: Stanley Chu
Cc: miquel.raynal, alexandre.belloni, linux-i3c, linux-kernel,
tomer.maimon, kwliu, yschu
On Tue, Mar 18, 2025 at 01:36:06PM +0800, Stanley Chu wrote:
> From: Stanley Chu <yschu@nuvoton.com>
>
> The controller driver nacked the master request but didn't emit a
> STOP to end the transaction. The driver shall refuse the unsupported
> requests and return the controller state to IDLE by emitting a STOP.
>
> Signed-off-by: Stanley Chu <yschu@nuvoton.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/i3c/master/svc-i3c-master.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index 57b9dec6b5a8..e0cd3ce28b7f 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -592,6 +592,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work)
> queue_work(master->base.wq, &master->hj_work);
> break;
> case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST:
> + svc_i3c_master_emit_stop(master);
> default:
> break;
> }
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver
2025-03-18 5:36 [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Stanley Chu
` (2 preceding siblings ...)
2025-03-18 5:36 ` [PATCH v2 3/3] i3c: master: svc: Fix missing STOP for master request Stanley Chu
@ 2025-03-18 16:17 ` Alexandre Belloni
3 siblings, 0 replies; 8+ messages in thread
From: Alexandre Belloni @ 2025-03-18 16:17 UTC (permalink / raw)
To: frank.li, miquel.raynal, linux-i3c, Stanley Chu
Cc: linux-kernel, tomer.maimon, kwliu, yschu
On Tue, 18 Mar 2025 13:36:03 +0800, Stanley Chu wrote:
> This patchset adds some fixes for the Silvaco I3C controller driver.
>
> Stanley Chu (3):
> i3c: master: svc: Fix missing the IBI rules
> i3c: master: svc: Use readsb helper for reading MDB
> i3c: master: svc: Fix missing STOP for master request
>
> [...]
Applied, thanks!
[1/3] i3c: master: svc: Fix missing the IBI rules
https://git.kernel.org/abelloni/c/9cecad134d84
[2/3] i3c: master: svc: Use readsb helper for reading MDB
https://git.kernel.org/abelloni/c/c06acf7143bd
[3/3] i3c: master: svc: Fix missing STOP for master request
https://git.kernel.org/abelloni/c/0430bf9bc1ac
Best regards,
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-03-18 16:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-18 5:36 [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Stanley Chu
2025-03-18 5:36 ` [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules Stanley Chu
2025-03-18 13:33 ` Frank Li
2025-03-18 5:36 ` [PATCH v2 2/3] i3c: master: svc: Use readsb helper for reading MDB Stanley Chu
2025-03-18 13:34 ` Frank Li
2025-03-18 5:36 ` [PATCH v2 3/3] i3c: master: svc: Fix missing STOP for master request Stanley Chu
2025-03-18 13:35 ` Frank Li
2025-03-18 16:17 ` [PATCH v2 0/3] Some fixes for Silvaco I3C controller driver Alexandre Belloni
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®