devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs
@ 2025-06-13 11:38 Prabhakar
  2025-06-13 11:38 ` [PATCH v3 1/6] dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to the end Prabhakar
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Prabhakar @ 2025-06-13 11:38 UTC (permalink / raw)
  To: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang
  Cc: linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Hi All,

This patch series adds support for I2C Bus Interface (RIIC) found on
the Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs. The RIIC
IP on these SoCs is similar to that on the RZ/V2H(P) SoC but has some
differences in interrupt handling and does not require resets.

v2->v3:
- Replaced `Transmit Error` -> `Transfer Error`
- Fixed the order of interrupts in the DT binding
  documentation to match the HW manual.

v1-> v2:
- Added Acked-by, Reviewed-by and Tested-by tags.
- Listed the interrupts in the order as mentioned in the
  HW manual.
- Renamed the interrupt names to match the HW manual.
- Initialized the members of `riic_of_data` in the order they are
  declared in the struct.

Cheers,
Prabhakar

Lad Prabhakar (6):
  dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to
    the end
  dt-bindings: i2c: renesas,riic: Document RZ/T2H support
  dt-bindings: i2c: renesas,riic: Document RZ/N2H support
  i2c: riic: Pass IRQ desc array as part of OF data
  i2c: riic: Move generic compatible string to end of array
  i2c: riic: Add support for RZ/T2H SoC

 .../devicetree/bindings/i2c/renesas,riic.yaml | 105 ++++++++++++------
 drivers/i2c/busses/i2c-riic.c                 |  54 +++++++--
 2 files changed, 117 insertions(+), 42 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v3 1/6] dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to the end
  2025-06-13 11:38 [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs Prabhakar
@ 2025-06-13 11:38 ` Prabhakar
  2025-06-13 11:38 ` [PATCH v3 2/6] dt-bindings: i2c: renesas,riic: Document RZ/T2H support Prabhakar
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Prabhakar @ 2025-06-13 11:38 UTC (permalink / raw)
  To: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang
  Cc: linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar, Conor Dooley

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

In preparation for adding more validation checks, move the `$ref` for
'i2c-controller.yaml' to the end of the file. Also, relocate the
conditional check for 'resets' into the 'allOf' block.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2->v3:
- No changes.

v1->v2:
- Added Acked-by and Reviewed-by tags.
---
 .../devicetree/bindings/i2c/renesas,riic.yaml | 30 +++++++++----------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
index cc39511a49d6..bfcc400655dc 100644
--- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
+++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
@@ -10,9 +10,6 @@ maintainers:
   - Chris Brandt <chris.brandt@renesas.com>
   - Wolfram Sang <wsa+renesas@sang-engineering.com>
 
-allOf:
-  - $ref: /schemas/i2c/i2c-controller.yaml#
-
 properties:
   compatible:
     oneOf:
@@ -84,18 +81,21 @@ required:
   - '#address-cells'
   - '#size-cells'
 
-if:
-  properties:
-    compatible:
-      contains:
-        enum:
-          - renesas,riic-r9a07g043
-          - renesas,riic-r9a07g044
-          - renesas,riic-r9a07g054
-          - renesas,riic-r9a09g057
-then:
-  required:
-    - resets
+allOf:
+  - $ref: /schemas/i2c/i2c-controller.yaml#
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,riic-r9a07g043
+              - renesas,riic-r9a07g044
+              - renesas,riic-r9a07g054
+              - renesas,riic-r9a09g057
+    then:
+      required:
+        - resets
 
 unevaluatedProperties: false
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 2/6] dt-bindings: i2c: renesas,riic: Document RZ/T2H support
  2025-06-13 11:38 [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs Prabhakar
  2025-06-13 11:38 ` [PATCH v3 1/6] dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to the end Prabhakar
@ 2025-06-13 11:38 ` Prabhakar
  2025-06-19 13:50   ` Geert Uytterhoeven
  2025-06-13 11:38 ` [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support Prabhakar
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Prabhakar @ 2025-06-13 11:38 UTC (permalink / raw)
  To: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang
  Cc: linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar, Conor Dooley

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Document support for the I2C Bus Interface (RIIC) found on the Renesas
RZ/T2H (R9A09G077) SoC. The RIIC IP on this SoC is similar to that on
the RZ/V2H(P) SoC but supports fewer interrupts, lacks FM+ support and
does not require resets. Due to these differences, add a new compatible
string `renesas,riic-r9a09g077` for the RZ/T2H SoC.

Unlike earlier SoCs that use eight distinct interrupts, the RZ/T2H uses
only four, including a combined error/event interrupt. Update the binding
schema to reflect this interrupt layout and skip the `resets` property
check, as it is not required on these SoCs.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
v2->v3:
- Replaced Transmit Error -> `Transfer Error`
- Fixed the order of interrupts in the DT binding
  documentation to match the HW manual.

v1-> v2:
- Listed the interrupts in the order as mentioned in the
  HW manual.
- Renamed the interrupt names to match the HW manual.
- Added Acked-by and Reviewed-by tags.
---
 .../devicetree/bindings/i2c/renesas,riic.yaml | 71 ++++++++++++++-----
 1 file changed, 52 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
index bfcc400655dc..86d79e167547 100644
--- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
+++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
@@ -29,32 +29,46 @@ properties:
               - renesas,riic-r9a09g056   # RZ/V2N
           - const: renesas,riic-r9a09g057   # RZ/V2H(P)
 
-      - const: renesas,riic-r9a09g057   # RZ/V2H(P)
+      - enum:
+          - renesas,riic-r9a09g057   # RZ/V2H(P)
+          - renesas,riic-r9a09g077   # RZ/T2H
 
   reg:
     maxItems: 1
 
   interrupts:
-    items:
-      - description: Transmit End Interrupt
-      - description: Receive Data Full Interrupt
-      - description: Transmit Data Empty Interrupt
-      - description: Stop Condition Detection Interrupt
-      - description: Start Condition Detection Interrupt
-      - description: NACK Reception Interrupt
-      - description: Arbitration-Lost Interrupt
-      - description: Timeout Interrupt
+    oneOf:
+      - items:
+          - description: Transmit End Interrupt
+          - description: Receive Data Full Interrupt
+          - description: Transmit Data Empty Interrupt
+          - description: Stop Condition Detection Interrupt
+          - description: Start Condition Detection Interrupt
+          - description: NACK Reception Interrupt
+          - description: Arbitration-Lost Interrupt
+          - description: Timeout Interrupt
+      - items:
+          - description: Transfer Error Or Event Generation
+          - description: Receive Data Full Interrupt
+          - description: Transmit Data Empty Interrupt
+          - description: Transmit End Interrupt
 
   interrupt-names:
-    items:
-      - const: tei
-      - const: ri
-      - const: ti
-      - const: spi
-      - const: sti
-      - const: naki
-      - const: ali
-      - const: tmoi
+    oneOf:
+      - items:
+          - const: tei
+          - const: ri
+          - const: ti
+          - const: spi
+          - const: sti
+          - const: naki
+          - const: ali
+          - const: tmoi
+      - items:
+          - const: eei
+          - const: rxi
+          - const: txi
+          - const: tei
 
   clock-frequency:
     description:
@@ -84,6 +98,25 @@ required:
 allOf:
   - $ref: /schemas/i2c/i2c-controller.yaml#
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,riic-r9a09g077
+    then:
+      properties:
+        interrupts:
+          maxItems: 4
+        interrupt-names:
+          maxItems: 4
+        resets: false
+    else:
+      properties:
+        interrupts:
+          minItems: 8
+        interrupt-names:
+          minItems: 8
+
   - if:
       properties:
         compatible:
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support
  2025-06-13 11:38 [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs Prabhakar
  2025-06-13 11:38 ` [PATCH v3 1/6] dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to the end Prabhakar
  2025-06-13 11:38 ` [PATCH v3 2/6] dt-bindings: i2c: renesas,riic: Document RZ/T2H support Prabhakar
@ 2025-06-13 11:38 ` Prabhakar
  2025-06-17  7:13   ` Krzysztof Kozlowski
  2025-06-13 11:38 ` [PATCH v3 4/6] i2c: riic: Pass IRQ desc array as part of OF data Prabhakar
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Prabhakar @ 2025-06-13 11:38 UTC (permalink / raw)
  To: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang
  Cc: linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar, Conor Dooley

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Document support for the I2C Bus Interface (RIIC) found on the Renesas
RZ/N2H (R9A09G087) SoC. The RIIC IP on this SoC is identical to that on
the RZ/T2H SoC so `renesas,riic-r9a09g077` will be used as a fallback
compatible.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 Documentation/devicetree/bindings/i2c/renesas,riic.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
index 86d79e167547..6876eade431b 100644
--- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
+++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
@@ -33,6 +33,10 @@ properties:
           - renesas,riic-r9a09g057   # RZ/V2H(P)
           - renesas,riic-r9a09g077   # RZ/T2H
 
+      - items:
+          - const: renesas,riic-r9a09g087  # RZ/N2H
+          - const: renesas,riic-r9a09g077  # RZ/T2H
+
   reg:
     maxItems: 1
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 4/6] i2c: riic: Pass IRQ desc array as part of OF data
  2025-06-13 11:38 [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (2 preceding siblings ...)
  2025-06-13 11:38 ` [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support Prabhakar
@ 2025-06-13 11:38 ` Prabhakar
  2025-06-13 11:38 ` [PATCH v3 5/6] i2c: riic: Move generic compatible string to end of array Prabhakar
  2025-06-13 11:38 ` [PATCH v3 6/6] i2c: riic: Add support for RZ/T2H SoC Prabhakar
  5 siblings, 0 replies; 11+ messages in thread
From: Prabhakar @ 2025-06-13 11:38 UTC (permalink / raw)
  To: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang
  Cc: linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

In preparation for adding support for Renesas RZ/T2H and RZ/N2H SoCs,
which feature a combined error interrupt instead of individual error
interrupts per condition, update the driver to support configurable IRQ
layouts via OF data.

Introduce a new `irqs` field and `num_irqs` count in `riic_of_data` to
allow future SoCs to provide a custom IRQ layout. This patch is a
non-functional change for existing SoCs and maintains compatibility with
the current `riic_irqs` array.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> # on RZ/A1
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
---
v2->v3:
- No changes.

v1->v2:
- Added Acked-by and Reviewed-by tags.
---
 drivers/i2c/busses/i2c-riic.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
index 23375f7fe3ad..ecd1c78eecfd 100644
--- a/drivers/i2c/busses/i2c-riic.c
+++ b/drivers/i2c/busses/i2c-riic.c
@@ -102,6 +102,8 @@ enum riic_reg_list {
 
 struct riic_of_data {
 	const u8 *regs;
+	const struct riic_irq_desc *irqs;
+	u8 num_irqs;
 	bool fast_mode_plus;
 };
 
@@ -520,21 +522,23 @@ static int riic_i2c_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(riic->rstc),
 				     "failed to acquire deasserted reset\n");
 
-	for (i = 0; i < ARRAY_SIZE(riic_irqs); i++) {
+	riic->info = of_device_get_match_data(dev);
+
+	for (i = 0; i < riic->info->num_irqs; i++) {
+		const struct riic_irq_desc *irq_desc;
 		int irq;
 
-		irq = platform_get_irq(pdev, riic_irqs[i].res_num);
+		irq_desc = &riic->info->irqs[i];
+		irq = platform_get_irq(pdev, irq_desc->res_num);
 		if (irq < 0)
 			return irq;
 
-		ret = devm_request_irq(dev, irq, riic_irqs[i].isr,
-				       0, riic_irqs[i].name, riic);
+		ret = devm_request_irq(dev, irq, irq_desc->isr, 0, irq_desc->name, riic);
 		if (ret)
 			return dev_err_probe(dev, ret, "failed to request irq %s\n",
-					     riic_irqs[i].name);
+					     irq_desc->name);
 	}
 
-	riic->info = of_device_get_match_data(dev);
 
 	adap = &riic->adapter;
 	i2c_set_adapdata(adap, riic);
@@ -606,11 +610,15 @@ static const u8 riic_rz_a_regs[RIIC_REG_END] = {
 
 static const struct riic_of_data riic_rz_a_info = {
 	.regs = riic_rz_a_regs,
+	.irqs = riic_irqs,
+	.num_irqs = ARRAY_SIZE(riic_irqs),
 	.fast_mode_plus = true,
 };
 
 static const struct riic_of_data riic_rz_a1h_info = {
 	.regs = riic_rz_a_regs,
+	.irqs = riic_irqs,
+	.num_irqs = ARRAY_SIZE(riic_irqs),
 };
 
 static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {
@@ -630,6 +638,8 @@ static const u8 riic_rz_v2h_regs[RIIC_REG_END] = {
 
 static const struct riic_of_data riic_rz_v2h_info = {
 	.regs = riic_rz_v2h_regs,
+	.irqs = riic_irqs,
+	.num_irqs = ARRAY_SIZE(riic_irqs),
 	.fast_mode_plus = true,
 };
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 5/6] i2c: riic: Move generic compatible string to end of array
  2025-06-13 11:38 [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (3 preceding siblings ...)
  2025-06-13 11:38 ` [PATCH v3 4/6] i2c: riic: Pass IRQ desc array as part of OF data Prabhakar
@ 2025-06-13 11:38 ` Prabhakar
  2025-06-13 11:38 ` [PATCH v3 6/6] i2c: riic: Add support for RZ/T2H SoC Prabhakar
  5 siblings, 0 replies; 11+ messages in thread
From: Prabhakar @ 2025-06-13 11:38 UTC (permalink / raw)
  To: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang
  Cc: linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Reorder the entry in `riic_i2c_dt_ids` to place the generic compatible
string `renesas,riic-rz` at the end of the array, following the
convention used in other Renesas drivers.

Also, drop the unnecessary comma after the sentinel entry, as it is
not needed.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> # on RZ/A1
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
---
v2->v3:
- No changes.

v1->v2:
- Initialized the members of `riic_of_data` in the order they are
  declared in the struct.
- Added Reviewed-by and Tested-by tags.
---
 drivers/i2c/busses/i2c-riic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
index ecd1c78eecfd..d0b975e45595 100644
--- a/drivers/i2c/busses/i2c-riic.c
+++ b/drivers/i2c/busses/i2c-riic.c
@@ -693,10 +693,10 @@ static const struct dev_pm_ops riic_i2c_pm_ops = {
 };
 
 static const struct of_device_id riic_i2c_dt_ids[] = {
-	{ .compatible = "renesas,riic-rz", .data = &riic_rz_a_info },
 	{ .compatible = "renesas,riic-r7s72100", .data =  &riic_rz_a1h_info, },
 	{ .compatible = "renesas,riic-r9a09g057", .data = &riic_rz_v2h_info },
-	{ /* Sentinel */ },
+	{ .compatible = "renesas,riic-rz", .data = &riic_rz_a_info },
+	{ /* Sentinel */ }
 };
 
 static struct platform_driver riic_i2c_driver = {
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v3 6/6] i2c: riic: Add support for RZ/T2H SoC
  2025-06-13 11:38 [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs Prabhakar
                   ` (4 preceding siblings ...)
  2025-06-13 11:38 ` [PATCH v3 5/6] i2c: riic: Move generic compatible string to end of array Prabhakar
@ 2025-06-13 11:38 ` Prabhakar
  5 siblings, 0 replies; 11+ messages in thread
From: Prabhakar @ 2025-06-13 11:38 UTC (permalink / raw)
  To: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang
  Cc: linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Prabhakar,
	Biju Das, Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add support for the Renesas RZ/T2H (R9A09G077) SoC, which features a
different interrupt layout for the RIIC controller. Unlike other SoCs
with individual error interrupts, RZ/T2H uses a combined error interrupt
(EEI).

Introduce a new IRQ descriptor table for RZ/T2H, along with a custom
ISR (`riic_eei_isr`) to handle STOP and NACK detection from the shared
interrupt.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> # on RZ/A1
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
---
v2->v3:
- No changes.

v1->v2:
- Updated the riic_rzt2h_irqs array to match the order of
  interrupts as mentioned in the DT binding.
- Updated the interrupt names in the riic_rzt2h_irqs array to
  match the HW manual.
- Added Tested-by and Reviewed-by tags.
---
 drivers/i2c/busses/i2c-riic.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
index d0b975e45595..9c164a4b9bb9 100644
--- a/drivers/i2c/busses/i2c-riic.c
+++ b/drivers/i2c/busses/i2c-riic.c
@@ -79,6 +79,7 @@
 #define ICIER_SPIE	BIT(3)
 
 #define ICSR2_NACKF	BIT(4)
+#define ICSR2_STOP	BIT(3)
 
 #define ICBR_RESERVED	GENMASK(7, 5) /* Should be 1 on writes */
 
@@ -326,6 +327,19 @@ static irqreturn_t riic_stop_isr(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
+static irqreturn_t riic_eei_isr(int irq, void *data)
+{
+	u8 icsr2 = riic_readb(data, RIIC_ICSR2);
+
+	if (icsr2 & ICSR2_NACKF)
+		return riic_tend_isr(irq, data);
+
+	if (icsr2 & ICSR2_STOP)
+		return riic_stop_isr(irq, data);
+
+	return IRQ_NONE;
+}
+
 static u32 riic_func(struct i2c_adapter *adap)
 {
 	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
@@ -497,6 +511,13 @@ static const struct riic_irq_desc riic_irqs[] = {
 	{ .res_num = 5, .isr = riic_tend_isr, .name = "riic-nack" },
 };
 
+static const struct riic_irq_desc riic_rzt2h_irqs[] = {
+	{ .res_num = 0, .isr = riic_eei_isr,  .name = "riic-eei" },
+	{ .res_num = 1, .isr = riic_rdrf_isr, .name = "riic-rxi" },
+	{ .res_num = 2, .isr = riic_tdre_isr, .name = "riic-txi" },
+	{ .res_num = 3, .isr = riic_tend_isr, .name = "riic-tei" },
+};
+
 static int riic_i2c_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -643,6 +664,12 @@ static const struct riic_of_data riic_rz_v2h_info = {
 	.fast_mode_plus = true,
 };
 
+static const struct riic_of_data riic_rz_t2h_info = {
+	.regs = riic_rz_v2h_regs,
+	.irqs = riic_rzt2h_irqs,
+	.num_irqs = ARRAY_SIZE(riic_rzt2h_irqs),
+};
+
 static int riic_i2c_suspend(struct device *dev)
 {
 	struct riic_dev *riic = dev_get_drvdata(dev);
@@ -695,6 +722,7 @@ static const struct dev_pm_ops riic_i2c_pm_ops = {
 static const struct of_device_id riic_i2c_dt_ids[] = {
 	{ .compatible = "renesas,riic-r7s72100", .data =  &riic_rz_a1h_info, },
 	{ .compatible = "renesas,riic-r9a09g057", .data = &riic_rz_v2h_info },
+	{ .compatible = "renesas,riic-r9a09g077", .data = &riic_rz_t2h_info },
 	{ .compatible = "renesas,riic-rz", .data = &riic_rz_a_info },
 	{ /* Sentinel */ }
 };
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support
  2025-06-13 11:38 ` [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support Prabhakar
@ 2025-06-17  7:13   ` Krzysztof Kozlowski
  2025-06-17  7:15     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-17  7:13 UTC (permalink / raw)
  To: Prabhakar
  Cc: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang, linux-renesas-soc, linux-i2c, devicetree,
	linux-kernel, Biju Das, Fabrizio Castro, Lad Prabhakar,
	Conor Dooley

On Fri, Jun 13, 2025 at 12:38:36PM GMT, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Document support for the I2C Bus Interface (RIIC) found on the Renesas
> RZ/N2H (R9A09G087) SoC. The RIIC IP on this SoC is identical to that on
> the RZ/T2H SoC so `renesas,riic-r9a09g077` will be used as a fallback
> compatible.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  Documentation/devicetree/bindings/i2c/renesas,riic.yaml | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> index 86d79e167547..6876eade431b 100644
> --- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> +++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> @@ -33,6 +33,10 @@ properties:
>            - renesas,riic-r9a09g057   # RZ/V2H(P)
>            - renesas,riic-r9a09g077   # RZ/T2H
>  
> +      - items:
> +          - const: renesas,riic-r9a09g087  # RZ/N2H
> +          - const: renesas,riic-r9a09g077  # RZ/T2H

Where is an entry renesas,riic-r9a09g077 alone? Please add complete
bindings, not half-patch and then next time second half.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support
  2025-06-17  7:13   ` Krzysztof Kozlowski
@ 2025-06-17  7:15     ` Krzysztof Kozlowski
  2025-06-17 13:50       ` Lad, Prabhakar
  0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-17  7:15 UTC (permalink / raw)
  To: Prabhakar
  Cc: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang, linux-renesas-soc, linux-i2c, devicetree,
	linux-kernel, Biju Das, Fabrizio Castro, Lad Prabhakar,
	Conor Dooley

On 17/06/2025 09:13, Krzysztof Kozlowski wrote:
> On Fri, Jun 13, 2025 at 12:38:36PM GMT, Prabhakar wrote:
>> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>>
>> Document support for the I2C Bus Interface (RIIC) found on the Renesas
>> RZ/N2H (R9A09G087) SoC. The RIIC IP on this SoC is identical to that on
>> the RZ/T2H SoC so `renesas,riic-r9a09g077` will be used as a fallback
>> compatible.
>>
>> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>> Acked-by: Conor Dooley <conor.dooley@microchip.com>
>> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>>  Documentation/devicetree/bindings/i2c/renesas,riic.yaml | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
>> index 86d79e167547..6876eade431b 100644
>> --- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
>> +++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
>> @@ -33,6 +33,10 @@ properties:
>>            - renesas,riic-r9a09g057   # RZ/V2H(P)
>>            - renesas,riic-r9a09g077   # RZ/T2H
>>  
>> +      - items:
>> +          - const: renesas,riic-r9a09g087  # RZ/N2H
>> +          - const: renesas,riic-r9a09g077  # RZ/T2H
> 
> Where is an entry renesas,riic-r9a09g077 alone? Please add complete
> bindings, not half-patch and then next time second half.


Ah, sorry, I saw it in patch #2 (the tooling I use jumped straight to
patch #3 so that's the reason).

Anyway, this should be squashed with #2, because it is trivial and
entire 4 lines of commit msg plus 3 reviews is really too much for
something like that. Don't inflate work for us.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support
  2025-06-17  7:15     ` Krzysztof Kozlowski
@ 2025-06-17 13:50       ` Lad, Prabhakar
  0 siblings, 0 replies; 11+ messages in thread
From: Lad, Prabhakar @ 2025-06-17 13:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Geert Uytterhoeven, Andy Shevchenko, Magnus Damm,
	Wolfram Sang, linux-renesas-soc, linux-i2c, devicetree,
	linux-kernel, Biju Das, Fabrizio Castro, Lad Prabhakar,
	Conor Dooley

Hi Krzysztof,

Thank you for the review.

On Tue, Jun 17, 2025 at 8:15 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 17/06/2025 09:13, Krzysztof Kozlowski wrote:
> > On Fri, Jun 13, 2025 at 12:38:36PM GMT, Prabhakar wrote:
> >> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >>
> >> Document support for the I2C Bus Interface (RIIC) found on the Renesas
> >> RZ/N2H (R9A09G087) SoC. The RIIC IP on this SoC is identical to that on
> >> the RZ/T2H SoC so `renesas,riic-r9a09g077` will be used as a fallback
> >> compatible.
> >>
> >> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> >> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> >> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >> ---
> >>  Documentation/devicetree/bindings/i2c/renesas,riic.yaml | 4 ++++
> >>  1 file changed, 4 insertions(+)
> >>
> >> diff --git a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> >> index 86d79e167547..6876eade431b 100644
> >> --- a/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> >> +++ b/Documentation/devicetree/bindings/i2c/renesas,riic.yaml
> >> @@ -33,6 +33,10 @@ properties:
> >>            - renesas,riic-r9a09g057   # RZ/V2H(P)
> >>            - renesas,riic-r9a09g077   # RZ/T2H
> >>
> >> +      - items:
> >> +          - const: renesas,riic-r9a09g087  # RZ/N2H
> >> +          - const: renesas,riic-r9a09g077  # RZ/T2H
> >
> > Where is an entry renesas,riic-r9a09g077 alone? Please add complete
> > bindings, not half-patch and then next time second half.
>
>
> Ah, sorry, I saw it in patch #2 (the tooling I use jumped straight to
> patch #3 so that's the reason).
>
> Anyway, this should be squashed with #2, because it is trivial and
> entire 4 lines of commit msg plus 3 reviews is really too much for
> something like that. Don't inflate work for us.
>
Sure, I'll make a note of it and send a new version with this patch squashed.

Cheers,
Prabhakar

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3 2/6] dt-bindings: i2c: renesas,riic: Document RZ/T2H support
  2025-06-13 11:38 ` [PATCH v3 2/6] dt-bindings: i2c: renesas,riic: Document RZ/T2H support Prabhakar
@ 2025-06-19 13:50   ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2025-06-19 13:50 UTC (permalink / raw)
  To: Prabhakar
  Cc: Chris Brandt, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Andy Shevchenko, Magnus Damm, Wolfram Sang,
	linux-renesas-soc, linux-i2c, devicetree, linux-kernel, Biju Das,
	Fabrizio Castro, Lad Prabhakar, Conor Dooley

On Fri, 13 Jun 2025 at 13:40, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Document support for the I2C Bus Interface (RIIC) found on the Renesas
> RZ/T2H (R9A09G077) SoC. The RIIC IP on this SoC is similar to that on
> the RZ/V2H(P) SoC but supports fewer interrupts, lacks FM+ support and
> does not require resets. Due to these differences, add a new compatible
> string `renesas,riic-r9a09g077` for the RZ/T2H SoC.
>
> Unlike earlier SoCs that use eight distinct interrupts, the RZ/T2H uses
> only four, including a combined error/event interrupt. Update the binding
> schema to reflect this interrupt layout and skip the `resets` property
> check, as it is not required on these SoCs.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> v2->v3:
> - Replaced Transmit Error -> `Transfer Error`
> - Fixed the order of interrupts in the DT binding
>   documentation to match the HW manual.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-06-19 13:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13 11:38 [PATCH v3 0/6] Add RIIC support for RZ/T2H and RZ/N2H SoCs Prabhakar
2025-06-13 11:38 ` [PATCH v3 1/6] dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to the end Prabhakar
2025-06-13 11:38 ` [PATCH v3 2/6] dt-bindings: i2c: renesas,riic: Document RZ/T2H support Prabhakar
2025-06-19 13:50   ` Geert Uytterhoeven
2025-06-13 11:38 ` [PATCH v3 3/6] dt-bindings: i2c: renesas,riic: Document RZ/N2H support Prabhakar
2025-06-17  7:13   ` Krzysztof Kozlowski
2025-06-17  7:15     ` Krzysztof Kozlowski
2025-06-17 13:50       ` Lad, Prabhakar
2025-06-13 11:38 ` [PATCH v3 4/6] i2c: riic: Pass IRQ desc array as part of OF data Prabhakar
2025-06-13 11:38 ` [PATCH v3 5/6] i2c: riic: Move generic compatible string to end of array Prabhakar
2025-06-13 11:38 ` [PATCH v3 6/6] i2c: riic: Add support for RZ/T2H SoC Prabhakar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).