Some fixes for Silvaco I3C controller driver
Subsystems (2)
v2 cover Some fixes for Silvaco I3C controller driver
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(-)
Signature · 1 line
2.34.1
PATCH v2 1/3 i3c: master: svc: Fix missing the IBI rules
From: Stanley Chu <[email protected]>
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.
--- drivers/i3c/master/svc-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/svc-i3c-master.c +1 -1
@@ -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 ) {
Signature · 1 line
2.34.1
Re: [PATCH v2 1/3] i3c: master: svc: Fix missing the IBI rules
Quoted 9 lines · Stanley Chu
From: Stanley Chu <[email protected]>
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 <[email protected]>
Quoted 20 lines
--- drivers/i3c/master/svc-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i3c/master/svc-i3c-master.c +1
-2@@ -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
PATCH v2 2/3 i3c: master: svc: Use readsb helper for reading MDB
In reply to Stanley ChuFrom: Stanley Chu <[email protected]>
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.
--- drivers/i3c/master/svc-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master/svc-i3c-master.c +1 -1
@@ -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; }
Signature · 1 line
2.34.1
Re: [PATCH v2 2/3] i3c: master: svc: Use readsb helper for reading MDB
Quoted 10 lines · Stanley Chu
From: Stanley Chu <[email protected]>
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.
Fixes dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")Signed-off-by Stanley Chu <[email protected]>
Quoted 20 lines
--- drivers/i3c/master/svc-i3c-master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/i3c/master/svc-i3c-master.c +1
-2@@ -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
PATCH v2 3/3 i3c: master: svc: Fix missing STOP for master request
In reply to Stanley ChuFrom: Stanley Chu <[email protected]>
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.
--- drivers/i3c/master/svc-i3c-master.c | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/master/svc-i3c-master.c +1 -0
@@ -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 ; }
Signature · 1 line
2.34.1
Re: [PATCH v2 3/3] i3c: master: svc: Fix missing STOP for master request
Quoted 7 lines · Stanley Chu
From: Stanley Chu <[email protected]>
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 <[email protected]>
Quoted 19 lines
--- drivers/i3c/master/svc-i3c-master.c | 1 + 1 file changed, 1 insertion(+)drivers/i3c/master/svc-i3c-master.c +1
-1@@ -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
Quoted 8 lines · Stanley Chu
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,
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com