All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Add SPI Multi I/O Bus Controller support for RZ/G2L
@ 2021-09-28 14:07 ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

Hi All,

This patch series adds a couple of fixes for rpc-if driver and
adds support for RZ/G2L SoC, where the SPI Multi I/O Bus Controller
is identical to the RPC-IF block found on R-Car Gen3 SoC's.

Note: patch applies on top of [1].

[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/
20210922091007.5516-1-wsa+renesas@sang-engineering.com/

Cheers,
Prabhakar

Lad Prabhakar (6):
  dt-bindings: memory: renesas,rpc-if: Add support for the R9A07G044
  dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
  spi: spi-rpc-if: Check return value of rpcif_sw_init()
  mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
  memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
  memory: renesas-rpc-if: Add support for RZ/G2L

 .../memory-controllers/renesas,rpc-if.yaml    | 52 +++++++++----
 drivers/memory/renesas-rpc-if.c               | 73 +++++++++++++++----
 drivers/mtd/hyperbus/rpc-if.c                 |  8 +-
 drivers/spi/spi-rpc-if.c                      |  8 +-
 include/memory/renesas-rpc-if.h               |  8 +-
 5 files changed, 116 insertions(+), 33 deletions(-)

-- 
2.17.1


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

* [PATCH 0/6] Add SPI Multi I/O Bus Controller support for RZ/G2L
@ 2021-09-28 14:07 ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

Hi All,

This patch series adds a couple of fixes for rpc-if driver and
adds support for RZ/G2L SoC, where the SPI Multi I/O Bus Controller
is identical to the RPC-IF block found on R-Car Gen3 SoC's.

Note: patch applies on top of [1].

[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/
20210922091007.5516-1-wsa+renesas@sang-engineering.com/

Cheers,
Prabhakar

Lad Prabhakar (6):
  dt-bindings: memory: renesas,rpc-if: Add support for the R9A07G044
  dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
  spi: spi-rpc-if: Check return value of rpcif_sw_init()
  mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
  memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
  memory: renesas-rpc-if: Add support for RZ/G2L

 .../memory-controllers/renesas,rpc-if.yaml    | 52 +++++++++----
 drivers/memory/renesas-rpc-if.c               | 73 +++++++++++++++----
 drivers/mtd/hyperbus/rpc-if.c                 |  8 +-
 drivers/spi/spi-rpc-if.c                      |  8 +-
 include/memory/renesas-rpc-if.h               |  8 +-
 5 files changed, 116 insertions(+), 33 deletions(-)

-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 1/6] dt-bindings: memory: renesas,rpc-if: Add support for the R9A07G044
  2021-09-28 14:07 ` Lad Prabhakar
@ 2021-09-28 14:07   ` Lad Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
the RPC-IF interface found on R-Car Gen3 SoC's.

This patch adds a new compatible string to identify the RZ/G2L family
so that the timing values on RZ/G2L can be adjusted.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../memory-controllers/renesas,rpc-if.yaml    | 51 ++++++++++++++-----
 1 file changed, 37 insertions(+), 14 deletions(-)

diff --git a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
index d25072c414e4..105b5157989b 100644
--- a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
+++ b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
@@ -24,16 +24,22 @@ allOf:
 
 properties:
   compatible:
-    items:
-      - enum:
-          - renesas,r8a774a1-rpc-if       # RZ/G2M
-          - renesas,r8a774b1-rpc-if       # RZ/G2N
-          - renesas,r8a774c0-rpc-if       # RZ/G2E
-          - renesas,r8a774e1-rpc-if       # RZ/G2H
-          - renesas,r8a77970-rpc-if       # R-Car V3M
-          - renesas,r8a77980-rpc-if       # R-Car V3H
-          - renesas,r8a77995-rpc-if       # R-Car D3
-      - const: renesas,rcar-gen3-rpc-if   # a generic R-Car gen3 or RZ/G2 device
+    oneOf:
+      - items:
+          - enum:
+              - renesas,r8a774a1-rpc-if       # RZ/G2M
+              - renesas,r8a774b1-rpc-if       # RZ/G2N
+              - renesas,r8a774c0-rpc-if       # RZ/G2E
+              - renesas,r8a774e1-rpc-if       # RZ/G2H
+              - renesas,r8a77970-rpc-if       # R-Car V3M
+              - renesas,r8a77980-rpc-if       # R-Car V3H
+              - renesas,r8a77995-rpc-if       # R-Car D3
+          - const: renesas,rcar-gen3-rpc-if   # a generic R-Car gen3 or RZ/G2{E,H,M,N} device
+
+      - items:
+          - enum:
+              - renesas,r9a07g044-rpc-if      # RZ/G2{L,LC}
+          - const: renesas,rzg2l-rpc-if       # RZ/G2L family
 
   reg:
     items:
@@ -47,8 +53,7 @@ properties:
       - const: dirmap
       - const: wbuf
 
-  clocks:
-    maxItems: 1
+  clocks: true
 
   power-domains:
     maxItems: 1
@@ -66,8 +71,6 @@ patternProperties:
             - cfi-flash
             - jedec,spi-nor
 
-unevaluatedProperties: false
-
 required:
   - compatible
   - reg
@@ -78,6 +81,26 @@ required:
   - '#address-cells'
   - '#size-cells'
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - renesas,rzg2l-rpc-if
+then:
+  properties:
+    clocks:
+      items:
+        - description: SPI Multi IO Register access clock (SPI_CLK2)
+        - description: SPI Multi IO Main clock (SPI_CLK).
+
+else:
+  properties:
+    clocks:
+      maxItems: 1
+
+unevaluatedProperties: false
+
 examples:
   - |
     #include <dt-bindings/clock/renesas-cpg-mssr.h>
-- 
2.17.1


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

* [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: Add support for the R9A07G044
@ 2021-09-28 14:07   ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
the RPC-IF interface found on R-Car Gen3 SoC's.

This patch adds a new compatible string to identify the RZ/G2L family
so that the timing values on RZ/G2L can be adjusted.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../memory-controllers/renesas,rpc-if.yaml    | 51 ++++++++++++++-----
 1 file changed, 37 insertions(+), 14 deletions(-)

diff --git a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
index d25072c414e4..105b5157989b 100644
--- a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
+++ b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
@@ -24,16 +24,22 @@ allOf:
 
 properties:
   compatible:
-    items:
-      - enum:
-          - renesas,r8a774a1-rpc-if       # RZ/G2M
-          - renesas,r8a774b1-rpc-if       # RZ/G2N
-          - renesas,r8a774c0-rpc-if       # RZ/G2E
-          - renesas,r8a774e1-rpc-if       # RZ/G2H
-          - renesas,r8a77970-rpc-if       # R-Car V3M
-          - renesas,r8a77980-rpc-if       # R-Car V3H
-          - renesas,r8a77995-rpc-if       # R-Car D3
-      - const: renesas,rcar-gen3-rpc-if   # a generic R-Car gen3 or RZ/G2 device
+    oneOf:
+      - items:
+          - enum:
+              - renesas,r8a774a1-rpc-if       # RZ/G2M
+              - renesas,r8a774b1-rpc-if       # RZ/G2N
+              - renesas,r8a774c0-rpc-if       # RZ/G2E
+              - renesas,r8a774e1-rpc-if       # RZ/G2H
+              - renesas,r8a77970-rpc-if       # R-Car V3M
+              - renesas,r8a77980-rpc-if       # R-Car V3H
+              - renesas,r8a77995-rpc-if       # R-Car D3
+          - const: renesas,rcar-gen3-rpc-if   # a generic R-Car gen3 or RZ/G2{E,H,M,N} device
+
+      - items:
+          - enum:
+              - renesas,r9a07g044-rpc-if      # RZ/G2{L,LC}
+          - const: renesas,rzg2l-rpc-if       # RZ/G2L family
 
   reg:
     items:
@@ -47,8 +53,7 @@ properties:
       - const: dirmap
       - const: wbuf
 
-  clocks:
-    maxItems: 1
+  clocks: true
 
   power-domains:
     maxItems: 1
@@ -66,8 +71,6 @@ patternProperties:
             - cfi-flash
             - jedec,spi-nor
 
-unevaluatedProperties: false
-
 required:
   - compatible
   - reg
@@ -78,6 +81,26 @@ required:
   - '#address-cells'
   - '#size-cells'
 
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - renesas,rzg2l-rpc-if
+then:
+  properties:
+    clocks:
+      items:
+        - description: SPI Multi IO Register access clock (SPI_CLK2)
+        - description: SPI Multi IO Main clock (SPI_CLK).
+
+else:
+  properties:
+    clocks:
+      maxItems: 1
+
+unevaluatedProperties: false
+
 examples:
   - |
     #include <dt-bindings/clock/renesas-cpg-mssr.h>
-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
  2021-09-28 14:07 ` Lad Prabhakar
@ 2021-09-28 14:07   ` Lad Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

For completeness add optional interrupts property.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../devicetree/bindings/memory-controllers/renesas,rpc-if.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
index 105b5157989b..fd1ecbb6c94d 100644
--- a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
+++ b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
@@ -55,6 +55,9 @@ properties:
 
   clocks: true
 
+  interrupts:
+    maxItems: 1
+
   power-domains:
     maxItems: 1
 
-- 
2.17.1


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

* [PATCH 2/6] dt-bindings: memory: renesas, rpc-if: Add optional interrupts property
@ 2021-09-28 14:07   ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

For completeness add optional interrupts property.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 .../devicetree/bindings/memory-controllers/renesas,rpc-if.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
index 105b5157989b..fd1ecbb6c94d 100644
--- a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
+++ b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
@@ -55,6 +55,9 @@ properties:
 
   clocks: true
 
+  interrupts:
+    maxItems: 1
+
   power-domains:
     maxItems: 1
 
-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 3/6] spi: spi-rpc-if: Check return value of rpcif_sw_init()
  2021-09-28 14:07 ` Lad Prabhakar
@ 2021-09-28 14:07   ` Lad Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

rpcif_sw_init() can fail so make sure we check the return value
of it and on error exit rpcif_spi_probe() callback with error code.

Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/spi/spi-rpc-if.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index c53138ce0030..83796a4ead34 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -139,7 +139,9 @@ static int rpcif_spi_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	rpc = spi_controller_get_devdata(ctlr);
-	rpcif_sw_init(rpc, parent);
+	error = rpcif_sw_init(rpc, parent);
+	if (error)
+		return error;
 
 	platform_set_drvdata(pdev, ctlr);
 
-- 
2.17.1


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

* [PATCH 3/6] spi: spi-rpc-if: Check return value of rpcif_sw_init()
@ 2021-09-28 14:07   ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

rpcif_sw_init() can fail so make sure we check the return value
of it and on error exit rpcif_spi_probe() callback with error code.

Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/spi/spi-rpc-if.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index c53138ce0030..83796a4ead34 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -139,7 +139,9 @@ static int rpcif_spi_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	rpc = spi_controller_get_devdata(ctlr);
-	rpcif_sw_init(rpc, parent);
+	error = rpcif_sw_init(rpc, parent);
+	if (error)
+		return error;
 
 	platform_set_drvdata(pdev, ctlr);
 
-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 4/6] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
  2021-09-28 14:07 ` Lad Prabhakar
@ 2021-09-28 14:07   ` Lad Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

rpcif_sw_init() can fail so make sure we check the return value
of it and on error exit rpcif_hb_probe() callback with error code.

Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/mtd/hyperbus/rpc-if.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c
index ecb050ba95cd..367b0d72bf62 100644
--- a/drivers/mtd/hyperbus/rpc-if.c
+++ b/drivers/mtd/hyperbus/rpc-if.c
@@ -124,7 +124,9 @@ static int rpcif_hb_probe(struct platform_device *pdev)
 	if (!hyperbus)
 		return -ENOMEM;
 
-	rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
+	error = rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
+	if (error)
+		return error;
 
 	platform_set_drvdata(pdev, hyperbus);
 
-- 
2.17.1


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

* [PATCH 4/6] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
@ 2021-09-28 14:07   ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

rpcif_sw_init() can fail so make sure we check the return value
of it and on error exit rpcif_hb_probe() callback with error code.

Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/mtd/hyperbus/rpc-if.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c
index ecb050ba95cd..367b0d72bf62 100644
--- a/drivers/mtd/hyperbus/rpc-if.c
+++ b/drivers/mtd/hyperbus/rpc-if.c
@@ -124,7 +124,9 @@ static int rpcif_hb_probe(struct platform_device *pdev)
 	if (!hyperbus)
 		return -ENOMEM;
 
-	rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
+	error = rpcif_sw_init(&hyperbus->rpc, pdev->dev.parent);
+	if (error)
+		return error;
 
 	platform_set_drvdata(pdev, hyperbus);
 
-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
  2021-09-28 14:07 ` Lad Prabhakar
@ 2021-09-28 14:07   ` Lad Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

RPCIF_DIRMAP_SIZE may differ on various SoC's. Instead of using
RPCIF_DIRMAP_SIZE macro use resource size to get dirmap size
which is already part of struct rpcif.

Also make sure we return error in case devm_ioremap_resource()
fails for dirmap.

Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
Fixes: 59e27d7c94aa ("memory: renesas-rpc-if: fix possible NULL pointer dereference of resource")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 77a011d5ff8c..140cb4e2b789 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -147,8 +147,6 @@
 #define RPCIF_PHYINT		0x0088	/* R/W */
 #define RPCIF_PHYINT_WPVAL	BIT(1)
 
-#define RPCIF_DIRMAP_SIZE	0x4000000
-
 static const struct regmap_range rpcif_volatile_ranges[] = {
 	regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
 	regmap_reg_range(RPCIF_SMWDR0, RPCIF_SMWDR1),
@@ -244,7 +242,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
 	rpc->dirmap = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(rpc->dirmap))
-		rpc->dirmap = NULL;
+		return PTR_ERR(rpc->dirmap);
 	rpc->size = resource_size(res);
 
 	rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
@@ -547,8 +545,8 @@ EXPORT_SYMBOL(rpcif_manual_xfer);
 
 ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
 {
-	loff_t from = offs & (RPCIF_DIRMAP_SIZE - 1);
-	size_t size = RPCIF_DIRMAP_SIZE - from;
+	loff_t from = offs & (rpc->size - 1);
+	size_t size = rpc->size - from;
 
 	if (len > size)
 		len = size;
-- 
2.17.1


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

* [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
@ 2021-09-28 14:07   ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

RPCIF_DIRMAP_SIZE may differ on various SoC's. Instead of using
RPCIF_DIRMAP_SIZE macro use resource size to get dirmap size
which is already part of struct rpcif.

Also make sure we return error in case devm_ioremap_resource()
fails for dirmap.

Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
Fixes: 59e27d7c94aa ("memory: renesas-rpc-if: fix possible NULL pointer dereference of resource")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 77a011d5ff8c..140cb4e2b789 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -147,8 +147,6 @@
 #define RPCIF_PHYINT		0x0088	/* R/W */
 #define RPCIF_PHYINT_WPVAL	BIT(1)
 
-#define RPCIF_DIRMAP_SIZE	0x4000000
-
 static const struct regmap_range rpcif_volatile_ranges[] = {
 	regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
 	regmap_reg_range(RPCIF_SMWDR0, RPCIF_SMWDR1),
@@ -244,7 +242,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
 	rpc->dirmap = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(rpc->dirmap))
-		rpc->dirmap = NULL;
+		return PTR_ERR(rpc->dirmap);
 	rpc->size = resource_size(res);
 
 	rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
@@ -547,8 +545,8 @@ EXPORT_SYMBOL(rpcif_manual_xfer);
 
 ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
 {
-	loff_t from = offs & (RPCIF_DIRMAP_SIZE - 1);
-	size_t size = RPCIF_DIRMAP_SIZE - from;
+	loff_t from = offs & (rpc->size - 1);
+	size_t size = rpc->size - from;
 
 	if (len > size)
 		len = size;
-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-09-28 14:07 ` Lad Prabhakar
@ 2021-09-28 14:07   ` Lad Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
the RPC-IF interface found on R-Car Gen3 SoC's.

This patch adds a new compatible string for the RZ/G2L family so
that the timing values on RZ/G2L can be adjusted.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 65 ++++++++++++++++++++++++++++-----
 drivers/mtd/hyperbus/rpc-if.c   |  4 +-
 drivers/spi/spi-rpc-if.c        |  4 +-
 include/memory/renesas-rpc-if.h |  8 +++-
 4 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 140cb4e2b789..47dce166b328 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
 
@@ -24,14 +25,14 @@
 #define RPCIF_CMNCR_MOIIO2(val)	(((val) & 0x3) << 20)
 #define RPCIF_CMNCR_MOIIO1(val)	(((val) & 0x3) << 18)
 #define RPCIF_CMNCR_MOIIO0(val)	(((val) & 0x3) << 16)
-#define RPCIF_CMNCR_MOIIO_HIZ	(RPCIF_CMNCR_MOIIO0(3) | \
-				 RPCIF_CMNCR_MOIIO1(3) | \
-				 RPCIF_CMNCR_MOIIO2(3) | RPCIF_CMNCR_MOIIO3(3))
+#define RPCIF_CMNCR_MOIIO_HIZ(val) (RPCIF_CMNCR_MOIIO0(val) | \
+				 RPCIF_CMNCR_MOIIO1(val) | \
+				 RPCIF_CMNCR_MOIIO2(val) | RPCIF_CMNCR_MOIIO3(val))
 #define RPCIF_CMNCR_IO3FV(val)	(((val) & 0x3) << 14) /* undocumented */
 #define RPCIF_CMNCR_IO2FV(val)	(((val) & 0x3) << 12) /* undocumented */
 #define RPCIF_CMNCR_IO0FV(val)	(((val) & 0x3) << 8)
-#define RPCIF_CMNCR_IOFV_HIZ	(RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
-				 RPCIF_CMNCR_IO3FV(3))
+#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
+				 RPCIF_CMNCR_IO3FV(val))
 #define RPCIF_CMNCR_BSZ(val)	(((val) & 0x3) << 0)
 
 #define RPCIF_SSLDR		0x0004	/* R/W */
@@ -126,6 +127,9 @@
 #define RPCIF_SMDRENR_OPDRE	BIT(4)
 #define RPCIF_SMDRENR_SPIDRE	BIT(0)
 
+#define RPCIF_PHYADJ1		0x0070	/* R/W */
+#define RPCIF_PHYADJ2		0x0074	/* R/W */
+
 #define RPCIF_PHYCNT		0x007C	/* R/W */
 #define RPCIF_PHYCNT_CAL	BIT(31)
 #define RPCIF_PHYCNT_OCTA(v)	(((v) & 0x3) << 22)
@@ -133,10 +137,12 @@
 #define RPCIF_PHYCNT_OCT	BIT(20)
 #define RPCIF_PHYCNT_DDRCAL	BIT(19)
 #define RPCIF_PHYCNT_HS		BIT(18)
+#define RPCIF_PHYCNT_CKSEL(v)	(((v) & 0x3) << 16)
 #define RPCIF_PHYCNT_STRTIM(v)	(((v) & 0x7) << 15)
 #define RPCIF_PHYCNT_WBUF2	BIT(4)
 #define RPCIF_PHYCNT_WBUF	BIT(2)
 #define RPCIF_PHYCNT_PHYMEM(v)	(((v) & 0x3) << 0)
+#define RPCIF_PHYCNT_PHYMEM_MASK GENMASK(1, 0)
 
 #define RPCIF_PHYOFFSET1	0x0080	/* R/W */
 #define RPCIF_PHYOFFSET1_DDRTMG(v) (((v) & 0x3) << 28)
@@ -245,18 +251,46 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
 		return PTR_ERR(rpc->dirmap);
 	rpc->size = resource_size(res);
 
+	rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
 	rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
 
 	return PTR_ERR_OR_ZERO(rpc->rstc);
 }
 EXPORT_SYMBOL(rpcif_sw_init);
 
-void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
+static void rpcif_timing_adjust_sdr(struct rpcif *rpc)
+{
+	u32 data;
+
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0xA5390000);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000000);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000022);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
+
+	regmap_read(rpc->regmap, RPCIF_PHYCNT, &data);
+	regmap_write(rpc->regmap, RPCIF_PHYCNT, data | RPCIF_PHYCNT_CKSEL(3));
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00000030);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000032);
+}
+
+int rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 {
 	u32 dummy;
 
 	pm_runtime_get_sync(rpc->dev);
 
+	if (rpc->type == RPCIF_RZ_G2L) {
+		int ret;
+
+		ret = reset_control_reset(rpc->rstc);
+		if (ret)
+			return ret;
+		usleep_range(200, 300);
+		rpcif_timing_adjust_sdr(rpc);
+	}
+
 	/*
 	 * NOTE: The 0x260 are undocumented bits, but they must be set.
 	 *	 RPCIF_PHYCNT_STRTIM is strobe timing adjustment bits,
@@ -265,8 +299,15 @@ void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 	 *	 On H3 ES1.x, the value should be 0, while on others,
 	 *	 the value should be 7.
 	 */
-	regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
-		     RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
+	if (rpc->type == RPCIF_RCAR_GEN3) {
+		regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
+			     RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
+	} else {
+		regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
+		dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
+		dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
+		regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
+	}
 
 	/*
 	 * NOTE: The 0x1511144 are undocumented bits, but they must be set
@@ -284,7 +325,8 @@ void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 				   RPCIF_PHYINT_WPVAL, 0);
 
 	regmap_write(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_SFDE |
-		     RPCIF_CMNCR_MOIIO_HIZ | RPCIF_CMNCR_IOFV_HIZ |
+		     RPCIF_CMNCR_MOIIO_HIZ(rpc->type == RPCIF_RZ_G2L ? 1 : 3) |
+		     RPCIF_CMNCR_IOFV_HIZ(rpc->type == RPCIF_RZ_G2L ? 2 : 3) |
 		     RPCIF_CMNCR_BSZ(hyperflash ? 1 : 0));
 	/* Set RCF after BSZ update */
 	regmap_write(rpc->regmap, RPCIF_DRCR, RPCIF_DRCR_RCF);
@@ -296,6 +338,8 @@ void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 	pm_runtime_put(rpc->dev);
 
 	rpc->bus_size = hyperflash ? 2 : 1;
+
+	return 0;
 }
 EXPORT_SYMBOL(rpcif_hw_init);
 
@@ -613,7 +657,8 @@ static int rpcif_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id rpcif_of_match[] = {
-	{ .compatible = "renesas,rcar-gen3-rpc-if", },
+	{ .compatible = "renesas,rcar-gen3-rpc-if", .data = (void *)RPCIF_RCAR_GEN3 },
+	{ .compatible = "renesas,rzg2l-rpc-if", .data = (void *)RPCIF_RZ_G2L },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rpcif_of_match);
diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c
index 367b0d72bf62..40bca89268c3 100644
--- a/drivers/mtd/hyperbus/rpc-if.c
+++ b/drivers/mtd/hyperbus/rpc-if.c
@@ -132,7 +132,9 @@ static int rpcif_hb_probe(struct platform_device *pdev)
 
 	rpcif_enable_rpm(&hyperbus->rpc);
 
-	rpcif_hw_init(&hyperbus->rpc, true);
+	error = rpcif_hw_init(&hyperbus->rpc, true);
+	if (error)
+		return error;
 
 	hyperbus->hbdev.map.size = hyperbus->rpc.size;
 	hyperbus->hbdev.map.virt = hyperbus->rpc.dirmap;
diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index 83796a4ead34..fe82f3575df4 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -156,7 +156,9 @@ static int rpcif_spi_probe(struct platform_device *pdev)
 	ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_TX_QUAD | SPI_RX_QUAD;
 	ctlr->flags = SPI_CONTROLLER_HALF_DUPLEX;
 
-	rpcif_hw_init(rpc, false);
+	error = rpcif_hw_init(rpc, false);
+	if (error)
+		return error;
 
 	error = spi_register_controller(ctlr);
 	if (error) {
diff --git a/include/memory/renesas-rpc-if.h b/include/memory/renesas-rpc-if.h
index 77c694a19149..7c93f5177532 100644
--- a/include/memory/renesas-rpc-if.h
+++ b/include/memory/renesas-rpc-if.h
@@ -57,6 +57,11 @@ struct rpcif_op {
 	} data;
 };
 
+enum rpcif_type {
+	RPCIF_RCAR_GEN3,
+	RPCIF_RZ_G2L,
+};
+
 struct rpcif {
 	struct device *dev;
 	void __iomem *base;
@@ -64,6 +69,7 @@ struct rpcif {
 	struct regmap *regmap;
 	struct reset_control *rstc;
 	size_t size;
+	enum rpcif_type type;
 	enum rpcif_data_dir dir;
 	u8 bus_size;
 	void *buffer;
@@ -78,7 +84,7 @@ struct rpcif {
 };
 
 int rpcif_sw_init(struct rpcif *rpc, struct device *dev);
-void rpcif_hw_init(struct rpcif *rpc, bool hyperflash);
+int rpcif_hw_init(struct rpcif *rpc, bool hyperflash);
 void rpcif_prepare(struct rpcif *rpc, const struct rpcif_op *op, u64 *offs,
 		   size_t *len);
 int rpcif_manual_xfer(struct rpcif *rpc);
-- 
2.17.1


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

* [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-09-28 14:07   ` Lad Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad Prabhakar @ 2021-09-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, Wolfram Sang
  Cc: linux-kernel, linux-renesas-soc, Prabhakar, Biju Das, Lad Prabhakar

SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
the RPC-IF interface found on R-Car Gen3 SoC's.

This patch adds a new compatible string for the RZ/G2L family so
that the timing values on RZ/G2L can be adjusted.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 65 ++++++++++++++++++++++++++++-----
 drivers/mtd/hyperbus/rpc-if.c   |  4 +-
 drivers/spi/spi-rpc-if.c        |  4 +-
 include/memory/renesas-rpc-if.h |  8 +++-
 4 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 140cb4e2b789..47dce166b328 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
 
@@ -24,14 +25,14 @@
 #define RPCIF_CMNCR_MOIIO2(val)	(((val) & 0x3) << 20)
 #define RPCIF_CMNCR_MOIIO1(val)	(((val) & 0x3) << 18)
 #define RPCIF_CMNCR_MOIIO0(val)	(((val) & 0x3) << 16)
-#define RPCIF_CMNCR_MOIIO_HIZ	(RPCIF_CMNCR_MOIIO0(3) | \
-				 RPCIF_CMNCR_MOIIO1(3) | \
-				 RPCIF_CMNCR_MOIIO2(3) | RPCIF_CMNCR_MOIIO3(3))
+#define RPCIF_CMNCR_MOIIO_HIZ(val) (RPCIF_CMNCR_MOIIO0(val) | \
+				 RPCIF_CMNCR_MOIIO1(val) | \
+				 RPCIF_CMNCR_MOIIO2(val) | RPCIF_CMNCR_MOIIO3(val))
 #define RPCIF_CMNCR_IO3FV(val)	(((val) & 0x3) << 14) /* undocumented */
 #define RPCIF_CMNCR_IO2FV(val)	(((val) & 0x3) << 12) /* undocumented */
 #define RPCIF_CMNCR_IO0FV(val)	(((val) & 0x3) << 8)
-#define RPCIF_CMNCR_IOFV_HIZ	(RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
-				 RPCIF_CMNCR_IO3FV(3))
+#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
+				 RPCIF_CMNCR_IO3FV(val))
 #define RPCIF_CMNCR_BSZ(val)	(((val) & 0x3) << 0)
 
 #define RPCIF_SSLDR		0x0004	/* R/W */
@@ -126,6 +127,9 @@
 #define RPCIF_SMDRENR_OPDRE	BIT(4)
 #define RPCIF_SMDRENR_SPIDRE	BIT(0)
 
+#define RPCIF_PHYADJ1		0x0070	/* R/W */
+#define RPCIF_PHYADJ2		0x0074	/* R/W */
+
 #define RPCIF_PHYCNT		0x007C	/* R/W */
 #define RPCIF_PHYCNT_CAL	BIT(31)
 #define RPCIF_PHYCNT_OCTA(v)	(((v) & 0x3) << 22)
@@ -133,10 +137,12 @@
 #define RPCIF_PHYCNT_OCT	BIT(20)
 #define RPCIF_PHYCNT_DDRCAL	BIT(19)
 #define RPCIF_PHYCNT_HS		BIT(18)
+#define RPCIF_PHYCNT_CKSEL(v)	(((v) & 0x3) << 16)
 #define RPCIF_PHYCNT_STRTIM(v)	(((v) & 0x7) << 15)
 #define RPCIF_PHYCNT_WBUF2	BIT(4)
 #define RPCIF_PHYCNT_WBUF	BIT(2)
 #define RPCIF_PHYCNT_PHYMEM(v)	(((v) & 0x3) << 0)
+#define RPCIF_PHYCNT_PHYMEM_MASK GENMASK(1, 0)
 
 #define RPCIF_PHYOFFSET1	0x0080	/* R/W */
 #define RPCIF_PHYOFFSET1_DDRTMG(v) (((v) & 0x3) << 28)
@@ -245,18 +251,46 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
 		return PTR_ERR(rpc->dirmap);
 	rpc->size = resource_size(res);
 
+	rpc->type = (enum rpcif_type)of_device_get_match_data(dev);
 	rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
 
 	return PTR_ERR_OR_ZERO(rpc->rstc);
 }
 EXPORT_SYMBOL(rpcif_sw_init);
 
-void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
+static void rpcif_timing_adjust_sdr(struct rpcif *rpc)
+{
+	u32 data;
+
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0xA5390000);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000000);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000022);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
+
+	regmap_read(rpc->regmap, RPCIF_PHYCNT, &data);
+	regmap_write(rpc->regmap, RPCIF_PHYCNT, data | RPCIF_PHYCNT_CKSEL(3));
+	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00000030);
+	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000032);
+}
+
+int rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 {
 	u32 dummy;
 
 	pm_runtime_get_sync(rpc->dev);
 
+	if (rpc->type == RPCIF_RZ_G2L) {
+		int ret;
+
+		ret = reset_control_reset(rpc->rstc);
+		if (ret)
+			return ret;
+		usleep_range(200, 300);
+		rpcif_timing_adjust_sdr(rpc);
+	}
+
 	/*
 	 * NOTE: The 0x260 are undocumented bits, but they must be set.
 	 *	 RPCIF_PHYCNT_STRTIM is strobe timing adjustment bits,
@@ -265,8 +299,15 @@ void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 	 *	 On H3 ES1.x, the value should be 0, while on others,
 	 *	 the value should be 7.
 	 */
-	regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
-		     RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
+	if (rpc->type == RPCIF_RCAR_GEN3) {
+		regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
+			     RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
+	} else {
+		regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
+		dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
+		dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
+		regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
+	}
 
 	/*
 	 * NOTE: The 0x1511144 are undocumented bits, but they must be set
@@ -284,7 +325,8 @@ void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 				   RPCIF_PHYINT_WPVAL, 0);
 
 	regmap_write(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_SFDE |
-		     RPCIF_CMNCR_MOIIO_HIZ | RPCIF_CMNCR_IOFV_HIZ |
+		     RPCIF_CMNCR_MOIIO_HIZ(rpc->type == RPCIF_RZ_G2L ? 1 : 3) |
+		     RPCIF_CMNCR_IOFV_HIZ(rpc->type == RPCIF_RZ_G2L ? 2 : 3) |
 		     RPCIF_CMNCR_BSZ(hyperflash ? 1 : 0));
 	/* Set RCF after BSZ update */
 	regmap_write(rpc->regmap, RPCIF_DRCR, RPCIF_DRCR_RCF);
@@ -296,6 +338,8 @@ void rpcif_hw_init(struct rpcif *rpc, bool hyperflash)
 	pm_runtime_put(rpc->dev);
 
 	rpc->bus_size = hyperflash ? 2 : 1;
+
+	return 0;
 }
 EXPORT_SYMBOL(rpcif_hw_init);
 
@@ -613,7 +657,8 @@ static int rpcif_remove(struct platform_device *pdev)
 }
 
 static const struct of_device_id rpcif_of_match[] = {
-	{ .compatible = "renesas,rcar-gen3-rpc-if", },
+	{ .compatible = "renesas,rcar-gen3-rpc-if", .data = (void *)RPCIF_RCAR_GEN3 },
+	{ .compatible = "renesas,rzg2l-rpc-if", .data = (void *)RPCIF_RZ_G2L },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rpcif_of_match);
diff --git a/drivers/mtd/hyperbus/rpc-if.c b/drivers/mtd/hyperbus/rpc-if.c
index 367b0d72bf62..40bca89268c3 100644
--- a/drivers/mtd/hyperbus/rpc-if.c
+++ b/drivers/mtd/hyperbus/rpc-if.c
@@ -132,7 +132,9 @@ static int rpcif_hb_probe(struct platform_device *pdev)
 
 	rpcif_enable_rpm(&hyperbus->rpc);
 
-	rpcif_hw_init(&hyperbus->rpc, true);
+	error = rpcif_hw_init(&hyperbus->rpc, true);
+	if (error)
+		return error;
 
 	hyperbus->hbdev.map.size = hyperbus->rpc.size;
 	hyperbus->hbdev.map.virt = hyperbus->rpc.dirmap;
diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index 83796a4ead34..fe82f3575df4 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -156,7 +156,9 @@ static int rpcif_spi_probe(struct platform_device *pdev)
 	ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_TX_QUAD | SPI_RX_QUAD;
 	ctlr->flags = SPI_CONTROLLER_HALF_DUPLEX;
 
-	rpcif_hw_init(rpc, false);
+	error = rpcif_hw_init(rpc, false);
+	if (error)
+		return error;
 
 	error = spi_register_controller(ctlr);
 	if (error) {
diff --git a/include/memory/renesas-rpc-if.h b/include/memory/renesas-rpc-if.h
index 77c694a19149..7c93f5177532 100644
--- a/include/memory/renesas-rpc-if.h
+++ b/include/memory/renesas-rpc-if.h
@@ -57,6 +57,11 @@ struct rpcif_op {
 	} data;
 };
 
+enum rpcif_type {
+	RPCIF_RCAR_GEN3,
+	RPCIF_RZ_G2L,
+};
+
 struct rpcif {
 	struct device *dev;
 	void __iomem *base;
@@ -64,6 +69,7 @@ struct rpcif {
 	struct regmap *regmap;
 	struct reset_control *rstc;
 	size_t size;
+	enum rpcif_type type;
 	enum rpcif_data_dir dir;
 	u8 bus_size;
 	void *buffer;
@@ -78,7 +84,7 @@ struct rpcif {
 };
 
 int rpcif_sw_init(struct rpcif *rpc, struct device *dev);
-void rpcif_hw_init(struct rpcif *rpc, bool hyperflash);
+int rpcif_hw_init(struct rpcif *rpc, bool hyperflash);
 void rpcif_prepare(struct rpcif *rpc, const struct rpcif_op *op, u64 *offs,
 		   size_t *len);
 int rpcif_manual_xfer(struct rpcif *rpc);
-- 
2.17.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
  2021-09-28 14:07   ` [PATCH 2/6] dt-bindings: memory: renesas, rpc-if: " Lad Prabhakar
  (?)
@ 2021-09-30 13:39   ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 13:39 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

On Tue, Sep 28, 2021 at 03:07:17PM +0100, Lad Prabhakar wrote:
> For completeness add optional interrupts property.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 3/6] spi: spi-rpc-if: Check return value of rpcif_sw_init()
  2021-09-28 14:07   ` Lad Prabhakar
  (?)
@ 2021-09-30 13:41   ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 13:41 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

On Tue, Sep 28, 2021 at 03:07:18PM +0100, Lad Prabhakar wrote:
> rpcif_sw_init() can fail so make sure we check the return value
> of it and on error exit rpcif_spi_probe() callback with error code.
> 
> Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

If it fails, we should really bail out.

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 4/6] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
  2021-09-28 14:07   ` Lad Prabhakar
  (?)
@ 2021-09-30 13:42   ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 13:42 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das

[-- Attachment #1: Type: text/plain, Size: 467 bytes --]

On Tue, Sep 28, 2021 at 03:07:19PM +0100, Lad Prabhakar wrote:
> rpcif_sw_init() can fail so make sure we check the return value
> of it and on error exit rpcif_hb_probe() callback with error code.
> 
> Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
  2021-09-28 14:07   ` Lad Prabhakar
  (?)
@ 2021-09-30 13:55   ` Wolfram Sang
  2021-09-30 14:14       ` Lad, Prabhakar
  -1 siblings, 1 reply; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 13:55 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das

[-- Attachment #1: Type: text/plain, Size: 2082 bytes --]

On Tue, Sep 28, 2021 at 03:07:20PM +0100, Lad Prabhakar wrote:
> RPCIF_DIRMAP_SIZE may differ on various SoC's. Instead of using
> RPCIF_DIRMAP_SIZE macro use resource size to get dirmap size
> which is already part of struct rpcif.
> 
> Also make sure we return error in case devm_ioremap_resource()
> fails for dirmap.
> 
> Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
> Fixes: 59e27d7c94aa ("memory: renesas-rpc-if: fix possible NULL pointer dereference of resource")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

In general, all fine. I just think this should be split into two
patches:

> @@ -147,8 +147,6 @@
>  #define RPCIF_PHYINT		0x0088	/* R/W */
>  #define RPCIF_PHYINT_WPVAL	BIT(1)
>  
> -#define RPCIF_DIRMAP_SIZE	0x4000000
> -
>  static const struct regmap_range rpcif_volatile_ranges[] = {
>  	regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
>  	regmap_reg_range(RPCIF_SMWDR0, RPCIF_SMWDR1),
> @@ -547,8 +545,8 @@ EXPORT_SYMBOL(rpcif_manual_xfer);
>  
>  ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
>  {
> -	loff_t from = offs & (RPCIF_DIRMAP_SIZE - 1);
> -	size_t size = RPCIF_DIRMAP_SIZE - from;
> +	loff_t from = offs & (rpc->size - 1);
> +	size_t size = rpc->size - from;
>  
>  	if (len > size)
>  		len = size;

This is the second patch to split which fixes ca7d8b980b67.


> @@ -244,7 +242,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
>  	rpc->dirmap = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(rpc->dirmap))
> -		rpc->dirmap = NULL;
> +		return PTR_ERR(rpc->dirmap);
>  	rpc->size = resource_size(res);
>  
>  	rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);

This is the first patch to split which fixes 59e27d7c94aa.

Makes sense?

If you agree, you can add my tag already to the new patches:

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
  2021-09-30 13:55   ` Wolfram Sang
@ 2021-09-30 14:14       ` Lad, Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-09-30 14:14 UTC (permalink / raw)
  To: Wolfram Sang, Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Prabhakar, Biju Das

Hi Wolfram,

Thank you for the review.

On Thu, Sep 30, 2021 at 2:55 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> On Tue, Sep 28, 2021 at 03:07:20PM +0100, Lad Prabhakar wrote:
> > RPCIF_DIRMAP_SIZE may differ on various SoC's. Instead of using
> > RPCIF_DIRMAP_SIZE macro use resource size to get dirmap size
> > which is already part of struct rpcif.
> >
> > Also make sure we return error in case devm_ioremap_resource()
> > fails for dirmap.
> >
> > Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
> > Fixes: 59e27d7c94aa ("memory: renesas-rpc-if: fix possible NULL pointer dereference of resource")
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
>
> In general, all fine. I just think this should be split into two
> patches:
>
Sure will split this into two.

> > @@ -147,8 +147,6 @@
> >  #define RPCIF_PHYINT         0x0088  /* R/W */
> >  #define RPCIF_PHYINT_WPVAL   BIT(1)
> >
> > -#define RPCIF_DIRMAP_SIZE    0x4000000
> > -
> >  static const struct regmap_range rpcif_volatile_ranges[] = {
> >       regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
> >       regmap_reg_range(RPCIF_SMWDR0, RPCIF_SMWDR1),
> > @@ -547,8 +545,8 @@ EXPORT_SYMBOL(rpcif_manual_xfer);
> >
> >  ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
> >  {
> > -     loff_t from = offs & (RPCIF_DIRMAP_SIZE - 1);
> > -     size_t size = RPCIF_DIRMAP_SIZE - from;
> > +     loff_t from = offs & (rpc->size - 1);
> > +     size_t size = rpc->size - from;
> >
> >       if (len > size)
> >               len = size;
>
> This is the second patch to split which fixes ca7d8b980b67.
>
Will split this change into a second patch but wont add a fixes tag see below..

>
> > @@ -244,7 +242,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
> >       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
> >       rpc->dirmap = devm_ioremap_resource(&pdev->dev, res);
> >       if (IS_ERR(rpc->dirmap))
> > -             rpc->dirmap = NULL;
> > +             return PTR_ERR(rpc->dirmap);
> >       rpc->size = resource_size(res);
> >
> >       rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
>
> This is the first patch to split which fixes 59e27d7c94aa.
>
> Makes sense?
>
Both the fixes would apply to the first patch itself i.e. when
resource_size was added in ca7d8b980b67 and later in 59e27d7c94aa
resource_size was moved online below (this would cause kernel panic
res is NULL). Do you agree?

> If you agree, you can add my tag already to the new patches:
>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
Sure will add your RB tag.

Cheers,
Prabhakar

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

* Re: [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
@ 2021-09-30 14:14       ` Lad, Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-09-30 14:14 UTC (permalink / raw)
  To: Wolfram Sang, Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Prabhakar, Biju Das

Hi Wolfram,

Thank you for the review.

On Thu, Sep 30, 2021 at 2:55 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> On Tue, Sep 28, 2021 at 03:07:20PM +0100, Lad Prabhakar wrote:
> > RPCIF_DIRMAP_SIZE may differ on various SoC's. Instead of using
> > RPCIF_DIRMAP_SIZE macro use resource size to get dirmap size
> > which is already part of struct rpcif.
> >
> > Also make sure we return error in case devm_ioremap_resource()
> > fails for dirmap.
> >
> > Fixes: ca7d8b980b67 ("memory: add Renesas RPC-IF driver")
> > Fixes: 59e27d7c94aa ("memory: renesas-rpc-if: fix possible NULL pointer dereference of resource")
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
>
> In general, all fine. I just think this should be split into two
> patches:
>
Sure will split this into two.

> > @@ -147,8 +147,6 @@
> >  #define RPCIF_PHYINT         0x0088  /* R/W */
> >  #define RPCIF_PHYINT_WPVAL   BIT(1)
> >
> > -#define RPCIF_DIRMAP_SIZE    0x4000000
> > -
> >  static const struct regmap_range rpcif_volatile_ranges[] = {
> >       regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
> >       regmap_reg_range(RPCIF_SMWDR0, RPCIF_SMWDR1),
> > @@ -547,8 +545,8 @@ EXPORT_SYMBOL(rpcif_manual_xfer);
> >
> >  ssize_t rpcif_dirmap_read(struct rpcif *rpc, u64 offs, size_t len, void *buf)
> >  {
> > -     loff_t from = offs & (RPCIF_DIRMAP_SIZE - 1);
> > -     size_t size = RPCIF_DIRMAP_SIZE - from;
> > +     loff_t from = offs & (rpc->size - 1);
> > +     size_t size = rpc->size - from;
> >
> >       if (len > size)
> >               len = size;
>
> This is the second patch to split which fixes ca7d8b980b67.
>
Will split this change into a second patch but wont add a fixes tag see below..

>
> > @@ -244,7 +242,7 @@ int rpcif_sw_init(struct rpcif *rpc, struct device *dev)
> >       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirmap");
> >       rpc->dirmap = devm_ioremap_resource(&pdev->dev, res);
> >       if (IS_ERR(rpc->dirmap))
> > -             rpc->dirmap = NULL;
> > +             return PTR_ERR(rpc->dirmap);
> >       rpc->size = resource_size(res);
> >
> >       rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
>
> This is the first patch to split which fixes 59e27d7c94aa.
>
> Makes sense?
>
Both the fixes would apply to the first patch itself i.e. when
resource_size was added in ca7d8b980b67 and later in 59e27d7c94aa
resource_size was moved online below (this would cause kernel panic
res is NULL). Do you agree?

> If you agree, you can add my tag already to the new patches:
>
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
Sure will add your RB tag.

Cheers,
Prabhakar

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-09-28 14:07   ` Lad Prabhakar
@ 2021-09-30 14:40     ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 14:40 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das

[-- Attachment #1: Type: text/plain, Size: 2400 bytes --]

Hi,

>  #define RPCIF_CMNCR_IO3FV(val)	(((val) & 0x3) << 14) /* undocumented */
>  #define RPCIF_CMNCR_IO2FV(val)	(((val) & 0x3) << 12) /* undocumented */
>  #define RPCIF_CMNCR_IO0FV(val)	(((val) & 0x3) << 8)
> -#define RPCIF_CMNCR_IOFV_HIZ	(RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
> -				 RPCIF_CMNCR_IO3FV(3))
> +#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
> +				 RPCIF_CMNCR_IO3FV(val))

Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
datasheets? I am asking because I have a patch pending to remove writing
to undocumented locations. So, I was aboout to remove the IO3FV and
IO2FV macros.

> +#define RPCIF_PHYADJ1		0x0070	/* R/W */
> +#define RPCIF_PHYADJ2		0x0074	/* R/W */

Those are named 'PHYADD' and 'PHYWR' in the Gen3 documentation. They are
only available on a few of the Gen3 SoCs. I think the Gen3 namings make
more sense because then it becomes easily understandable that the
registers are used to write something to the PHY.

> +#define RPCIF_PHYCNT_CKSEL(v)	(((v) & 0x3) << 16)

We should add a comment here that these bits are only valid for G2L...

>  #define RPCIF_PHYCNT_STRTIM(v)	(((v) & 0x7) << 15)

and these only for Gen3.


> +static void rpcif_timing_adjust_sdr(struct rpcif *rpc)
> +{
> +	u32 data;
> +
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0xA5390000);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000000);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000022);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);

Can't we have defines for these magic values? At least in my latest Gen3
documentation, these values are explained.

> +
> +	regmap_read(rpc->regmap, RPCIF_PHYCNT, &data);
> +	regmap_write(rpc->regmap, RPCIF_PHYCNT, data | RPCIF_PHYCNT_CKSEL(3));

regmap_update_bits?

> +	if (rpc->type == RPCIF_RCAR_GEN3) {
> +		regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> +			     RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> +	} else {
> +		regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> +		dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> +		dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> +		regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);

regmap_update_bits?

Rest looks good.

Thanks and happy hacking!

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-09-30 14:40     ` Wolfram Sang
  0 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 14:40 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das


[-- Attachment #1.1: Type: text/plain, Size: 2400 bytes --]

Hi,

>  #define RPCIF_CMNCR_IO3FV(val)	(((val) & 0x3) << 14) /* undocumented */
>  #define RPCIF_CMNCR_IO2FV(val)	(((val) & 0x3) << 12) /* undocumented */
>  #define RPCIF_CMNCR_IO0FV(val)	(((val) & 0x3) << 8)
> -#define RPCIF_CMNCR_IOFV_HIZ	(RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
> -				 RPCIF_CMNCR_IO3FV(3))
> +#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
> +				 RPCIF_CMNCR_IO3FV(val))

Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
datasheets? I am asking because I have a patch pending to remove writing
to undocumented locations. So, I was aboout to remove the IO3FV and
IO2FV macros.

> +#define RPCIF_PHYADJ1		0x0070	/* R/W */
> +#define RPCIF_PHYADJ2		0x0074	/* R/W */

Those are named 'PHYADD' and 'PHYWR' in the Gen3 documentation. They are
only available on a few of the Gen3 SoCs. I think the Gen3 namings make
more sense because then it becomes easily understandable that the
registers are used to write something to the PHY.

> +#define RPCIF_PHYCNT_CKSEL(v)	(((v) & 0x3) << 16)

We should add a comment here that these bits are only valid for G2L...

>  #define RPCIF_PHYCNT_STRTIM(v)	(((v) & 0x7) << 15)

and these only for Gen3.


> +static void rpcif_timing_adjust_sdr(struct rpcif *rpc)
> +{
> +	u32 data;
> +
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0xA5390000);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000000);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000022);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> +	regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);

Can't we have defines for these magic values? At least in my latest Gen3
documentation, these values are explained.

> +
> +	regmap_read(rpc->regmap, RPCIF_PHYCNT, &data);
> +	regmap_write(rpc->regmap, RPCIF_PHYCNT, data | RPCIF_PHYCNT_CKSEL(3));

regmap_update_bits?

> +	if (rpc->type == RPCIF_RCAR_GEN3) {
> +		regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> +			     RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> +	} else {
> +		regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> +		dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> +		dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> +		regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);

regmap_update_bits?

Rest looks good.

Thanks and happy hacking!

   Wolfram


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
  2021-09-30 14:14       ` Lad, Prabhakar
@ 2021-09-30 14:43         ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 14:43 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]


> Both the fixes would apply to the first patch itself i.e. when
> resource_size was added in ca7d8b980b67 and later in 59e27d7c94aa
> resource_size was moved online below (this would cause kernel panic
> res is NULL). Do you agree?

Yes. I do wonder a little if we need the Fixes tag for ca7d8b980b67
because we fix 59e27d7c94aa which already fixes ca7d8b980b67, so there
is a chain. But maybe redundancy doesn't hurt here. I don't mind.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro
@ 2021-09-30 14:43         ` Wolfram Sang
  0 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 14:43 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das


[-- Attachment #1.1: Type: text/plain, Size: 441 bytes --]


> Both the fixes would apply to the first patch itself i.e. when
> resource_size was added in ca7d8b980b67 and later in 59e27d7c94aa
> resource_size was moved online below (this would cause kernel panic
> res is NULL). Do you agree?

Yes. I do wonder a little if we need the Fixes tag for ca7d8b980b67
because we fix 59e27d7c94aa which already fixes ca7d8b980b67, so there
is a chain. But maybe redundancy doesn't hurt here. I don't mind.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 0/6] Add SPI Multi I/O Bus Controller support for RZ/G2L
  2021-09-28 14:07 ` Lad Prabhakar
@ 2021-09-30 15:01   ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 15:01 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]


> This patch series adds a couple of fixes for rpc-if driver and
> adds support for RZ/G2L SoC, where the SPI Multi I/O Bus Controller
> is identical to the RPC-IF block found on R-Car Gen3 SoC's.

I did some basic testing on the Falcon board with a Renesas R-Car V3U
SoC and did not find a regression, so:

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 0/6] Add SPI Multi I/O Bus Controller support for RZ/G2L
@ 2021-09-30 15:01   ` Wolfram Sang
  0 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-09-30 15:01 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das


[-- Attachment #1.1: Type: text/plain, Size: 369 bytes --]


> This patch series adds a couple of fixes for rpc-if driver and
> adds support for RZ/G2L SoC, where the SPI Multi I/O Bus Controller
> is identical to the RPC-IF block found on R-Car Gen3 SoC's.

I did some basic testing on the Falcon board with a Renesas R-Car V3U
SoC and did not find a regression, so:

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-09-30 14:40     ` Wolfram Sang
@ 2021-10-01  8:02       ` Lad, Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01  8:02 UTC (permalink / raw)
  To: Wolfram Sang, Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Prabhakar, Biju Das

Hi Wolfram,

Thank you for the review.

On Thu, Sep 30, 2021 at 3:40 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi,
>
> >  #define RPCIF_CMNCR_IO3FV(val)       (((val) & 0x3) << 14) /* undocumented */
> >  #define RPCIF_CMNCR_IO2FV(val)       (((val) & 0x3) << 12) /* undocumented */
> >  #define RPCIF_CMNCR_IO0FV(val)       (((val) & 0x3) << 8)
> > -#define RPCIF_CMNCR_IOFV_HIZ (RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
> > -                              RPCIF_CMNCR_IO3FV(3))
> > +#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
> > +                              RPCIF_CMNCR_IO3FV(val))
>
> Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> datasheets? I am asking because I have a patch pending to remove writing
> to undocumented locations. So, I was aboout to remove the IO3FV and
> IO2FV macros.
>
Yes they are documented, you should be able to download the HW manual from [1]

> > +#define RPCIF_PHYADJ1                0x0070  /* R/W */
> > +#define RPCIF_PHYADJ2                0x0074  /* R/W */
>
> Those are named 'PHYADD' and 'PHYWR' in the Gen3 documentation. They are
> only available on a few of the Gen3 SoCs. I think the Gen3 namings make
> more sense because then it becomes easily understandable that the
> registers are used to write something to the PHY.
>
Agreed, will re-name it as per Gen3.

> > +#define RPCIF_PHYCNT_CKSEL(v)        (((v) & 0x3) << 16)
>
> We should add a comment here that these bits are only valid for G2L...
>
Will do.

> >  #define RPCIF_PHYCNT_STRTIM(v)       (((v) & 0x7) << 15)
>
> and these only for Gen3.
>
ditto.

>
> > +static void rpcif_timing_adjust_sdr(struct rpcif *rpc)
> > +{
> > +     u32 data;
> > +
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0xA5390000);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000000);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000022);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
>
> Can't we have defines for these magic values? At least in my latest Gen3
> documentation, these values are explained.
>
RZ/G2L manual doesn't explain these bits. Let me refer to R-Car Gen3
and define them as macros.

> > +
> > +     regmap_read(rpc->regmap, RPCIF_PHYCNT, &data);
> > +     regmap_write(rpc->regmap, RPCIF_PHYCNT, data | RPCIF_PHYCNT_CKSEL(3));
>
> regmap_update_bits?
>
will do.

> > +     if (rpc->type == RPCIF_RCAR_GEN3) {
> > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> > +                          RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> > +     } else {
> > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
>
> regmap_update_bits?
>
Im a bit hesitant to use regmap_update_bits() here as some of the bits
are not documented.

[1] https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-arm-based-high-end-32-64-bit-mpus/rzg2l-general-purpose-microprocessors-dual-core-arm-cortex-a55-12-ghz-cpus-3d-graphics-and-video-codec

Cheers,
Prabhakar

> Rest looks good.
>
> Thanks and happy hacking!
>
>    Wolfram
>

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-10-01  8:02       ` Lad, Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01  8:02 UTC (permalink / raw)
  To: Wolfram Sang, Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Prabhakar, Biju Das

Hi Wolfram,

Thank you for the review.

On Thu, Sep 30, 2021 at 3:40 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi,
>
> >  #define RPCIF_CMNCR_IO3FV(val)       (((val) & 0x3) << 14) /* undocumented */
> >  #define RPCIF_CMNCR_IO2FV(val)       (((val) & 0x3) << 12) /* undocumented */
> >  #define RPCIF_CMNCR_IO0FV(val)       (((val) & 0x3) << 8)
> > -#define RPCIF_CMNCR_IOFV_HIZ (RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
> > -                              RPCIF_CMNCR_IO3FV(3))
> > +#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
> > +                              RPCIF_CMNCR_IO3FV(val))
>
> Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> datasheets? I am asking because I have a patch pending to remove writing
> to undocumented locations. So, I was aboout to remove the IO3FV and
> IO2FV macros.
>
Yes they are documented, you should be able to download the HW manual from [1]

> > +#define RPCIF_PHYADJ1                0x0070  /* R/W */
> > +#define RPCIF_PHYADJ2                0x0074  /* R/W */
>
> Those are named 'PHYADD' and 'PHYWR' in the Gen3 documentation. They are
> only available on a few of the Gen3 SoCs. I think the Gen3 namings make
> more sense because then it becomes easily understandable that the
> registers are used to write something to the PHY.
>
Agreed, will re-name it as per Gen3.

> > +#define RPCIF_PHYCNT_CKSEL(v)        (((v) & 0x3) << 16)
>
> We should add a comment here that these bits are only valid for G2L...
>
Will do.

> >  #define RPCIF_PHYCNT_STRTIM(v)       (((v) & 0x7) << 15)
>
> and these only for Gen3.
>
ditto.

>
> > +static void rpcif_timing_adjust_sdr(struct rpcif *rpc)
> > +{
> > +     u32 data;
> > +
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0xA5390000);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000000);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000022);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
>
> Can't we have defines for these magic values? At least in my latest Gen3
> documentation, these values are explained.
>
RZ/G2L manual doesn't explain these bits. Let me refer to R-Car Gen3
and define them as macros.

> > +
> > +     regmap_read(rpc->regmap, RPCIF_PHYCNT, &data);
> > +     regmap_write(rpc->regmap, RPCIF_PHYCNT, data | RPCIF_PHYCNT_CKSEL(3));
>
> regmap_update_bits?
>
will do.

> > +     if (rpc->type == RPCIF_RCAR_GEN3) {
> > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> > +                          RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> > +     } else {
> > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
>
> regmap_update_bits?
>
Im a bit hesitant to use regmap_update_bits() here as some of the bits
are not documented.

[1] https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-arm-based-high-end-32-64-bit-mpus/rzg2l-general-purpose-microprocessors-dual-core-arm-cortex-a55-12-ghz-cpus-3d-graphics-and-video-codec

Cheers,
Prabhakar

> Rest looks good.
>
> Thanks and happy hacking!
>
>    Wolfram
>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 0/6] Add SPI Multi I/O Bus Controller support for RZ/G2L
  2021-09-30 15:01   ` Wolfram Sang
@ 2021-10-01  8:03     ` Lad, Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01  8:03 UTC (permalink / raw)
  To: Wolfram Sang, Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Prabhakar, Biju Das

Hi Wolfram,

On Thu, Sep 30, 2021 at 4:01 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
>
> > This patch series adds a couple of fixes for rpc-if driver and
> > adds support for RZ/G2L SoC, where the SPI Multi I/O Bus Controller
> > is identical to the RPC-IF block found on R-Car Gen3 SoC's.
>
> I did some basic testing on the Falcon board with a Renesas R-Car V3U
> SoC and did not find a regression, so:
>
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
Thank you for testing this, I will include the Tested-by tag along
with the RB tags.

Cheers,
Prabhakar

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

* Re: [PATCH 0/6] Add SPI Multi I/O Bus Controller support for RZ/G2L
@ 2021-10-01  8:03     ` Lad, Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01  8:03 UTC (permalink / raw)
  To: Wolfram Sang, Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Prabhakar, Biju Das

Hi Wolfram,

On Thu, Sep 30, 2021 at 4:01 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
>
> > This patch series adds a couple of fixes for rpc-if driver and
> > adds support for RZ/G2L SoC, where the SPI Multi I/O Bus Controller
> > is identical to the RPC-IF block found on R-Car Gen3 SoC's.
>
> I did some basic testing on the Falcon board with a Renesas R-Car V3U
> SoC and did not find a regression, so:
>
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
Thank you for testing this, I will include the Tested-by tag along
with the RB tags.

Cheers,
Prabhakar

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-10-01  8:02       ` Lad, Prabhakar
@ 2021-10-01  8:54         ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-10-01  8:54 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

Hi Prabhakar,

> > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > datasheets? I am asking because I have a patch pending to remove writing
> > to undocumented locations. So, I was aboout to remove the IO3FV and
> > IO2FV macros.
> >
> Yes they are documented, you should be able to download the HW manual from [1]

Great, then I will keep them!

> > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
> >
> > Can't we have defines for these magic values? At least in my latest Gen3
> > documentation, these values are explained.
> >
> RZ/G2L manual doesn't explain these bits. Let me refer to R-Car Gen3
> and define them as macros.

Seems like we have the best of both worlds then with the documentation
;)

> > > +     if (rpc->type == RPCIF_RCAR_GEN3) {
> > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> > > +                          RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> > > +     } else {
> > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> >
> > regmap_update_bits?
> >
> Im a bit hesitant to use regmap_update_bits() here as some of the bits
> are not documented.

Hmm, maybe I should then update the patch avoiding undocumented register
access beforehand? I will download your docs and see what remains and
send that out for you to check. Somewhen later today.

Sounds good?

Happy hacking,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-10-01  8:54         ` Wolfram Sang
  0 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-10-01  8:54 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das


[-- Attachment #1.1: Type: text/plain, Size: 1689 bytes --]

Hi Prabhakar,

> > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > datasheets? I am asking because I have a patch pending to remove writing
> > to undocumented locations. So, I was aboout to remove the IO3FV and
> > IO2FV macros.
> >
> Yes they are documented, you should be able to download the HW manual from [1]

Great, then I will keep them!

> > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
> >
> > Can't we have defines for these magic values? At least in my latest Gen3
> > documentation, these values are explained.
> >
> RZ/G2L manual doesn't explain these bits. Let me refer to R-Car Gen3
> and define them as macros.

Seems like we have the best of both worlds then with the documentation
;)

> > > +     if (rpc->type == RPCIF_RCAR_GEN3) {
> > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> > > +                          RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> > > +     } else {
> > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> >
> > regmap_update_bits?
> >
> Im a bit hesitant to use regmap_update_bits() here as some of the bits
> are not documented.

Hmm, maybe I should then update the patch avoiding undocumented register
access beforehand? I will download your docs and see what remains and
send that out for you to check. Somewhen later today.

Sounds good?

Happy hacking,

   Wolfram


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-10-01  8:54         ` Wolfram Sang
@ 2021-10-01  9:06           ` Lad, Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01  9:06 UTC (permalink / raw)
  To: Wolfram Sang, Lad, Prabhakar, Lad Prabhakar, Krzysztof Kozlowski,
	Rob Herring, Geert Uytterhoeven, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das

Hi Wolfram,

On Fri, Oct 1, 2021 at 9:55 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi Prabhakar,
>
> > > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > > datasheets? I am asking because I have a patch pending to remove writing
> > > to undocumented locations. So, I was aboout to remove the IO3FV and
> > > IO2FV macros.
> > >
> > Yes they are documented, you should be able to download the HW manual from [1]
>
> Great, then I will keep them!
>
> > > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
> > >
> > > Can't we have defines for these magic values? At least in my latest Gen3
> > > documentation, these values are explained.
> > >
> > RZ/G2L manual doesn't explain these bits. Let me refer to R-Car Gen3
> > and define them as macros.
>
> Seems like we have the best of both worlds then with the documentation
> ;)
>
Indeed :)

> > > > +     if (rpc->type == RPCIF_RCAR_GEN3) {
> > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> > > > +                          RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> > > > +     } else {
> > > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> > >
> > > regmap_update_bits?
> > >
> > Im a bit hesitant to use regmap_update_bits() here as some of the bits
> > are not documented.
>
> Hmm, maybe I should then update the patch avoiding undocumented register
> access beforehand? I will download your docs and see what remains and
> send that out for you to check. Somewhen later today.
>
> Sounds good?
>
Fine with me.

Cheers,
Prabhakar

> Happy hacking,
>
>    Wolfram
>

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-10-01  9:06           ` Lad, Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01  9:06 UTC (permalink / raw)
  To: Wolfram Sang, Lad, Prabhakar, Lad Prabhakar, Krzysztof Kozlowski,
	Rob Herring, Geert Uytterhoeven, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das

Hi Wolfram,

On Fri, Oct 1, 2021 at 9:55 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi Prabhakar,
>
> > > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > > datasheets? I am asking because I have a patch pending to remove writing
> > > to undocumented locations. So, I was aboout to remove the IO3FV and
> > > IO2FV macros.
> > >
> > Yes they are documented, you should be able to download the HW manual from [1]
>
> Great, then I will keep them!
>
> > > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ2, 0x00008080);
> > > > +     regmap_write(rpc->regmap, RPCIF_PHYADJ1, 0x80000024);
> > >
> > > Can't we have defines for these magic values? At least in my latest Gen3
> > > documentation, these values are explained.
> > >
> > RZ/G2L manual doesn't explain these bits. Let me refer to R-Car Gen3
> > and define them as macros.
>
> Seems like we have the best of both worlds then with the documentation
> ;)
>
Indeed :)

> > > > +     if (rpc->type == RPCIF_RCAR_GEN3) {
> > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, RPCIF_PHYCNT_STRTIM(7) |
> > > > +                          RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260);
> > > > +     } else {
> > > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> > >
> > > regmap_update_bits?
> > >
> > Im a bit hesitant to use regmap_update_bits() here as some of the bits
> > are not documented.
>
> Hmm, maybe I should then update the patch avoiding undocumented register
> access beforehand? I will download your docs and see what remains and
> send that out for you to check. Somewhen later today.
>
> Sounds good?
>
Fine with me.

Cheers,
Prabhakar

> Happy hacking,
>
>    Wolfram
>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-10-01  9:06           ` Lad, Prabhakar
@ 2021-10-01 12:04             ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-10-01 12:04 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

Hi Prabhakar,

I checked the G2L datasheet and reconsidered. It is better if your patch
goes in first. That means...

> > > > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > > > datasheets? I am asking because I have a patch pending to remove writing
> > > > to undocumented locations. So, I was aboout to remove the IO3FV and
> > > > IO2FV macros.
> > > >
> > > Yes they are documented, you should be able to download the HW manual from [1]
> >
> > Great, then I will keep them!

... that you could change the comments here from "undocumented" to
"documened for G2L" or similar.

> > > > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> > > >
> > > > regmap_update_bits?
> > > >
> > > Im a bit hesitant to use regmap_update_bits() here as some of the bits
> > > are not documented.

Here you can keep your code as is. I will change it afterwards if needed
once I clarified all undocumented locations.

Thanks and have a nice weekend,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-10-01 12:04             ` Wolfram Sang
  0 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-10-01 12:04 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Lad Prabhakar, Krzysztof Kozlowski, Rob Herring,
	Geert Uytterhoeven, Vignesh Raghavendra, Miquel Raynal,
	Richard Weinberger, Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das


[-- Attachment #1.1: Type: text/plain, Size: 1206 bytes --]

Hi Prabhakar,

I checked the G2L datasheet and reconsidered. It is better if your patch
goes in first. That means...

> > > > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > > > datasheets? I am asking because I have a patch pending to remove writing
> > > > to undocumented locations. So, I was aboout to remove the IO3FV and
> > > > IO2FV macros.
> > > >
> > > Yes they are documented, you should be able to download the HW manual from [1]
> >
> > Great, then I will keep them!

... that you could change the comments here from "undocumented" to
"documened for G2L" or similar.

> > > > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> > > >
> > > > regmap_update_bits?
> > > >
> > > Im a bit hesitant to use regmap_update_bits() here as some of the bits
> > > are not documented.

Here you can keep your code as is. I will change it afterwards if needed
once I clarified all undocumented locations.

Thanks and have a nice weekend,

   Wolfram


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-10-01 12:04             ` Wolfram Sang
@ 2021-10-01 12:53               ` Lad, Prabhakar
  -1 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01 12:53 UTC (permalink / raw)
  To: Wolfram Sang, Lad, Prabhakar, Lad Prabhakar, Krzysztof Kozlowski,
	Rob Herring, Geert Uytterhoeven, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das

Hi Wolfram,

On Fri, Oct 1, 2021 at 1:04 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi Prabhakar,
>
> I checked the G2L datasheet and reconsidered. It is better if your patch
> goes in first. That means...
>
> > > > > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > > > > datasheets? I am asking because I have a patch pending to remove writing
> > > > > to undocumented locations. So, I was aboout to remove the IO3FV and
> > > > > IO2FV macros.
> > > > >
> > > > Yes they are documented, you should be able to download the HW manual from [1]
> > >
> > > Great, then I will keep them!
>
> ... that you could change the comments here from "undocumented" to
> "documened for G2L" or similar.
>
> > > > > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > > > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > > > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> > > > >
> > > > > regmap_update_bits?
> > > > >
> > > > Im a bit hesitant to use regmap_update_bits() here as some of the bits
> > > > are not documented.
>
> Here you can keep your code as is. I will change it afterwards if needed
> once I clarified all undocumented locations.
>
Thanks, will re-spin the patches with comments fixed.

> Thanks and have a nice weekend,
>
You too.

Cheers,
Prabhakar

>    Wolfram
>

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-10-01 12:53               ` Lad, Prabhakar
  0 siblings, 0 replies; 52+ messages in thread
From: Lad, Prabhakar @ 2021-10-01 12:53 UTC (permalink / raw)
  To: Wolfram Sang, Lad, Prabhakar, Lad Prabhakar, Krzysztof Kozlowski,
	Rob Herring, Geert Uytterhoeven, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-mtd, linux-spi, LKML, Linux-Renesas, Biju Das

Hi Wolfram,

On Fri, Oct 1, 2021 at 1:04 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> Hi Prabhakar,
>
> I checked the G2L datasheet and reconsidered. It is better if your patch
> goes in first. That means...
>
> > > > > Is RPCIF_CMNCR_IO3FV and RPCIF_CMNCR_IO2FV actually documented in your
> > > > > datasheets? I am asking because I have a patch pending to remove writing
> > > > > to undocumented locations. So, I was aboout to remove the IO3FV and
> > > > > IO2FV macros.
> > > > >
> > > > Yes they are documented, you should be able to download the HW manual from [1]
> > >
> > > Great, then I will keep them!
>
> ... that you could change the comments here from "undocumented" to
> "documened for G2L" or similar.
>
> > > > > > +             regmap_read(rpc->regmap, RPCIF_PHYCNT, &dummy);
> > > > > > +             dummy &= ~RPCIF_PHYCNT_PHYMEM_MASK;
> > > > > > +             dummy |= RPCIF_PHYCNT_PHYMEM(hyperflash ? 3 : 0) | 0x260;
> > > > > > +             regmap_write(rpc->regmap, RPCIF_PHYCNT, dummy);
> > > > >
> > > > > regmap_update_bits?
> > > > >
> > > > Im a bit hesitant to use regmap_update_bits() here as some of the bits
> > > > are not documented.
>
> Here you can keep your code as is. I will change it afterwards if needed
> once I clarified all undocumented locations.
>
Thanks, will re-spin the patches with comments fixed.

> Thanks and have a nice weekend,
>
You too.

Cheers,
Prabhakar

>    Wolfram
>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/6] dt-bindings: memory: renesas,rpc-if: Add support for the R9A07G044
  2021-09-28 14:07   ` [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: " Lad Prabhakar
@ 2021-10-04 18:30     ` Rob Herring
  -1 siblings, 0 replies; 52+ messages in thread
From: Rob Herring @ 2021-10-04 18:30 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Geert Uytterhoeven, linux-spi, Biju Das, Philipp Zabel,
	Mark Brown, Miquel Raynal, devicetree, linux-kernel, Rob Herring,
	linux-renesas-soc, Prabhakar, linux-mtd, Vignesh Raghavendra,
	Krzysztof Kozlowski, Richard Weinberger, Sergei Shtylyov,
	Wolfram Sang

On Tue, 28 Sep 2021 15:07:16 +0100, Lad Prabhakar wrote:
> SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
> the RPC-IF interface found on R-Car Gen3 SoC's.
> 
> This patch adds a new compatible string to identify the RZ/G2L family
> so that the timing values on RZ/G2L can be adjusted.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  .../memory-controllers/renesas,rpc-if.yaml    | 51 ++++++++++++++-----
>  1 file changed, 37 insertions(+), 14 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: Add support for the R9A07G044
@ 2021-10-04 18:30     ` Rob Herring
  0 siblings, 0 replies; 52+ messages in thread
From: Rob Herring @ 2021-10-04 18:30 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Geert Uytterhoeven, linux-spi, Biju Das, Philipp Zabel,
	Mark Brown, Miquel Raynal, devicetree, linux-kernel, Rob Herring,
	linux-renesas-soc, Prabhakar, linux-mtd, Vignesh Raghavendra,
	Krzysztof Kozlowski, Richard Weinberger, Sergei Shtylyov,
	Wolfram Sang

On Tue, 28 Sep 2021 15:07:16 +0100, Lad Prabhakar wrote:
> SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
> the RPC-IF interface found on R-Car Gen3 SoC's.
> 
> This patch adds a new compatible string to identify the RZ/G2L family
> so that the timing values on RZ/G2L can be adjusted.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  .../memory-controllers/renesas,rpc-if.yaml    | 51 ++++++++++++++-----
>  1 file changed, 37 insertions(+), 14 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
  2021-09-28 14:07   ` [PATCH 2/6] dt-bindings: memory: renesas, rpc-if: " Lad Prabhakar
@ 2021-10-04 18:30     ` Rob Herring
  -1 siblings, 0 replies; 52+ messages in thread
From: Rob Herring @ 2021-10-04 18:30 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: linux-spi, Wolfram Sang, linux-renesas-soc, Philipp Zabel,
	Mark Brown, Prabhakar, Biju Das, Krzysztof Kozlowski,
	Miquel Raynal, Richard Weinberger, linux-kernel, devicetree,
	Vignesh Raghavendra, Rob Herring, linux-mtd, Sergei Shtylyov,
	Geert Uytterhoeven

On Tue, 28 Sep 2021 15:07:17 +0100, Lad Prabhakar wrote:
> For completeness add optional interrupts property.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  .../devicetree/bindings/memory-controllers/renesas,rpc-if.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
@ 2021-10-04 18:30     ` Rob Herring
  0 siblings, 0 replies; 52+ messages in thread
From: Rob Herring @ 2021-10-04 18:30 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: linux-spi, Wolfram Sang, linux-renesas-soc, Philipp Zabel,
	Mark Brown, Prabhakar, Biju Das, Krzysztof Kozlowski,
	Miquel Raynal, Richard Weinberger, linux-kernel, devicetree,
	Vignesh Raghavendra, Rob Herring, linux-mtd, Sergei Shtylyov,
	Geert Uytterhoeven

On Tue, 28 Sep 2021 15:07:17 +0100, Lad Prabhakar wrote:
> For completeness add optional interrupts property.
> 
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  .../devicetree/bindings/memory-controllers/renesas,rpc-if.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
  2021-09-28 14:07   ` Lad Prabhakar
@ 2021-10-05  9:14     ` Wolfram Sang
  -1 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-10-05  9:14 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Hi Prabhakar,

some updates after internal discussions I had.

> +#define RPCIF_CMNCR_MOIIO_HIZ(val) (RPCIF_CMNCR_MOIIO0(val) | \
> +				 RPCIF_CMNCR_MOIIO1(val) | \
> +				 RPCIF_CMNCR_MOIIO2(val) | RPCIF_CMNCR_MOIIO3(val))

Shimoda-san rightfully said that '_HIZ' should be removed from the macro
name because HIZ implies the value 3.


>  #define RPCIF_CMNCR_IO3FV(val)	(((val) & 0x3) << 14) /* undocumented */
>  #define RPCIF_CMNCR_IO2FV(val)	(((val) & 0x3) << 12) /* undocumented */

As discussed before, mention here that they are documented for G2L.
Sadly, we can't use them with Gen3...

> -#define RPCIF_CMNCR_IOFV_HIZ	(RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
> -				 RPCIF_CMNCR_IO3FV(3))
> +#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
> +				 RPCIF_CMNCR_IO3FV(val))

... which means we should remove this macro entirely because it is
forbidden for Gen3. I think it is best to use the RPCIF_CMNCR_IO<n>FV
macros directly where we need them.

Do you agree?

Kind regards,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L
@ 2021-10-05  9:14     ` Wolfram Sang
  0 siblings, 0 replies; 52+ messages in thread
From: Wolfram Sang @ 2021-10-05  9:14 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov, devicetree,
	linux-mtd, linux-spi, linux-kernel, linux-renesas-soc, Prabhakar,
	Biju Das


[-- Attachment #1.1: Type: text/plain, Size: 1047 bytes --]

Hi Prabhakar,

some updates after internal discussions I had.

> +#define RPCIF_CMNCR_MOIIO_HIZ(val) (RPCIF_CMNCR_MOIIO0(val) | \
> +				 RPCIF_CMNCR_MOIIO1(val) | \
> +				 RPCIF_CMNCR_MOIIO2(val) | RPCIF_CMNCR_MOIIO3(val))

Shimoda-san rightfully said that '_HIZ' should be removed from the macro
name because HIZ implies the value 3.


>  #define RPCIF_CMNCR_IO3FV(val)	(((val) & 0x3) << 14) /* undocumented */
>  #define RPCIF_CMNCR_IO2FV(val)	(((val) & 0x3) << 12) /* undocumented */

As discussed before, mention here that they are documented for G2L.
Sadly, we can't use them with Gen3...

> -#define RPCIF_CMNCR_IOFV_HIZ	(RPCIF_CMNCR_IO0FV(3) | RPCIF_CMNCR_IO2FV(3) | \
> -				 RPCIF_CMNCR_IO3FV(3))
> +#define RPCIF_CMNCR_IOFV_HIZ(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
> +				 RPCIF_CMNCR_IO3FV(val))

... which means we should remove this macro entirely because it is
forbidden for Gen3. I think it is best to use the RPCIF_CMNCR_IO<n>FV
macros directly where we need them.

Do you agree?

Kind regards,

   Wolfram


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/6] dt-bindings: memory: renesas,rpc-if: Add support for the R9A07G044
  2021-09-28 14:07   ` [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: " Lad Prabhakar
@ 2021-10-05 14:46     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-05 14:46 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
> the RPC-IF interface found on R-Car Gen3 SoC's.
>
> This patch adds a new compatible string to identify the RZ/G2L family
> so that the timing values on RZ/G2L can be adjusted.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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] 52+ messages in thread

* Re: [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: Add support for the R9A07G044
@ 2021-10-05 14:46     ` Geert Uytterhoeven
  0 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-05 14:46 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> SPI Multi I/O Bus Controller on RZ/G2L SoC is almost identical to
> the RPC-IF interface found on R-Car Gen3 SoC's.
>
> This patch adds a new compatible string to identify the RZ/G2L family
> so that the timing values on RZ/G2L can be adjusted.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
  2021-09-28 14:07   ` [PATCH 2/6] dt-bindings: memory: renesas, rpc-if: " Lad Prabhakar
@ 2021-10-05 15:11     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-05 15:11 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> For completeness add optional interrupts property.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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] 52+ messages in thread

* Re: [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: Add optional interrupts property
@ 2021-10-05 15:11     ` Geert Uytterhoeven
  0 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-05 15:11 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> For completeness add optional interrupts property.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 3/6] spi: spi-rpc-if: Check return value of rpcif_sw_init()
  2021-09-28 14:07   ` Lad Prabhakar
@ 2021-10-05 15:25     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-05 15:25 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

Hi Prabhakar,

Thanks for your patch!

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> rpcif_sw_init() can fail so make sure we check the return value
> of it and on error exit rpcif_spi_probe() callback with error code.

Indeed, it will now fail earlier if CONFIG_RESET_CONTROLLER=n
Patch sent
https://lore.kernel.org/all/d4383bd1a97c0490c0bdc9dae5695f4230d4a420.1633447185.git.geert+renesas@glider.be

> Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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] 52+ messages in thread

* Re: [PATCH 3/6] spi: spi-rpc-if: Check return value of rpcif_sw_init()
@ 2021-10-05 15:25     ` Geert Uytterhoeven
  0 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-05 15:25 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Geert Uytterhoeven,
	Vignesh Raghavendra, Miquel Raynal, Richard Weinberger,
	Mark Brown, Philipp Zabel, Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

Hi Prabhakar,

Thanks for your patch!

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> rpcif_sw_init() can fail so make sure we check the return value
> of it and on error exit rpcif_spi_probe() callback with error code.

Indeed, it will now fail earlier if CONFIG_RESET_CONTROLLER=n
Patch sent
https://lore.kernel.org/all/d4383bd1a97c0490c0bdc9dae5695f4230d4a420.1633447185.git.geert+renesas@glider.be

> Fixes: eb8d6d464a27 ("spi: add Renesas RPC-IF driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 4/6] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
  2021-09-28 14:07   ` Lad Prabhakar
@ 2021-10-08  9:27     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-08  9:27 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> rpcif_sw_init() can fail so make sure we check the return value
> of it and on error exit rpcif_hb_probe() callback with error code.
>
> Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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] 52+ messages in thread

* Re: [PATCH 4/6] mtd: hyperbus: rpc-if: Check return value of rpcif_sw_init()
@ 2021-10-08  9:27     ` Geert Uytterhoeven
  0 siblings, 0 replies; 52+ messages in thread
From: Geert Uytterhoeven @ 2021-10-08  9:27 UTC (permalink / raw)
  To: Lad Prabhakar
  Cc: Krzysztof Kozlowski, Rob Herring, Vignesh Raghavendra,
	Miquel Raynal, Richard Weinberger, Mark Brown, Philipp Zabel,
	Sergei Shtylyov,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	MTD Maling List, linux-spi, Wolfram Sang,
	Linux Kernel Mailing List, Linux-Renesas, Prabhakar, Biju Das

On Tue, Sep 28, 2021 at 4:07 PM Lad Prabhakar
<prabhakar.mahadev-lad.rj@bp.renesas.com> wrote:
> rpcif_sw_init() can fail so make sure we check the return value
> of it and on error exit rpcif_hb_probe() callback with error code.
>
> Fixes: 5de15b610f78 ("mtd: hyperbus: add Renesas RPC-IF driver")
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>

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

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2021-10-08  9:27 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 14:07 [PATCH 0/6] Add SPI Multi I/O Bus Controller support for RZ/G2L Lad Prabhakar
2021-09-28 14:07 ` Lad Prabhakar
2021-09-28 14:07 ` [PATCH 1/6] dt-bindings: memory: renesas,rpc-if: Add support for the R9A07G044 Lad Prabhakar
2021-09-28 14:07   ` [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: " Lad Prabhakar
2021-10-04 18:30   ` [PATCH 1/6] dt-bindings: memory: renesas,rpc-if: " Rob Herring
2021-10-04 18:30     ` [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: " Rob Herring
2021-10-05 14:46   ` [PATCH 1/6] dt-bindings: memory: renesas,rpc-if: " Geert Uytterhoeven
2021-10-05 14:46     ` [PATCH 1/6] dt-bindings: memory: renesas, rpc-if: " Geert Uytterhoeven
2021-09-28 14:07 ` [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: Add optional interrupts property Lad Prabhakar
2021-09-28 14:07   ` [PATCH 2/6] dt-bindings: memory: renesas, rpc-if: " Lad Prabhakar
2021-09-30 13:39   ` [PATCH 2/6] dt-bindings: memory: renesas,rpc-if: " Wolfram Sang
2021-10-04 18:30   ` Rob Herring
2021-10-04 18:30     ` Rob Herring
2021-10-05 15:11   ` Geert Uytterhoeven
2021-10-05 15:11     ` Geert Uytterhoeven
2021-09-28 14:07 ` [PATCH 3/6] spi: spi-rpc-if: Check return value of rpcif_sw_init() Lad Prabhakar
2021-09-28 14:07   ` Lad Prabhakar
2021-09-30 13:41   ` Wolfram Sang
2021-10-05 15:25   ` Geert Uytterhoeven
2021-10-05 15:25     ` Geert Uytterhoeven
2021-09-28 14:07 ` [PATCH 4/6] mtd: hyperbus: rpc-if: " Lad Prabhakar
2021-09-28 14:07   ` Lad Prabhakar
2021-09-30 13:42   ` Wolfram Sang
2021-10-08  9:27   ` Geert Uytterhoeven
2021-10-08  9:27     ` Geert Uytterhoeven
2021-09-28 14:07 ` [PATCH 5/6] memory: renesas-rpc-if: Drop usage of RPCIF_DIRMAP_SIZE macro Lad Prabhakar
2021-09-28 14:07   ` Lad Prabhakar
2021-09-30 13:55   ` Wolfram Sang
2021-09-30 14:14     ` Lad, Prabhakar
2021-09-30 14:14       ` Lad, Prabhakar
2021-09-30 14:43       ` Wolfram Sang
2021-09-30 14:43         ` Wolfram Sang
2021-09-28 14:07 ` [PATCH 6/6] memory: renesas-rpc-if: Add support for RZ/G2L Lad Prabhakar
2021-09-28 14:07   ` Lad Prabhakar
2021-09-30 14:40   ` Wolfram Sang
2021-09-30 14:40     ` Wolfram Sang
2021-10-01  8:02     ` Lad, Prabhakar
2021-10-01  8:02       ` Lad, Prabhakar
2021-10-01  8:54       ` Wolfram Sang
2021-10-01  8:54         ` Wolfram Sang
2021-10-01  9:06         ` Lad, Prabhakar
2021-10-01  9:06           ` Lad, Prabhakar
2021-10-01 12:04           ` Wolfram Sang
2021-10-01 12:04             ` Wolfram Sang
2021-10-01 12:53             ` Lad, Prabhakar
2021-10-01 12:53               ` Lad, Prabhakar
2021-10-05  9:14   ` Wolfram Sang
2021-10-05  9:14     ` Wolfram Sang
2021-09-30 15:01 ` [PATCH 0/6] Add SPI Multi I/O Bus Controller " Wolfram Sang
2021-09-30 15:01   ` Wolfram Sang
2021-10-01  8:03   ` Lad, Prabhakar
2021-10-01  8:03     ` Lad, Prabhakar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.