Skip to contentSkip to conversation

Add Renesas R-Car Gen4 E-FUSE support

PATCH Superseded Geert Uytterhoeven 4 participants 18 messages Jul 26, 2024 – Aug 30, 2024

Subsystems (3)
lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

v3 cover Add Renesas R-Car Gen4 E-FUSE support

Hi all,

R-Car Gen3/Gen4 SoCs contain fuses indicating hardware support or hardware parameters. Unfortunately the various SoCs require different mechanisms to read the state of the fuses:
- On R-Car Gen3, the fuse monitor registers are in the middle of the Pin Function Controller (PFC) register block,
- On R-Car V3U and S4-8, the E-FUSE non-volatile memory is accessible through a separate register block in the PFC,
- On R-Car V4H and V4M, the E-FUSE non-volatile memory is accessible through the second register block of OTP_MEM.

As the first variant is quite different from the other two, and there is currently no use case requiring support for it, this patch series adds support for the last 2 variants only.

Note that the first two revisions of this series implemented only basic nvmem support, and a custom in-kernel API, mimicked after the fuse-tregra driver. Then, Arnd told me on IRC that the R-Car E-FUSE driver should use the nvmem framework fully.

The fuses' states can be read using the nvmem subsystem:
- In kernelspace, through the nvmem_cell_*() API.
A first known use case is reading tuning parameters for the Universal Flash Storage controller on R-Car S4-8 ES1.2.
- In userspace, through sysfs. E.g. on R-Car S4-8 ES1.2:

    / # hd /sys/bus/nvmem/devices/rcar-fuse/nvmem
    00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000000e0  00 00 00 00 fe 00 00 00  00 00 00 00 00 00 00 00  |....�...........|
    000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000140  00 00 00 00 23 51 23 51  52 98 52 98 00 00 00 00  |....#Q#QR�R�....|
    00000150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000200

Changes compared to v2[1]:
- Dropped accepted dt-bindings,
- Drop "pinctrl: renesas: Add R-Car Gen3 fuse support",
- New patch "dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to

    nvmem",
  - Drop superfluous semicolon,
  - Drop the custom rcar_fuse_read() kernel API, in favor of the
    standard nvmem_cell_*() API,
  - Drop support for explicitly-instantiated platform devices with
    accompanying platform data, which would be needed to support fuses
    tightly integrated with the Pin Function Controller on R-Car Gen3
    SoCs.  It can be added when a use case shows up.
  - Move from drivers/soc/renesas/ to drivers/nvmem/,
  - Register the full register block that contains the E-FUSE data
    registers with the nvmem subsystem, but use keepouts to ignore all
    registers before the first or after the last documented data
    register.  Undocumented registers in between are still accessible.
  - Replace offset/nregs in rcar_fuse_data by start/end,
  - Use __ioread32_copy() helper,
  - Initialize most fields of struct nvmem_config in its declaration,
  - Rename nvmem device from "fuse" to "rcar-fuse",
  - Use NVMEM_DEVID_NONE,
  - Add an entry to the MAINTAINERS file,
  - Fix reg size,
  - New patch "arm64: dts: renesas: r8a779f4: Add UFS tuning parameters
    in E-FUSE".

Changes compared to v1[2]:
- Drop RFC state and broaden audience,
- Fix typo in one-line summary,
- Add Reviewed-by.

This has been tested on R-Car V3U, S4-8 ES1.0 and ES1.2, V4H, and V4M.

Thanks for your comments!

[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]

Geert Uytterhoeven (7):
dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
nvmem: Add R-Car E-FUSE driver
arm64: dts: renesas: r8a779a0: Add E-FUSE node
arm64: dts: renesas: r8a779f0: Add E-FUSE node
arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE
arm64: dts: renesas: r8a779g0: Add OTP_MEM node
arm64: dts: renesas: r8a779h0: Add OTP_MEM node

 .../{fuse => nvmem}/renesas,rcar-efuse.yaml   |  35 +++--
 .../{fuse => nvmem}/renesas,rcar-otp.yaml     |  17 ++-
 MAINTAINERS                                   |   2 +
 arch/arm64/boot/dts/renesas/r8a779a0.dtsi     |   8 +
 arch/arm64/boot/dts/renesas/r8a779f0.dtsi     |   8 +
 arch/arm64/boot/dts/renesas/r8a779f4.dtsi     |  12 ++
 arch/arm64/boot/dts/renesas/r8a779g0.dtsi     |   5 +
 arch/arm64/boot/dts/renesas/r8a779h0.dtsi     |   5 +
 drivers/nvmem/Kconfig                         |  11 ++
 drivers/nvmem/Makefile                        |   2 +
 drivers/nvmem/rcar-efuse.c                    | 142 ++++++++++++++++++
 11 files changed, 230 insertions(+), 17 deletions(-)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-efuse.yaml (54%)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-otp.yaml (60%)
 create mode 100644 drivers/nvmem/rcar-efuse.c
Signature · 12 lines
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
author maintainer
#1 lore raw

PATCH v3 1/7 dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;

but after adding that, "make dt_binding_check" starts complaining:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
'#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#

---
 .../{fuse => nvmem}/renesas,rcar-efuse.yaml   | 35 +++++++++++++------
 .../{fuse => nvmem}/renesas,rcar-otp.yaml     | 17 +++++----
 MAINTAINERS                                   |  1 +
 3 files changed, 36 insertions(+), 17 deletions(-)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-efuse.yaml (54%)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-otp.yaml (60%)
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.yaml renamed from Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml +24 -11
similarity index 54%
rename from Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml
rename to Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.yaml
index d7e289244e72cce1..ce7d65afa4602537 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/fuse/renesas,rcar-efuse.yaml#
+$id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: R-Car E-FUSE connected to PFC
@@ -13,6 +13,9 @@ description:
   The E-FUSE is a type of non-volatile memory, which is accessible through the
   Pin Function Controller (PFC) on some R-Car Gen4 SoCs.
 
+allOf:
+  - $ref: nvmem.yaml#
+
 properties:
   compatible:
     enum:
@@ -39,17 +42,27 @@ required:
   - power-domains
   - resets
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
-    #include <dt-bindings/clock/r8a779a0-cpg-mssr.h>
-    #include <dt-bindings/power/r8a779a0-sysc.h>
-
-    fuse: fuse@e6078800 {
-            compatible = "renesas,r8a779a0-efuse";
-            reg = <0xe6078800 0x100>;
-            clocks = <&cpg CPG_MOD 916>;
-            power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>;
-            resets = <&cpg 916>;
+    #include <dt-bindings/clock/r8a779f0-cpg-mssr.h>
+    #include <dt-bindings/power/r8a779f0-sysc.h>
+
+    fuse@e6078800 {
+        compatible = "renesas,r8a779f0-efuse";
+        reg = <0xe6078800 0x200>;
+        clocks = <&cpg CPG_MOD 915>;
+        power-domains = <&sysc R8A779F0_PD_ALWAYS_ON>;
+        resets = <&cpg 915>;
+
+        nvmem-layout {
+            compatible = "fixed-layout";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            calib@144 {
+                reg = <0x144 0x08>;
+            };
+        };
     };
Documentation/devicetree/bindings/nvmem/renesas,rcar-otp.yaml renamed from Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml +11 -6
similarity index 60%
rename from Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml
rename to Documentation/devicetree/bindings/nvmem/renesas,rcar-otp.yaml
index d74872ae9ff378f9..3313c03ea68dfd57 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/fuse/renesas,rcar-otp.yaml#
+$id: http://devicetree.org/schemas/nvmem/renesas,rcar-otp.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: R-Car E-FUSE connected to OTP_MEM
@@ -13,6 +13,9 @@ description:
   The E-FUSE is a type of non-volatile memory, which is accessible through the
   One-Time Programmable Memory (OTP_MEM) module on some R-Car Gen4 SoCs.
 
+allOf:
+  - $ref: nvmem.yaml#
+
 properties:
   compatible:
     enum:
@@ -22,17 +25,19 @@ properties:
   reg:
     items:
       - description: OTP_MEM_0
-      - description: OTP_MEM_1
+      - description: OTP_MEM_1.
+          The addresses of cells defined under the optional nvmem-layout
+          subnode are relative to this register bank.
 
 required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
-    otp: otp@e61be000 {
-            compatible = "renesas,r8a779g0-otp";
-            reg = <0xe61be000 0x1000>, <0xe61bf000 0x1000>;
+    otp@e61be000 {
+        compatible = "renesas,r8a779g0-otp";
+        reg = <0xe61be000 0x1000>, <0xe61bf000 0x1000>;
     };
MAINTAINERS +1 -0
index 990aced7e7a57e1f..8da9c4ee231b4db4 100644
@@ -2794,6 +2794,7 @@ Q:	http://patchwork.kernel.org/project/linux-renesas-soc/list/
 C:	irc://irc.libera.chat/renesas-soc
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel.git next
 F:	Documentation/devicetree/bindings/hwinfo/renesas,prr.yaml
+F:	Documentation/devicetree/bindings/nvmem/renesas,*
 F:	Documentation/devicetree/bindings/soc/renesas/
 F:	arch/arm/boot/dts/renesas/
 F:	arch/arm/configs/shmobile_defconfig
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Quoted 17 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

I would expect that the calib@144 node needs:

Quoted 7 lines
    #nvmem-cell-cells = <0>;

but after adding that, "make dt_binding_check" starts complaining:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
'#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)

Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?

Quoted 7 lines

'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#

#3 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Hi Rob,

Quoted 20 lines · Rob Herring
Quoted 19 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;
Quoted 7 lines
Quoted 5 lines

but after adding that, "make dt_binding_check" starts complaining:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
'#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)

Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?

Oops, I've been (manually) re-adding and removing it again too many times during my investigations. "#nvmem-cell-cells", of course. According to my build logs, I had it right at least once ;-)

Quoted 7 lines
Quoted 7 lines

'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#

Anyway, with or without the typo, the error message is about the same:

- Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
+ Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#4 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Quoted 43 lines · Geert Uytterhoeven

Hi Rob,

Quoted 20 lines · Rob Herring
Quoted 19 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;
Quoted 7 lines
Quoted 5 lines

but after adding that, "make dt_binding_check" starts complaining:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
'#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)

Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?

Oops, I've been (manually) re-adding and removing it again too many times during my investigations. "#nvmem-cell-cells", of course. According to my build logs, I had it right at least once ;-)

Quoted 7 lines
Quoted 7 lines

'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#

Quoted 4 lines

Anyway, with or without the typo, the error message is about the same:

- Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
+ Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)

And if you test your schema or DTS with all nvmem (so also layouts) schemas?

Apparently fixed-layout schema was not applied.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Hi Krzysztof,

Quoted 44 lines · Krzysztof Kozlowski
Quoted 43 lines · Geert Uytterhoeven
Quoted 20 lines · Rob Herring
Quoted 19 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;
Quoted 7 lines
Quoted 5 lines

but after adding that, "make dt_binding_check" starts complaining:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
'#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)

Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?

Oops, I've been (manually) re-adding and removing it again too many times during my investigations. "#nvmem-cell-cells", of course. According to my build logs, I had it right at least once ;-)

Quoted 7 lines
Quoted 7 lines

'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#

Anyway, with or without the typo, the error message is about the same:

Quoted 7 lines
Quoted 2 lines

- Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
+ Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)

And if you test your schema or DTS with all nvmem (so also layouts) schemas?

Apparently fixed-layout schema was not applied.

With today's dt-schema:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:

        '#address-cells', '#size-cells', 'calib@144' do not match any

of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('#nvmem-cell-cells'
was unexpected)
'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
nvmem-layout: calib@144: Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#

According to the last line, fixed-layout.yaml is applied. Am I missing something?

Thanks!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#6 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Quoted 24 lines · Geert Uytterhoeven

Hi Krzysztof,

Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Geert Uytterhoeven
Quoted 19 lines · Rob Herring
Quoted 18 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;

So this is for mac-base...

Quoted 60 lines
Quoted 23 lines
Quoted 23 lines
Quoted 8 lines
Quoted 6 lines

but after adding that, "make dt_binding_check" starts complaining:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:
'#address-cells', '#size-cells', 'calib@144' do not match any of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)

Did you want 'nvmem-cell-cells' or '#nvmem-cell-cells'?

Oops, I've been (manually) re-adding and removing it again too many times during my investigations. "#nvmem-cell-cells", of course. According to my build logs, I had it right at least once ;-)

Quoted 7 lines
Quoted 7 lines

'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb: fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id: http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#

Anyway, with or without the typo, the error message is about the same:

Quoted 7 lines
Quoted 2 lines

- Unevaluated properties are not allowed ('nvmem-cell-cells' was unexpected)
+ Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)

And if you test your schema or DTS with all nvmem (so also layouts) schemas?

Apparently fixed-layout schema was not applied.

With today's dt-schema:

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: nvmem-layout: 'oneOf' conditional failed, one must be fixed:

        '#address-cells', '#size-cells', 'calib@144' do not match any

of the regexes: 'pinctrl-[0-9]+'
Unevaluated properties are not allowed ('#nvmem-cell-cells'
was unexpected)
'kontron,sl28-vpd' was expected
'onie,tlv-layout' was expected
from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: nvmem-layout: Unevaluated properties are not allowed ('#address-cells', '#size-cells', 'calib@144' were unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
fuse@e6078800: Unevaluated properties are not allowed ('nvmem-layout' was unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/renesas,rcar-efuse.yaml#
Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
nvmem-layout: calib@144: Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#

Quoted 2 lines

According to the last line, fixed-layout.yaml is applied. Am I missing something?

I cannot reproduce it. Neither on 2024.6.dev5+g0e44e14b7eb4 nor on todays 2024.6.dev16+gc51125d571ca (which is actually from 15th of Aug).

But maybe we talk about modified patch, but then which exactly?

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Hi Krzysztof,

Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Geert Uytterhoeven
Quoted 18 lines · Krzysztof Kozlowski
Quoted 17 lines · Geert Uytterhoeven
Quoted 16 lines · Rob Herring
Quoted 15 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;

So this is for mac-base...

No, mac-base is not involved.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

but after adding that, "make dt_binding_check" starts complaining:

[...]

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

And if you test your schema or DTS with all nvmem (so also layouts) schemas?

Apparently fixed-layout schema was not applied.

With today's dt-schema:

[...]

Quoted 6 lines
Quoted 6 lines

Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.example.dtb:
nvmem-layout: calib@144: Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#

Quoted 7 lines
Quoted 2 lines

According to the last line, fixed-layout.yaml is applied. Am I missing something?

I cannot reproduce it. Neither on 2024.6.dev5+g0e44e14b7eb4 nor on todays 2024.6.dev16+gc51125d571ca (which is actually from 15th of Aug).

But maybe we talk about modified patch, but then which exactly?

Yes, you have to add "#nvmem-cell-cells = <0>;" to the calib@144 node after applying my series (or at least the bindings patch).

I can reproduce it on Linux v6.11-rc5 and dt-schema v2024.05-16-gc51125d571cac959 by modifying the fixed-layout example:

Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml +1 -0
@@ -58,5 +58,6 @@ examples:
 
         calibration@4000 {
             reg = <0x4000 0x100>;
+            #nvmem-cell-cells = <0>;
         };
     };

Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.example.dtb:
nvmem-layout: calibration@4000: Unevaluated properties are not allowed ('#nvmem-cell-cells' was unexpected)
from schema $id:
http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
maintainer
#8 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Quoted 23 lines · Geert Uytterhoeven

Hi Krzysztof,

Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Geert Uytterhoeven
Quoted 18 lines · Krzysztof Kozlowski
Quoted 17 lines · Geert Uytterhoeven
Quoted 16 lines · Rob Herring
Quoted 15 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;

So this is for mac-base...

No, mac-base is not involved.

It is because that's the only case that allows #nvmem-cell-cells in fixed-cell.yaml. While fixed-cell.yaml allows additional properties, where it is referenced in fixed-layout.yaml does not.

Rob

#9 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Hi Rob,

Quoted 26 lines · Rob Herring
Quoted 25 lines · Geert Uytterhoeven
Quoted 24 lines · Krzysztof Kozlowski
Quoted 22 lines · Geert Uytterhoeven
Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Geert Uytterhoeven
Quoted 19 lines · Rob Herring
Quoted 18 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

So this is for mac-base...

No, mac-base is not involved.

It is because that's the only case that allows #nvmem-cell-cells in fixed-cell.yaml. While fixed-cell.yaml allows additional properties, where it is referenced in fixed-layout.yaml does not.

So all of this is normal, and you should just never use #nvmem-cell-cells, except in a node describing the location of the MAC address?

When no #nvmem-cell-cells property is present,
of_parse_phandle_with_optional_args() (as used in
of_nvmem_cell_get()) returns zero anyway

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
maintainer
#10 lore raw

Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem

Quoted 31 lines · Geert Uytterhoeven

Hi Rob,

Quoted 28 lines · Rob Herring
Quoted 27 lines · Geert Uytterhoeven
Quoted 25 lines · Krzysztof Kozlowski
Quoted 19 lines · Geert Uytterhoeven
Quoted 18 lines · Krzysztof Kozlowski
Quoted 17 lines · Geert Uytterhoeven
Quoted 16 lines · Rob Herring
Quoted 15 lines · Geert Uytterhoeven

The R-Car E-FUSE blocks can be modelled better using the nvmem framework.

Replace the R-Car V3U example by an R-Car S4-8 ES1.2 example, to show the definition of nvmem cells. While at it, drop unneeded labels from the examples, and fix indentation.

Add an entry to the MAINTAINERS file.

---
v3:
- New.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

I would expect that the calib@144 node needs:

    #nvmem-cell-cells = <0>;

So this is for mac-base...

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

No, mac-base is not involved.

It is because that's the only case that allows #nvmem-cell-cells in fixed-cell.yaml. While fixed-cell.yaml allows additional properties, where it is referenced in fixed-layout.yaml does not.

So all of this is normal, and you should just never use #nvmem-cell-cells, except in a node describing the location of the MAC address?

I was just explaining the source. If you have another use, then adjust the schema.

Quoted 3 lines

When no #nvmem-cell-cells property is present,
of_parse_phandle_with_optional_args() (as used in
of_nvmem_cell_get()) returns zero anyway

Yeah, I don't see much value in disallowing #nvmem-cell-cells.

Rob

author maintainer
#11 lore raw

PATCH v3 2/7 nvmem: Add R-Car E-FUSE driver

In reply to Geert Uytterhoeven

R-Car Gen4 SoCs contain fuses indicating hardware support or hardware (e.g. tuning) parameters. Add a driver to access the state of the fuses. This supports two types of hardware fuse providers:
1. E-FUSE non-volatile memory accessible through the Pin Function Controller on R-Car V3U and S4-8,
2. E-FUSE non-volatile memory accessible through OTP_MEM on R-Car V4H and V4M.

The state of the cells can be read using the NVMEM framework, either from kernel space (e.g. by the Renesas UFSHCD driver), or from userspace.

---
v3:
- Drop superfluous semicolon,
- Drop the custom rcar_fuse_read() kernel API, in favor of the standard nvmem_cell_*() API,
- Drop support for explicitly-instantiated platform devices with accompanying platform data, which would be needed to support fuses tightly integrated with the Pin Function Controller on R-Car Gen3 SoCs. It can be added when a use case shows up.
- Move from drivers/soc/renesas/ to drivers/nvmem/,
- Register the full register block that contains the E-FUSE data registers with the nvmem subsystem, but use keepouts to ignore all registers before the first or after the last documented data register. Undocumented registers in between are still accessible.
- Replace offset/nregs in rcar_fuse_data by start/end,
- Use __ioread32_copy() helper,
- Initialize most fields of struct nvmem_config in its declaration,
- Rename nvmem device from "fuse" to "rcar-fuse",
- Use NVMEM_DEVID_NONE,
- Add an entry to the MAINTAINERS file,

v2:
- Add Reviewed-by.

---
 MAINTAINERS                |   1 +
 drivers/nvmem/Kconfig      |  11 +++
 drivers/nvmem/Makefile     |   2 +
 drivers/nvmem/rcar-efuse.c | 142 +++++++++++++++++++++++++++++++++++++
 4 files changed, 156 insertions(+)
 create mode 100644 drivers/nvmem/rcar-efuse.c
MAINTAINERS +1 -0
index 8da9c4ee231b4db4..142e1ecf88c19773 100644
@@ -2802,6 +2802,7 @@ F:	arch/arm/mach-shmobile/
 F:	arch/arm/mach-shmobile/
 F:	arch/arm64/boot/dts/renesas/
 F:	arch/riscv/boot/dts/renesas/
+F:	drivers/nvmem/rcar-efuse.c
 F:	drivers/pmdomain/renesas/
 F:	drivers/soc/renesas/
 F:	include/linux/soc/renesas/
drivers/nvmem/Kconfig +11 -0
index 283134498fbc3315..567baf73be90375e 100644
@@ -246,6 +246,17 @@ config NVMEM_RAVE_SP_EEPROM
 	help
 	  Say y here to enable Rave SP EEPROM support.
 
+config NVMEM_RCAR_EFUSE
+	tristate "Renesas R-Car Gen4 E-FUSE support"
+	depends on (ARCH_RENESAS && ARM64) || COMPILE_TEST
+	depends on NVMEM
+	help
+	  Enable support for reading the fuses in the E-FUSE or OTP
+	  non-volatile memory block on Renesas R-Car Gen4 SoCs.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called nvmem-rcar-efuse.
+
 config NVMEM_RMEM
 	tristate "Reserved Memory Based Driver Support"
 	depends on HAS_IOMEM
drivers/nvmem/Makefile +2 -0
index cdd01fbf1313b58c..5b77bbb6488bf89b 100644
@@ -52,6 +52,8 @@ obj-$(CONFIG_NVMEM_QCOM_SEC_QFPROM)	+= nvmem_sec_qfprom.o
 nvmem_sec_qfprom-y			:= sec-qfprom.o
 obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM)	+= nvmem-rave-sp-eeprom.o
 nvmem-rave-sp-eeprom-y			:= rave-sp-eeprom.o
+obj-$(CONFIG_NVMEM_RCAR_EFUSE)		+= nvmem-rcar-efuse.o
+nvmem-rcar-efuse-y			:= rcar-efuse.o
 obj-$(CONFIG_NVMEM_RMEM) 		+= nvmem-rmem.o
 nvmem-rmem-y				:= rmem.o
 obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE)	+= nvmem_rockchip_efuse.o
drivers/nvmem/rcar-efuse.c new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
2.34.1
author maintainer
#12 lore raw

PATCH v3 3/7 arm64: dts: renesas: r8a779a0: Add E-FUSE node

In reply to Geert Uytterhoeven

Add a device node for the System Group Fuse Control and Monitor block of the Pin Function Controller (PFC) on the R-Car V3U (R8A779A0) SoC, which provides E-FUSE services.

---
v3:
- No changes,

v2:
- Add Reviewed-by.

---
 arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/renesas/r8a779a0.dtsi +8 -0
index 69652d309fe6f01e..4d1f086629d1ecef 100644
@@ -245,6 +245,14 @@ gpio9: gpio@e6069980 {
 			#interrupt-cells = <2>;
 		};
 
+		fuse: fuse@e6078800 {
+			compatible = "renesas,r8a779a0-efuse";
+			reg = <0 0xe6078800 0 0x100>;
+			clocks = <&cpg CPG_MOD 916>;
+			power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>;
+			resets = <&cpg 916>;
+		};
+
 		cmt0: timer@e60f0000 {
 			compatible = "renesas,r8a779a0-cmt0",
 				     "renesas,rcar-gen4-cmt0";
Signature · 1 line
2.34.1
author maintainer
#13 lore raw

PATCH v3 4/7 arm64: dts: renesas: r8a779f0: Add E-FUSE node

In reply to Geert Uytterhoeven

Add a device node for the System Group Fuse Control and Monitor block of the Pin Function Controller (PFC) on the R-Car S4-8 (R8A779F0) SoC, which provides E-FUSE services.

---
v3:
- Fix reg size,

v2:
- s/r8a779g0/r8a779f0/ in one-line summary,
- Add Reviewed-by.

---
 arch/arm64/boot/dts/renesas/r8a779f0.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/renesas/r8a779f0.dtsi +8 -0
index 9629adb47d99f142..054498e54730b49c 100644
@@ -377,6 +377,14 @@ gpio3: gpio@e6051980 {
 			#interrupt-cells = <2>;
 		};
 
+		fuse: fuse@e6078800 {
+			compatible = "renesas,r8a779f0-efuse";
+			reg = <0 0xe6078800 0 0x200>;
+			clocks = <&cpg CPG_MOD 915>;
+			power-domains = <&sysc R8A779F0_PD_ALWAYS_ON>;
+			resets = <&cpg 915>;
+		};
+
 		cmt0: timer@e60f0000 {
 			compatible = "renesas,r8a779f0-cmt0",
 				     "renesas,rcar-gen4-cmt0";
Signature · 1 line
2.34.1
author maintainer
#14 lore raw

PATCH v3 5/7 arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE

In reply to Geert Uytterhoeven

Describe the location in the E-FUSE block of the PLL and AFE tuning parameters for the Universal Flash Storage controller.

---
v3:
- New.

After adding:

    &ufs {
	    nvmem-cells = <&ufs_tune>;
	    nvmem-cell-names = "calibration";
    };

The calibration data can be retrieved using the following sample code:

    #include <linux/nvmem-consumer.h>

    static int nvmem_dump_cell(struct platform_device *pdev, const char *name)
    {
	    struct device *dev = &pdev->dev;
	    struct nvmem_cell *cell;
	    int res = 0;
	    void *data;
	    size_t len;

	    cell = nvmem_cell_get(dev, name);
	    if (IS_ERR(cell))
		    return dev_err_probe(dev, PTR_ERR(cell),
					 "Failed to get cell %s\n", name);

	    data = nvmem_cell_read(cell, &len);
	    if (IS_ERR(data)) {
		    res = dev_err_probe(dev, PTR_ERR(data),
					"Failed to read cell %s\n", name);
		    goto put;
	    }

	    pr_info("Cell %s contains %zu bytes of data\n", name, len);
	    print_hex_dump(KERN_INFO, "| ", DUMP_PREFIX_NONE, 32, 1, data, len, 0);

	    kfree(data);
    put:
	    nvmem_cell_put(cell);
	    return res;
    }

Calling nvmem_dump_cell(pdev, "calibration") from ufs_renesas_probe() on the R-Car S4 Starter Kit development board gives:

Cell calibration contains 8 bytes of data
| 23 51 23 51 52 98 52 98

---
 arch/arm64/boot/dts/renesas/r8a779f4.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/renesas/r8a779f4.dtsi +12 -0
index ebed41892df3346c..dfa3c015e04b740c 100644
@@ -10,3 +10,15 @@
 / {
 	compatible = "renesas,r8a779f4", "renesas,r8a779f0";
 };
+
+&fuse {
+	nvmem-layout {
+		compatible = "fixed-layout";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		ufs_tune: calib@144 {
+			reg = <0x144 0x08>;
+		};
+	};
+};
Signature · 1 line
2.34.1
author maintainer
#15 lore raw

PATCH v3 6/7 arm64: dts: renesas: r8a779g0: Add OTP_MEM node

In reply to Geert Uytterhoeven

Add a device node for the OTP non-volatile memory on the R-Car V4H (R8A779G0) SoC, which provides E-FUSE services.

---
v3:
- No changes,

v2:
- Add Reviewed-by.

---
 arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/renesas/r8a779g0.dtsi +5 -0
index d6770d3d488b833a..3a0991a7789f4d13 100644
@@ -463,6 +463,11 @@ tsc: thermal@e6198000 {
 			#thermal-sensor-cells = <1>;
 		};
 
+		otp: otp@e61be000 {
+			compatible = "renesas,r8a779g0-otp";
+			reg = <0 0xe61be000 0 0x1000>, <0 0xe61bf000 0 0x1000>;
+		};
+
 		intc_ex: interrupt-controller@e61c0000 {
 			compatible = "renesas,intc-ex-r8a779g0", "renesas,irqc";
 			#interrupt-cells = <2>;
Signature · 1 line
2.34.1
author maintainer
#16 lore raw

PATCH v3 7/7 arm64: dts: renesas: r8a779h0: Add OTP_MEM node

In reply to Geert Uytterhoeven

Add a device node for the OTP non-volatile memory on the R-Car V4M (R8A779H0) SoC, which provides E-FUSE services.

---
v3:
- No changes,

v2:
- Add Reviewed-by.

---
 arch/arm64/boot/dts/renesas/r8a779h0.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm64/boot/dts/renesas/r8a779h0.dtsi +5 -0
index 0124e682b248188c..4cf67ef2690f6af5 100644
@@ -417,6 +417,11 @@ tsc: thermal@e6198000 {
 			#thermal-sensor-cells = <1>;
 		};
 
+		otp: otp@e61be000 {
+			compatible = "renesas,r8a779h0-otp";
+			reg = <0 0xe61be000 0 0x1000>, <0 0xe61bf000 0 0x1000>;
+		};
+
 		intc_ex: interrupt-controller@e61c0000 {
 			compatible = "renesas,intc-ex-r8a779h0", "renesas,irqc";
 			#interrupt-cells = <2>;
Signature · 1 line
2.34.1
#17 lore raw
In reply to Geert Uytterhoeven

Hi Srinivas,

Gentle ping, any comments from the nvmem side?

Thank you!

Quoted 101 lines · Geert Uytterhoeven

R-Car Gen3/Gen4 SoCs contain fuses indicating hardware support or hardware parameters. Unfortunately the various SoCs require different mechanisms to read the state of the fuses:
- On R-Car Gen3, the fuse monitor registers are in the middle of the Pin Function Controller (PFC) register block,
- On R-Car V3U and S4-8, the E-FUSE non-volatile memory is accessible through a separate register block in the PFC,
- On R-Car V4H and V4M, the E-FUSE non-volatile memory is accessible through the second register block of OTP_MEM.

As the first variant is quite different from the other two, and there is currently no use case requiring support for it, this patch series adds support for the last 2 variants only.

Note that the first two revisions of this series implemented only basic nvmem support, and a custom in-kernel API, mimicked after the fuse-tregra driver. Then, Arnd told me on IRC that the R-Car E-FUSE driver should use the nvmem framework fully.

The fuses' states can be read using the nvmem subsystem:
- In kernelspace, through the nvmem_cell_*() API.
A first known use case is reading tuning parameters for the Universal Flash Storage controller on R-Car S4-8 ES1.2.
- In userspace, through sysfs. E.g. on R-Car S4-8 ES1.2:

    / # hd /sys/bus/nvmem/devices/rcar-fuse/nvmem
    00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000000e0  00 00 00 00 fe 00 00 00  00 00 00 00 00 00 00 00  |....�...........|
    000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000140  00 00 00 00 23 51 23 51  52 98 52 98 00 00 00 00  |....#Q#QR�R�....|
    00000150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000200

Changes compared to v2[1]:
- Dropped accepted dt-bindings,
- Drop "pinctrl: renesas: Add R-Car Gen3 fuse support",
- New patch "dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to

    nvmem",
  - Drop superfluous semicolon,
  - Drop the custom rcar_fuse_read() kernel API, in favor of the
    standard nvmem_cell_*() API,
  - Drop support for explicitly-instantiated platform devices with
    accompanying platform data, which would be needed to support fuses
    tightly integrated with the Pin Function Controller on R-Car Gen3
    SoCs.  It can be added when a use case shows up.
  - Move from drivers/soc/renesas/ to drivers/nvmem/,
  - Register the full register block that contains the E-FUSE data
    registers with the nvmem subsystem, but use keepouts to ignore all
    registers before the first or after the last documented data
    register.  Undocumented registers in between are still accessible.
  - Replace offset/nregs in rcar_fuse_data by start/end,
  - Use __ioread32_copy() helper,
  - Initialize most fields of struct nvmem_config in its declaration,
  - Rename nvmem device from "fuse" to "rcar-fuse",
  - Use NVMEM_DEVID_NONE,
  - Add an entry to the MAINTAINERS file,
  - Fix reg size,
  - New patch "arm64: dts: renesas: r8a779f4: Add UFS tuning parameters
    in E-FUSE".

Changes compared to v1[2]:
- Drop RFC state and broaden audience,
- Fix typo in one-line summary,
- Add Reviewed-by.

This has been tested on R-Car V3U, S4-8 ES1.0 and ES1.2, V4H, and V4M.

Thanks for your comments!

[1] https://lore.kernel.org/[email protected]
[2] https://lore.kernel.org/[email protected]

Geert Uytterhoeven (7):
dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
nvmem: Add R-Car E-FUSE driver
arm64: dts: renesas: r8a779a0: Add E-FUSE node
arm64: dts: renesas: r8a779f0: Add E-FUSE node
arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE
arm64: dts: renesas: r8a779g0: Add OTP_MEM node
arm64: dts: renesas: r8a779h0: Add OTP_MEM node

 .../{fuse => nvmem}/renesas,rcar-efuse.yaml   |  35 +++--
 .../{fuse => nvmem}/renesas,rcar-otp.yaml     |  17 ++-
 MAINTAINERS                                   |   2 +
 arch/arm64/boot/dts/renesas/r8a779a0.dtsi     |   8 +
 arch/arm64/boot/dts/renesas/r8a779f0.dtsi     |   8 +
 arch/arm64/boot/dts/renesas/r8a779f4.dtsi     |  12 ++
 arch/arm64/boot/dts/renesas/r8a779g0.dtsi     |   5 +
 arch/arm64/boot/dts/renesas/r8a779h0.dtsi     |   5 +
 drivers/nvmem/Kconfig                         |  11 ++
 drivers/nvmem/Makefile                        |   2 +
 drivers/nvmem/rcar-efuse.c                    | 142 ++++++++++++++++++
 11 files changed, 230 insertions(+), 17 deletions(-)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-efuse.yaml (54%)
 rename Documentation/devicetree/bindings/{fuse => nvmem}/renesas,rcar-otp.yaml (60%)
 create mode 100644 drivers/nvmem/rcar-efuse.c

--
2.34.1