* [PATCH 0/2] i3c: renesas: add R-Car Gen5 support @ 2026-12-01 9:52 Wolfram Sang 2026-12-01 9:52 ` [PATCH 1/2] dt-bindings: i3c: renesas,i3c: " Wolfram Sang 2026-12-01 9:52 ` [PATCH 2/2] i3c: renesas: " Wolfram Sang 0 siblings, 2 replies; 6+ messages in thread From: Wolfram Sang @ 2026-12-01 9:52 UTC (permalink / raw) To: linux-renesas-soc Cc: Wolfram Sang, Alexandre Belloni, Conor Dooley, devicetree, Frank Li, Geert Uytterhoeven, Krzysztof Kozlowski, linux-i3c, Magnus Damm, Rob Herring, Tommaso Merciai Here are the driver changes to make I3C work on R-Car Gen5 based SoCs. Details can be found in the patch descriptions. A complete branch for testing on the Ironhide board is here: git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/x5h/i3c-experimental Looking forward to comments! Happy hacking. Wolfram Sang (2): dt-bindings: i3c: renesas,i3c: add R-Car Gen 5 support i3c: renesas: add R-Car Gen5 support .../devicetree/bindings/i3c/renesas,i3c.yaml | 108 ++++++++++++------ drivers/i3c/master/renesas-i3c.c | 84 ++++++++++++-- 2 files changed, 147 insertions(+), 45 deletions(-) -- 2.53.0 -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] dt-bindings: i3c: renesas,i3c: add R-Car Gen5 support 2026-12-01 9:52 [PATCH 0/2] i3c: renesas: add R-Car Gen5 support Wolfram Sang @ 2026-12-01 9:52 ` Wolfram Sang 2026-12-01 21:12 ` Frank Li 2026-12-01 9:52 ` [PATCH 2/2] i3c: renesas: " Wolfram Sang 1 sibling, 1 reply; 6+ messages in thread From: Wolfram Sang @ 2026-12-01 9:52 UTC (permalink / raw) To: linux-renesas-soc Cc: Wolfram Sang, Tommaso Merciai, Alexandre Belloni, Frank Li, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, Magnus Damm, linux-i3c, devicetree X5H is the first member of the R-Car Gen5 family. The biggest change is that only one interrupt is used instead of many. Also, only one reset is needed. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- Passed 'dt_binding_check' and 'dtbs_check' for all users of this I3C controller here. .../devicetree/bindings/i3c/renesas,i3c.yaml | 108 ++++++++++++------ 1 file changed, 70 insertions(+), 38 deletions(-) diff --git a/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml b/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml index a20d875086d4..ceff97a5ddf7 100644 --- a/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml +++ b/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml @@ -22,51 +22,59 @@ properties: - renesas,r9a09g056-i3c # RZ/V2N - renesas,r9a09g057-i3c # RZ/V2H(P) - const: renesas,r9a09g047-i3c + - items: + - enum: + - renesas,r8a78000-i3c # R-Car X5H + - const: renesas,rcar-gen5-i3c reg: maxItems: 1 interrupts: - items: - - description: Non-recoverable internal error interrupt - - description: Normal transfer error interrupt - - description: Normal transfer abort interrupt - - description: Normal response status buffer full interrupt - - description: Normal command buffer empty interrupt - - description: Normal IBI status buffer full interrupt - - description: Normal Rx data buffer full interrupt - - description: Normal Tx data buffer empty interrupt - - description: Normal receive status buffer full interrupt - - description: START condition detection interrupt - - description: STOP condition detection interrupt - - description: Transmit end interrupt - - description: NACK detection interrupt - - description: Arbitration lost interrupt - - description: Timeout detection interrupt - - description: Wake-up condition detection interrupt - - description: HDR Exit Pattern detection interrupt - minItems: 16 + oneOf: + - items: + - description: Non-recoverable internal error interrupt + - description: Normal transfer error interrupt + - description: Normal transfer abort interrupt + - description: Normal response status buffer full interrupt + - description: Normal command buffer empty interrupt + - description: Normal IBI status buffer full interrupt + - description: Normal Rx data buffer full interrupt + - description: Normal Tx data buffer empty interrupt + - description: Normal receive status buffer full interrupt + - description: START condition detection interrupt + - description: STOP condition detection interrupt + - description: Transmit end interrupt + - description: NACK detection interrupt + - description: Arbitration lost interrupt + - description: Timeout detection interrupt + - description: Wake-up condition detection interrupt + - description: HDR Exit Pattern detection interrupt + - items: + - description: Main interrupt interrupt-names: - items: - - const: ierr - - const: terr - - const: abort - - const: resp - - const: cmd - - const: ibi - - const: rx - - const: tx - - const: rcv - - const: st - - const: sp - - const: tend - - const: nack - - const: al - - const: tmo - - const: wu - - const: exit - minItems: 16 + oneOf: + - items: + - const: ierr + - const: terr + - const: abort + - const: resp + - const: cmd + - const: ibi + - const: rx + - const: tx + - const: rcv + - const: st + - const: sp + - const: tend + - const: nack + - const: al + - const: tmo + - const: wu + - const: exit + - items: + - const: main clocks: items: @@ -89,11 +97,13 @@ properties: items: - description: Reset signal - description: APB interface reset signal/SCAN reset signal + minItems: 1 reset-names: items: - const: presetn - const: tresetn + minItems: 1 required: - compatible @@ -137,10 +147,32 @@ allOf: clock-names: minItems: 3 interrupts: + minItems: 16 maxItems: 16 interrupt-names: + minItems: 16 maxItems: 16 + - if: + properties: + compatible: + contains: + const: renesas,rcar-gen5-i3c + then: + properties: + clocks: + maxItems: 2 + clock-names: + maxItems: 2 + resets: + maxItems: 1 + reset-names: + maxItems: 1 + interrupts: + maxItems: 1 + interrupt-names: + maxItems: 1 + unevaluatedProperties: false examples: -- 2.53.0 -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] dt-bindings: i3c: renesas,i3c: add R-Car Gen5 support 2026-12-01 9:52 ` [PATCH 1/2] dt-bindings: i3c: renesas,i3c: " Wolfram Sang @ 2026-12-01 21:12 ` Frank Li 0 siblings, 0 replies; 6+ messages in thread From: Frank Li @ 2026-12-01 21:12 UTC (permalink / raw) To: Wolfram Sang Cc: linux-renesas-soc, Tommaso Merciai, Alexandre Belloni, Frank Li, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, Magnus Damm, linux-i3c, devicetree On Tue, Dec 01, 2026 at 10:52:58AM +0100, Wolfram Sang wrote: > X5H is the first member of the R-Car Gen5 family. The biggest change is > that only one interrupt is used instead of many. Also, only one reset is > needed. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > --- > > Passed 'dt_binding_check' and 'dtbs_check' for all users of this I3C > controller here. > > .../devicetree/bindings/i3c/renesas,i3c.yaml | 108 ++++++++++++------ > 1 file changed, 70 insertions(+), 38 deletions(-) > > diff --git a/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml b/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml > index a20d875086d4..ceff97a5ddf7 100644 > --- a/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml > +++ b/Documentation/devicetree/bindings/i3c/renesas,i3c.yaml > @@ -22,51 +22,59 @@ properties: > - renesas,r9a09g056-i3c # RZ/V2N > - renesas,r9a09g057-i3c # RZ/V2H(P) > - const: renesas,r9a09g047-i3c > + - items: > + - enum: > + - renesas,r8a78000-i3c # R-Car X5H > + - const: renesas,rcar-gen5-i3c not sure why need this fallback? if new soc coming, should fallback to renesas,r8a78000-i3c Frank > > reg: > maxItems: 1 > > interrupts: > - items: > - - description: Non-recoverable internal error interrupt > - - description: Normal transfer error interrupt > - - description: Normal transfer abort interrupt > - - description: Normal response status buffer full interrupt > - - description: Normal command buffer empty interrupt > - - description: Normal IBI status buffer full interrupt > - - description: Normal Rx data buffer full interrupt > - - description: Normal Tx data buffer empty interrupt > - - description: Normal receive status buffer full interrupt > - - description: START condition detection interrupt > - - description: STOP condition detection interrupt > - - description: Transmit end interrupt > - - description: NACK detection interrupt > - - description: Arbitration lost interrupt > - - description: Timeout detection interrupt > - - description: Wake-up condition detection interrupt > - - description: HDR Exit Pattern detection interrupt > - minItems: 16 > + oneOf: > + - items: > + - description: Non-recoverable internal error interrupt > + - description: Normal transfer error interrupt > + - description: Normal transfer abort interrupt > + - description: Normal response status buffer full interrupt > + - description: Normal command buffer empty interrupt > + - description: Normal IBI status buffer full interrupt > + - description: Normal Rx data buffer full interrupt > + - description: Normal Tx data buffer empty interrupt > + - description: Normal receive status buffer full interrupt > + - description: START condition detection interrupt > + - description: STOP condition detection interrupt > + - description: Transmit end interrupt > + - description: NACK detection interrupt > + - description: Arbitration lost interrupt > + - description: Timeout detection interrupt > + - description: Wake-up condition detection interrupt > + - description: HDR Exit Pattern detection interrupt > + - items: > + - description: Main interrupt > > interrupt-names: > - items: > - - const: ierr > - - const: terr > - - const: abort > - - const: resp > - - const: cmd > - - const: ibi > - - const: rx > - - const: tx > - - const: rcv > - - const: st > - - const: sp > - - const: tend > - - const: nack > - - const: al > - - const: tmo > - - const: wu > - - const: exit > - minItems: 16 > + oneOf: > + - items: > + - const: ierr > + - const: terr > + - const: abort > + - const: resp > + - const: cmd > + - const: ibi > + - const: rx > + - const: tx > + - const: rcv > + - const: st > + - const: sp > + - const: tend > + - const: nack > + - const: al > + - const: tmo > + - const: wu > + - const: exit > + - items: > + - const: main > > clocks: > items: > @@ -89,11 +97,13 @@ properties: > items: > - description: Reset signal > - description: APB interface reset signal/SCAN reset signal > + minItems: 1 > > reset-names: > items: > - const: presetn > - const: tresetn > + minItems: 1 > > required: > - compatible > @@ -137,10 +147,32 @@ allOf: > clock-names: > minItems: 3 > interrupts: > + minItems: 16 > maxItems: 16 > interrupt-names: > + minItems: 16 > maxItems: 16 > > + - if: > + properties: > + compatible: > + contains: > + const: renesas,rcar-gen5-i3c > + then: > + properties: > + clocks: > + maxItems: 2 > + clock-names: > + maxItems: 2 > + resets: > + maxItems: 1 > + reset-names: > + maxItems: 1 > + interrupts: > + maxItems: 1 > + interrupt-names: > + maxItems: 1 > + > unevaluatedProperties: false > > examples: > -- > 2.53.0 > -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] i3c: renesas: add R-Car Gen5 support 2026-12-01 9:52 [PATCH 0/2] i3c: renesas: add R-Car Gen5 support Wolfram Sang 2026-12-01 9:52 ` [PATCH 1/2] dt-bindings: i3c: renesas,i3c: " Wolfram Sang @ 2026-12-01 9:52 ` Wolfram Sang 2026-12-01 10:14 ` sashiko-bot 2026-12-01 21:55 ` Frank Li 1 sibling, 2 replies; 6+ messages in thread From: Wolfram Sang @ 2026-12-01 9:52 UTC (permalink / raw) To: linux-renesas-soc Cc: Wolfram Sang, Tommaso Merciai, Alexandre Belloni, Frank Li, Geert Uytterhoeven, Magnus Damm, linux-i3c R-Car Gen5 uses only a single interrupt. So, add a central interrupt handler which calls into the existing ones depending on interrupt status registers (one is new). In probe(), the proper handling is based on the number of interrupts provided. It may look inconsistent that 'ntst' is using a set of if-blocks, whereas 'bst' uses if/else-blocks. But this actually matches the state machine of the driver to the best of our knowledge. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- Tested with an Ironhide board (R-Car X5H) and the attached temp sensor on bus I3C0. Also no regressions seen with a RZ/G3S based board. drivers/i3c/master/renesas-i3c.c | 84 +++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 7 deletions(-) diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c index 5719b78f0503..e11107454004 100644 --- a/drivers/i3c/master/renesas-i3c.c +++ b/drivers/i3c/master/renesas-i3c.c @@ -21,6 +21,7 @@ #include <linux/list.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_irq.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/reset.h> @@ -197,6 +198,19 @@ #define NDBSTLV0 0x398 #define NDBSTLV0_RDBLV(x) FIELD_GET(GENMASK(15, 8), x) +#define INTCLR 0x400 +#define INTCLR_INTRESP BIT(0) +#define INTCLR_INTCMD BIT(1) +#define INTCLR_INTIBI BIT(2) +#define INTCLR_INTRX0 BIT(3) +#define INTCLR_INTTX0 BIT(4) +#define INTCLR_INTRCV BIT(5) +#define INTCLR_INTHRESP BIT(6) +#define INTCLR_INTHCMD BIT(7) +#define INTCLR_INTHRX BIT(8) +#define INTCLR_INTHTX BIT(9) +#define INTCLR_ALL GENMASK(9, 0) + #define RENESAS_I3C_MAX_DEVS 8 #define I2C_INIT_MSG -1 @@ -1427,6 +1441,52 @@ static irqreturn_t renesas_i3c_start_isr(int irq, void *data) return IRQ_HANDLED; } +static irqreturn_t renesas_i3c_main_isr(int irq, void *data) +{ + struct renesas_i3c *i3c = data; + + u32 ntst, bst, ntst_filterd, bst_filterd; + irqreturn_t ret = IRQ_NONE; + + ntst = renesas_readl(i3c->regs, NTST); + ntst_filterd = ntst & renesas_readl(i3c->regs, NTIE); + bst = renesas_readl(i3c->regs, BST); + bst_filterd = bst & renesas_readl(i3c->regs, BIE); + + if (ntst_filterd & NTST_TDBEF0) { + ret |= renesas_i3c_tx_isr(irq, data); + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTTX0); + } + + if (ntst_filterd & NTST_RDBFF0) { + ret |= renesas_i3c_rx_isr(irq, data); + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRX0); + } + + if (ntst_filterd & NTST_RSPQFF) { + ret |= renesas_i3c_resp_isr(irq, data); + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRESP); + } + + if (ntst_filterd & ~(NTST_RSPQFF | NTST_RDBFF0 | NTST_TDBEF0)) { + renesas_writel(i3c->regs, INTCLR, INTCLR_ALL); + ret |= IRQ_HANDLED; + } + + if (bst_filterd & BST_STCNDDF) { + ret |= renesas_i3c_start_isr(irq, data); + } else if (bst_filterd & BST_SPCNDDF) { + ret |= renesas_i3c_stop_isr(irq, data); + } else if (bst_filterd & BST_TENDF || bst_filterd & BST_NACKDF) { + ret |= renesas_i3c_tend_isr(irq, data); + } else { + renesas_clear_bit(i3c->regs, BST, bst); + ret |= IRQ_HANDLED; + } + + return ret; +} + static const struct i3c_master_controller_ops renesas_i3c_ops = { .bus_init = renesas_i3c_bus_init, .bus_cleanup = renesas_i3c_bus_cleanup, @@ -1442,7 +1502,7 @@ static const struct i3c_master_controller_ops renesas_i3c_ops = { .i2c_xfers = renesas_i3c_i2c_xfers, }; -static const struct renesas_i3c_irq_desc renesas_i3c_irqs[] = { +static const struct renesas_i3c_irq_desc renesas_i3c_multiple_irqs[] = { { .name = "resp", .isr = renesas_i3c_resp_isr, .desc = "i3c-resp" }, { .name = "rx", .isr = renesas_i3c_rx_isr, .desc = "i3c-rx" }, { .name = "tx", .isr = renesas_i3c_tx_isr, .desc = "i3c-tx" }, @@ -1450,12 +1510,19 @@ static const struct renesas_i3c_irq_desc renesas_i3c_irqs[] = { { .name = "sp", .isr = renesas_i3c_stop_isr, .desc = "i3c-stop" }, { .name = "tend", .isr = renesas_i3c_tend_isr, .desc = "i3c-tend" }, { .name = "nack", .isr = renesas_i3c_tend_isr, .desc = "i3c-nack" }, + { /* sentinel */ } +}; + +static const struct renesas_i3c_irq_desc renesas_i3c_single_irq[] = { + { .name = "main", .isr = renesas_i3c_main_isr, .desc = "i3c-main" }, + { /* sentinel */ } }; static int renesas_i3c_probe(struct platform_device *pdev) { + const struct renesas_i3c_irq_desc *irq_desc; struct renesas_i3c *i3c; - int ret, i; + int ret, i, num_irqs; i3c = devm_kzalloc_obj(&pdev->dev, *i3c); if (!i3c) @@ -1493,20 +1560,22 @@ static int renesas_i3c_probe(struct platform_device *pdev) if (ret) return ret; - for (i = 0; i < ARRAY_SIZE(renesas_i3c_irqs); i++) { + num_irqs = of_irq_count(pdev->dev.of_node); + irq_desc = num_irqs == 1 ? renesas_i3c_single_irq : renesas_i3c_multiple_irqs; + + for (i = 0; irq_desc[i].name; i++) { const char *irqname; - ret = platform_get_irq_byname(pdev, renesas_i3c_irqs[i].name); + ret = platform_get_irq_byname(pdev, irq_desc[i].name); if (ret < 0) return ret; irqname = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s:%s", dev_name(&pdev->dev), - renesas_i3c_irqs[i].desc); + irq_desc[i].desc); if (!irqname) return -ENOMEM; - ret = devm_request_irq(&pdev->dev, ret, renesas_i3c_irqs[i].isr, - 0, irqname, i3c); + ret = devm_request_irq(&pdev->dev, ret, irq_desc[i].isr, 0, irqname, i3c); if (ret) return ret; } @@ -1615,6 +1684,7 @@ static const struct dev_pm_ops renesas_i3c_pm_ops = { static const struct of_device_id renesas_i3c_of_ids[] = { { .compatible = "renesas,r9a08g045-i3c" }, { .compatible = "renesas,r9a09g047-i3c" }, + { .compatible = "renesas,rcar-gen5-i3c" }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, renesas_i3c_of_ids); -- 2.53.0 -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] i3c: renesas: add R-Car Gen5 support 2026-12-01 9:52 ` [PATCH 2/2] i3c: renesas: " Wolfram Sang @ 2026-12-01 10:14 ` sashiko-bot 2026-12-01 21:55 ` Frank Li 1 sibling, 0 replies; 6+ messages in thread From: sashiko-bot @ 2026-12-01 10:14 UTC (permalink / raw) To: Wolfram Sang; +Cc: linux-i3c, Frank.Li, Alexandre Belloni Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] i3c: renesas: unconditional else in renesas_i3c_main_isr() clears BST - [High] i3c: renesas: uncleared INTCLR bits in renesas_i3c_main_isr() cause IRQ storm -- commit bdbb91ae79ac40e75be22799e9417fb7d14818fc Author: Wolfram Sang <wsa+renesas@sang-engineering.com> i3c: renesas: add R-Car Gen5 support This commit adds R-Car Gen5 support to the Renesas I3C controller driver by introducing a central interrupt handler for single-IRQ platforms and adding the renesas,rcar-gen5-i3c compatible string. > diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c > index 5719b78f05036..e111074540049 100644 > --- a/drivers/i3c/master/renesas-i3c.c > +++ b/drivers/i3c/master/renesas-i3c.c [ ... ] > @@ -1427,6 +1441,52 @@ static irqreturn_t renesas_i3c_start_isr(int irq, void *data) > return IRQ_HANDLED; > } > > +static irqreturn_t renesas_i3c_main_isr(int irq, void *data) > +{ > + struct renesas_i3c *i3c = data; > + > + u32 ntst, bst, ntst_filterd, bst_filterd; > + irqreturn_t ret = IRQ_NONE; > + > + ntst = renesas_readl(i3c->regs, NTST); > + ntst_filterd = ntst & renesas_readl(i3c->regs, NTIE); > + bst = renesas_readl(i3c->regs, BST); > + bst_filterd = bst & renesas_readl(i3c->regs, BIE); > + > + if (ntst_filterd & NTST_TDBEF0) { > + ret |= renesas_i3c_tx_isr(irq, data); > + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTTX0); > + } > + > + if (ntst_filterd & NTST_RDBFF0) { > + ret |= renesas_i3c_rx_isr(irq, data); > + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRX0); > + } > + > + if (ntst_filterd & NTST_RSPQFF) { > + ret |= renesas_i3c_resp_isr(irq, data); > + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRESP); > + } > + > + if (ntst_filterd & ~(NTST_RSPQFF | NTST_RDBFF0 | NTST_TDBEF0)) { > + renesas_writel(i3c->regs, INTCLR, INTCLR_ALL); > + ret |= IRQ_HANDLED; > + } [Severity: High] Can gating the INTCLR writes on ntst_filterd leave an INTCLR bit latched and cause an interrupt storm? Several paths clear NTIE or NTST without clearing INTCLR. For example, renesas_i3c_irqs_mask_and_clear_locked() (called from renesas_i3c_stop_isr(), on transfer timeouts, and when xferqueue.cur is NULL) writes 0 to NTIE and NTST without touching INTCLR. Similarly, renesas_i3c_resp_isr() clears NTIE_TDBEIE0 or drains the RX FIFO and clears NTIE_RDBFIE0 after renesas_i3c_main_isr() has already snapshotted ntst_filterd, and renesas_i3c_start_isr() clears NTIE_TDBEIE0 on I2C reads without clearing INTCLR_INTTX0. If an INTCLR bit is latched when its NTIE or NTST bit is cleared, later calls to renesas_i3c_main_isr() see ntst_filterd == 0 and never clear INTCLR, while the unconditional else branch below returns IRQ_HANDLED so the generic IRQ layer cannot disable the stuck interrupt. > + > + if (bst_filterd & BST_STCNDDF) { > + ret |= renesas_i3c_start_isr(irq, data); > + } else if (bst_filterd & BST_SPCNDDF) { > + ret |= renesas_i3c_stop_isr(irq, data); > + } else if (bst_filterd & BST_TENDF || bst_filterd & BST_NACKDF) { > + ret |= renesas_i3c_tend_isr(irq, data); > + } else { > + renesas_clear_bit(i3c->regs, BST, bst); > + ret |= IRQ_HANDLED; > + } [Severity: High] Should the final else branch check "else if (bst_filterd)"? As written, whenever bst_filterd is 0 (such as on any NTST-only interrupt or a spurious interrupt), this branch clears raw bst status bits in BST without holding i3c->xferqueue.lock and forces ret |= IRQ_HANDLED. Because renesas_i3c_hw_init() enables BSTE_ALL_FLAG in BSTE, BST latches status bits even while their enable bits in BIE are masked. When renesas_i3c_tx_isr() writes the final I2C byte and enables BIE_TENDIE, returning to renesas_i3c_main_isr() enters this else block and clears bst in BST, which can drop BST_TENDF and stall the I2C transfer until timeout. It also prevents renesas_i3c_main_isr() from ever returning IRQ_NONE. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261201095257.4446-4-wsa+renesas@sang-engineering.com?part=2 -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] i3c: renesas: add R-Car Gen5 support 2026-12-01 9:52 ` [PATCH 2/2] i3c: renesas: " Wolfram Sang 2026-12-01 10:14 ` sashiko-bot @ 2026-12-01 21:55 ` Frank Li 1 sibling, 0 replies; 6+ messages in thread From: Frank Li @ 2026-12-01 21:55 UTC (permalink / raw) To: Wolfram Sang Cc: linux-renesas-soc, Tommaso Merciai, Alexandre Belloni, Frank Li, Geert Uytterhoeven, Magnus Damm, linux-i3c On Tue, Dec 01, 2026 at 10:52:59AM +0100, Wolfram Sang wrote: > R-Car Gen5 uses only a single interrupt. So, add a central interrupt > handler which calls into the existing ones depending on interrupt status > registers (one is new). In probe(), the proper handling is based on the > number of interrupts provided. It may look inconsistent that 'ntst' is > using a set of if-blocks, whereas 'bst' uses if/else-blocks. But this > actually matches the state machine of the driver to the best of our > knowledge. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > --- > > Tested with an Ironhide board (R-Car X5H) and the attached temp sensor > on bus I3C0. Also no regressions seen with a RZ/G3S based board. > > drivers/i3c/master/renesas-i3c.c | 84 +++++++++++++++++++++++++++++--- > 1 file changed, 77 insertions(+), 7 deletions(-) > > diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c > index 5719b78f0503..e11107454004 100644 > --- a/drivers/i3c/master/renesas-i3c.c > +++ b/drivers/i3c/master/renesas-i3c.c > @@ -21,6 +21,7 @@ > #include <linux/list.h> > #include <linux/module.h> > #include <linux/of.h> > +#include <linux/of_irq.h> > #include <linux/platform_device.h> > #include <linux/pm_runtime.h> > #include <linux/reset.h> > @@ -197,6 +198,19 @@ > #define NDBSTLV0 0x398 > #define NDBSTLV0_RDBLV(x) FIELD_GET(GENMASK(15, 8), x) > > +#define INTCLR 0x400 > +#define INTCLR_INTRESP BIT(0) > +#define INTCLR_INTCMD BIT(1) > +#define INTCLR_INTIBI BIT(2) > +#define INTCLR_INTRX0 BIT(3) > +#define INTCLR_INTTX0 BIT(4) > +#define INTCLR_INTRCV BIT(5) > +#define INTCLR_INTHRESP BIT(6) > +#define INTCLR_INTHCMD BIT(7) > +#define INTCLR_INTHRX BIT(8) > +#define INTCLR_INTHTX BIT(9) > +#define INTCLR_ALL GENMASK(9, 0) > + > #define RENESAS_I3C_MAX_DEVS 8 > #define I2C_INIT_MSG -1 > > @@ -1427,6 +1441,52 @@ static irqreturn_t renesas_i3c_start_isr(int irq, void *data) > return IRQ_HANDLED; > } > > +static irqreturn_t renesas_i3c_main_isr(int irq, void *data) > +{ > + struct renesas_i3c *i3c = data; > + > + u32 ntst, bst, ntst_filterd, bst_filterd; > + irqreturn_t ret = IRQ_NONE; > + > + ntst = renesas_readl(i3c->regs, NTST); > + ntst_filterd = ntst & renesas_readl(i3c->regs, NTIE); > + bst = renesas_readl(i3c->regs, BST); > + bst_filterd = bst & renesas_readl(i3c->regs, BIE); Need clean irqs before call renesas_i3c_tx*(); irq handle mang generate new irq, so irq missed. > + > + if (ntst_filterd & NTST_TDBEF0) { > + ret |= renesas_i3c_tx_isr(irq, data); > + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTTX0); > + } > + > + if (ntst_filterd & NTST_RDBFF0) { > + ret |= renesas_i3c_rx_isr(irq, data); > + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRX0); > + } > + > + if (ntst_filterd & NTST_RSPQFF) { > + ret |= renesas_i3c_resp_isr(irq, data); > + renesas_set_bit(i3c->regs, INTCLR, INTCLR_INTRESP); > + } > + > + if (ntst_filterd & ~(NTST_RSPQFF | NTST_RDBFF0 | NTST_TDBEF0)) { > + renesas_writel(i3c->regs, INTCLR, INTCLR_ALL); > + ret |= IRQ_HANDLED; > + } > + > + if (bst_filterd & BST_STCNDDF) { > + ret |= renesas_i3c_start_isr(irq, data); > + } else if (bst_filterd & BST_SPCNDDF) { > + ret |= renesas_i3c_stop_isr(irq, data); > + } else if (bst_filterd & BST_TENDF || bst_filterd & BST_NACKDF) { > + ret |= renesas_i3c_tend_isr(irq, data); > + } else { > + renesas_clear_bit(i3c->regs, BST, bst); Most irq status is w1c. are sure clear bit? some hardware may use read clean for irq status. Frank > + ret |= IRQ_HANDLED; > + } > + > + return ret; > +} > + > static const struct i3c_master_controller_ops renesas_i3c_ops = { > .bus_init = renesas_i3c_bus_init, > .bus_cleanup = renesas_i3c_bus_cleanup, > @@ -1442,7 +1502,7 @@ static const struct i3c_master_controller_ops renesas_i3c_ops = { > .i2c_xfers = renesas_i3c_i2c_xfers, > }; > > -static const struct renesas_i3c_irq_desc renesas_i3c_irqs[] = { > +static const struct renesas_i3c_irq_desc renesas_i3c_multiple_irqs[] = { > { .name = "resp", .isr = renesas_i3c_resp_isr, .desc = "i3c-resp" }, > { .name = "rx", .isr = renesas_i3c_rx_isr, .desc = "i3c-rx" }, > { .name = "tx", .isr = renesas_i3c_tx_isr, .desc = "i3c-tx" }, > @@ -1450,12 +1510,19 @@ static const struct renesas_i3c_irq_desc renesas_i3c_irqs[] = { > { .name = "sp", .isr = renesas_i3c_stop_isr, .desc = "i3c-stop" }, > { .name = "tend", .isr = renesas_i3c_tend_isr, .desc = "i3c-tend" }, > { .name = "nack", .isr = renesas_i3c_tend_isr, .desc = "i3c-nack" }, > + { /* sentinel */ } > +}; > + > +static const struct renesas_i3c_irq_desc renesas_i3c_single_irq[] = { > + { .name = "main", .isr = renesas_i3c_main_isr, .desc = "i3c-main" }, > + { /* sentinel */ } > }; > > static int renesas_i3c_probe(struct platform_device *pdev) > { > + const struct renesas_i3c_irq_desc *irq_desc; > struct renesas_i3c *i3c; > - int ret, i; > + int ret, i, num_irqs; > > i3c = devm_kzalloc_obj(&pdev->dev, *i3c); > if (!i3c) > @@ -1493,20 +1560,22 @@ static int renesas_i3c_probe(struct platform_device *pdev) > if (ret) > return ret; > > - for (i = 0; i < ARRAY_SIZE(renesas_i3c_irqs); i++) { > + num_irqs = of_irq_count(pdev->dev.of_node); > + irq_desc = num_irqs == 1 ? renesas_i3c_single_irq : renesas_i3c_multiple_irqs; > + > + for (i = 0; irq_desc[i].name; i++) { > const char *irqname; > > - ret = platform_get_irq_byname(pdev, renesas_i3c_irqs[i].name); > + ret = platform_get_irq_byname(pdev, irq_desc[i].name); > if (ret < 0) > return ret; > > irqname = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%s:%s", dev_name(&pdev->dev), > - renesas_i3c_irqs[i].desc); > + irq_desc[i].desc); > if (!irqname) > return -ENOMEM; > > - ret = devm_request_irq(&pdev->dev, ret, renesas_i3c_irqs[i].isr, > - 0, irqname, i3c); > + ret = devm_request_irq(&pdev->dev, ret, irq_desc[i].isr, 0, irqname, i3c); > if (ret) > return ret; > } > @@ -1615,6 +1684,7 @@ static const struct dev_pm_ops renesas_i3c_pm_ops = { > static const struct of_device_id renesas_i3c_of_ids[] = { > { .compatible = "renesas,r9a08g045-i3c" }, > { .compatible = "renesas,r9a09g047-i3c" }, > + { .compatible = "renesas,rcar-gen5-i3c" }, > { /* sentinel */ }, > }; > MODULE_DEVICE_TABLE(of, renesas_i3c_of_ids); > -- > 2.53.0 > -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-01 21:55 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-01 9:52 [PATCH 0/2] i3c: renesas: add R-Car Gen5 support Wolfram Sang 2026-12-01 9:52 ` [PATCH 1/2] dt-bindings: i3c: renesas,i3c: " Wolfram Sang 2026-12-01 21:12 ` Frank Li 2026-12-01 9:52 ` [PATCH 2/2] i3c: renesas: " Wolfram Sang 2026-12-01 10:14 ` sashiko-bot 2026-12-01 21:55 ` Frank Li
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox