devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support
@ 2024-07-26 13:38 Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem Geert Uytterhoeven
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

	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/cover.1716974502.git.geert+renesas@glider.be
[2] https://lore.kernel.org/cover.1714642390.git.geert+renesas@glider.be

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

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

* [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
@ 2024-07-26 13:38 ` Geert Uytterhoeven
  2024-07-30 16:24   ` Rob Herring
  2024-07-26 13:38 ` [PATCH v3 2/7] nvmem: Add R-Car E-FUSE driver Geert Uytterhoeven
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, 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.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
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%)

diff --git a/Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml b/Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.yaml
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
--- a/Documentation/devicetree/bindings/fuse/renesas,rcar-efuse.yaml
+++ b/Documentation/devicetree/bindings/nvmem/renesas,rcar-efuse.yaml
@@ -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>;
+            };
+        };
     };
diff --git a/Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml b/Documentation/devicetree/bindings/nvmem/renesas,rcar-otp.yaml
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
--- a/Documentation/devicetree/bindings/fuse/renesas,rcar-otp.yaml
+++ b/Documentation/devicetree/bindings/nvmem/renesas,rcar-otp.yaml
@@ -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>;
     };
diff --git a/MAINTAINERS b/MAINTAINERS
index 990aced7e7a57e1f..8da9c4ee231b4db4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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
-- 
2.34.1


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

* [PATCH v3 2/7] nvmem: Add R-Car E-FUSE driver
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem Geert Uytterhoeven
@ 2024-07-26 13:38 ` Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 3/7] arm64: dts: renesas: r8a779a0: Add E-FUSE node Geert Uytterhoeven
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, 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.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
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

diff --git a/MAINTAINERS b/MAINTAINERS
index 8da9c4ee231b4db4..142e1ecf88c19773 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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/
diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index 283134498fbc3315..567baf73be90375e 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -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
diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
index cdd01fbf1313b58c..5b77bbb6488bf89b 100644
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -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
diff --git a/drivers/nvmem/rcar-efuse.c b/drivers/nvmem/rcar-efuse.c
new file mode 100644
index 0000000000000000..f24bdb9cb5a7296f
--- /dev/null
+++ b/drivers/nvmem/rcar-efuse.c
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Renesas R-Car E-FUSE/OTP Driver
+ *
+ * Copyright (C) 2024 Glider bv
+ */
+
+#include <linux/device.h>
+#include <linux/export.h>
+#include <linux/io.h>
+#include <linux/mod_devicetable.h>
+#include <linux/nvmem-provider.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/property.h>
+
+struct rcar_fuse {
+	struct nvmem_keepout keepouts[2];
+	struct nvmem_device *nvmem;
+	struct device *dev;
+	void __iomem *base;
+};
+
+struct rcar_fuse_data {
+	unsigned int bank;	/* 0: PFC + E-FUSE, 1: OPT_MEM + E-FUSE */
+	unsigned int start;	/* inclusive */
+	unsigned int end;	/* exclusive */
+};
+
+static int rcar_fuse_reg_read(void *priv, unsigned int offset, void *val,
+			      size_t bytes)
+{
+	struct rcar_fuse *fuse = priv;
+	int ret;
+
+	ret = pm_runtime_resume_and_get(fuse->dev);
+	if (ret < 0)
+		return ret;
+
+	__ioread32_copy(val, fuse->base + offset, bytes / 4);
+
+	pm_runtime_put(fuse->dev);
+
+	return 0;
+}
+
+static int rcar_fuse_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	const struct rcar_fuse_data *data = device_get_match_data(dev);
+	struct nvmem_config config = {
+		.dev = dev,
+		.name = "rcar-fuse",
+		.id = NVMEM_DEVID_NONE,
+		.owner = THIS_MODULE,
+		.type = NVMEM_TYPE_OTP,
+		.read_only = true,
+		.root_only = true,
+		.reg_read = rcar_fuse_reg_read,
+		.word_size = 4,
+		.stride = 4,
+	};
+	struct rcar_fuse *fuse;
+	struct resource *res;
+	int ret;
+
+	ret = devm_pm_runtime_enable(dev);
+	if (ret < 0)
+		return ret;
+
+	fuse = devm_kzalloc(dev, sizeof(*fuse), GFP_KERNEL);
+	if (!fuse)
+		return -ENOMEM;
+
+	fuse->base = devm_platform_get_and_ioremap_resource(pdev, data->bank,
+							    &res);
+	if (IS_ERR(fuse->base))
+		return PTR_ERR(fuse->base);
+
+	fuse->dev = dev;
+	fuse->keepouts[0].start = 0;
+	fuse->keepouts[0].end = data->start;
+	fuse->keepouts[1].start = data->end;
+	fuse->keepouts[1].end = resource_size(res);
+
+	config.keepout = fuse->keepouts;
+	config.nkeepout = ARRAY_SIZE(fuse->keepouts);
+	config.size = resource_size(res);
+	config.priv = fuse;
+
+	fuse->nvmem = devm_nvmem_register(dev, &config);
+	if (IS_ERR(fuse->nvmem))
+		return dev_err_probe(dev, PTR_ERR(fuse->nvmem),
+				     "Failed to register NVMEM device\n");
+
+	return 0;
+}
+
+static const struct rcar_fuse_data rcar_fuse_v3u = {
+	.bank = 0,
+	.start = 0x0c0,
+	.end = 0x0e8,
+};
+
+static const struct rcar_fuse_data rcar_fuse_s4 = {
+	.bank = 0,
+	.start = 0x0c0,
+	.end = 0x14c,
+};
+
+static const struct rcar_fuse_data rcar_fuse_v4h = {
+	.bank = 1,
+	.start = 0x100,
+	.end = 0x1a0,
+};
+
+static const struct rcar_fuse_data rcar_fuse_v4m = {
+	.bank = 1,
+	.start = 0x100,
+	.end = 0x110,
+};
+
+static const struct of_device_id rcar_fuse_match[] = {
+	{ .compatible = "renesas,r8a779a0-efuse", .data = &rcar_fuse_v3u },
+	{ .compatible = "renesas,r8a779f0-efuse", .data = &rcar_fuse_s4 },
+	{ .compatible = "renesas,r8a779g0-otp", .data = &rcar_fuse_v4h },
+	{ .compatible = "renesas,r8a779h0-otp", .data = &rcar_fuse_v4m },
+	{ /* sentinel */ }
+};
+
+static struct platform_driver rcar_fuse_driver = {
+	.probe = rcar_fuse_probe,
+	.driver = {
+		.name = "rcar_fuse",
+		.of_match_table = rcar_fuse_match,
+	},
+};
+module_platform_driver(rcar_fuse_driver);
+
+MODULE_DESCRIPTION("Renesas R-Car E-FUSE/OTP driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Geert Uytterhoeven");
-- 
2.34.1


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

* [PATCH v3 3/7] arm64: dts: renesas: r8a779a0: Add E-FUSE node
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 2/7] nvmem: Add R-Car E-FUSE driver Geert Uytterhoeven
@ 2024-07-26 13:38 ` Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 4/7] arm64: dts: renesas: r8a779f0: " Geert Uytterhoeven
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, 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.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
v3:
  - No changes,

v2:
  - Add Reviewed-by.
---
 arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi b/arch/arm64/boot/dts/renesas/r8a779a0.dtsi
index 69652d309fe6f01e..4d1f086629d1ecef 100644
--- a/arch/arm64/boot/dts/renesas/r8a779a0.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a779a0.dtsi
@@ -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";
-- 
2.34.1


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

* [PATCH v3 4/7] arm64: dts: renesas: r8a779f0: Add E-FUSE node
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2024-07-26 13:38 ` [PATCH v3 3/7] arm64: dts: renesas: r8a779a0: Add E-FUSE node Geert Uytterhoeven
@ 2024-07-26 13:38 ` Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 5/7] arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE Geert Uytterhoeven
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, 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.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
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(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a779f0.dtsi b/arch/arm64/boot/dts/renesas/r8a779f0.dtsi
index 9629adb47d99f142..054498e54730b49c 100644
--- a/arch/arm64/boot/dts/renesas/r8a779f0.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a779f0.dtsi
@@ -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";
-- 
2.34.1


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

* [PATCH v3 5/7] arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2024-07-26 13:38 ` [PATCH v3 4/7] arm64: dts: renesas: r8a779f0: " Geert Uytterhoeven
@ 2024-07-26 13:38 ` Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 6/7] arm64: dts: renesas: r8a779g0: Add OTP_MEM node Geert Uytterhoeven
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

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

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
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(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a779f4.dtsi b/arch/arm64/boot/dts/renesas/r8a779f4.dtsi
index ebed41892df3346c..dfa3c015e04b740c 100644
--- a/arch/arm64/boot/dts/renesas/r8a779f4.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a779f4.dtsi
@@ -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>;
+		};
+	};
+};
-- 
2.34.1


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

* [PATCH v3 6/7] arm64: dts: renesas: r8a779g0: Add OTP_MEM node
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2024-07-26 13:38 ` [PATCH v3 5/7] arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE Geert Uytterhoeven
@ 2024-07-26 13:38 ` Geert Uytterhoeven
  2024-07-26 13:38 ` [PATCH v3 7/7] arm64: dts: renesas: r8a779h0: " Geert Uytterhoeven
  2024-08-28 18:43 ` [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
  7 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

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

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
v3:
  - No changes,

v2:
  - Add Reviewed-by.
---
 arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a779g0.dtsi b/arch/arm64/boot/dts/renesas/r8a779g0.dtsi
index d6770d3d488b833a..3a0991a7789f4d13 100644
--- a/arch/arm64/boot/dts/renesas/r8a779g0.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a779g0.dtsi
@@ -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>;
-- 
2.34.1


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

* [PATCH v3 7/7] arm64: dts: renesas: r8a779h0: Add OTP_MEM node
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
                   ` (5 preceding siblings ...)
  2024-07-26 13:38 ` [PATCH v3 6/7] arm64: dts: renesas: r8a779g0: Add OTP_MEM node Geert Uytterhoeven
@ 2024-07-26 13:38 ` Geert Uytterhoeven
  2024-08-28 18:43 ` [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
  7 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-26 13:38 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann
  Cc: devicetree, linux-renesas-soc, linux-kernel, Geert Uytterhoeven

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

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
v3:
  - No changes,

v2:
  - Add Reviewed-by.
---
 arch/arm64/boot/dts/renesas/r8a779h0.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a779h0.dtsi b/arch/arm64/boot/dts/renesas/r8a779h0.dtsi
index 0124e682b248188c..4cf67ef2690f6af5 100644
--- a/arch/arm64/boot/dts/renesas/r8a779h0.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a779h0.dtsi
@@ -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>;
-- 
2.34.1


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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-07-26 13:38 ` [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem Geert Uytterhoeven
@ 2024-07-30 16:24   ` Rob Herring
  2024-07-31  7:37     ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Rob Herring @ 2024-07-30 16:24 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann, devicetree,
	linux-renesas-soc, linux-kernel

On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> 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.
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> 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)

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

> 	    '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#

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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-07-30 16:24   ` Rob Herring
@ 2024-07-31  7:37     ` Geert Uytterhoeven
  2024-08-19 11:11       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-07-31  7:37 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann, devicetree,
	linux-renesas-soc, linux-kernel

Hi Rob,

On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > 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.
> >
> > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > 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)
>
> 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 ;-)

> >           '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

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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-07-31  7:37     ` Geert Uytterhoeven
@ 2024-08-19 11:11       ` Krzysztof Kozlowski
  2024-08-28 20:10         ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-19 11:11 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann, devicetree,
	linux-renesas-soc, linux-kernel

On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> Hi Rob,
> 
> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > 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.
> > >
> > > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > ---
> > > 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)
> >
> > 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 ;-)
> 
> > >           '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)

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

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

* Re: [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support
  2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
                   ` (6 preceding siblings ...)
  2024-07-26 13:38 ` [PATCH v3 7/7] arm64: dts: renesas: r8a779h0: " Geert Uytterhoeven
@ 2024-08-28 18:43 ` Geert Uytterhoeven
  7 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-08-28 18:43 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Yoshihiro Shimoda, Arnd Bergmann, devicetree, linux-renesas-soc,
	linux-kernel

Hi Srinivas,

Gentle ping, any comments from the nvmem side?

Thank you!

On Fri, Jul 26, 2024 at 3:38 PM Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> 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/cover.1716974502.git.geert+renesas@glider.be
> [2] https://lore.kernel.org/cover.1714642390.git.geert+renesas@glider.be
>
> 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

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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-08-19 11:11       ` Krzysztof Kozlowski
@ 2024-08-28 20:10         ` Geert Uytterhoeven
  2024-08-29  8:55           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-08-28 20:10 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann, devicetree,
	linux-renesas-soc, linux-kernel

Hi Krzysztof,

On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > > On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > > 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.
> > > >
> > > > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > ---
> > > > 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)
> > >
> > > 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 ;-)
> >
> > > >           '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)
>
> 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

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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-08-28 20:10         ` Geert Uytterhoeven
@ 2024-08-29  8:55           ` Krzysztof Kozlowski
  2024-08-29  9:10             ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-29  8:55 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann, devicetree,
	linux-renesas-soc, linux-kernel

On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> Hi Krzysztof,
> 
> On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
>>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
>>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
>>>>> 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.
>>>>>
>>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
>>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>>>> ---
>>>>> v3:
>>>>>   - New.
>>>>>
>>>>> I would expect that the calib@144 node needs:
>>>>>
>>>>>     #nvmem-cell-cells = <0>;


So this is for mac-base...

>>>>>
>>>>> 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 ;-)
>>>
>>>>>           '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)
>>
>> 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?

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


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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-08-29  8:55           ` Krzysztof Kozlowski
@ 2024-08-29  9:10             ` Geert Uytterhoeven
  2024-08-29 13:58               ` Rob Herring
  0 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-08-29  9:10 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
	Srinivas Kandagatla, Yoshihiro Shimoda, Arnd Bergmann, devicetree,
	linux-renesas-soc, linux-kernel

Hi Krzysztof,

On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> >>>>> 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.
> >>>>>
> >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >>>>> ---
> >>>>> v3:
> >>>>>   - New.
> >>>>>
> >>>>> 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.

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

[...]

> >> 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:
> > 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?
>
> 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:

--- a/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
@@ -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

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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-08-29  9:10             ` Geert Uytterhoeven
@ 2024-08-29 13:58               ` Rob Herring
  2024-08-29 14:34                 ` Geert Uytterhoeven
  0 siblings, 1 reply; 18+ messages in thread
From: Rob Herring @ 2024-08-29 13:58 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Krzysztof Kozlowski, Krzysztof Kozlowski, Conor Dooley,
	Magnus Damm, Srinivas Kandagatla, Yoshihiro Shimoda,
	Arnd Bergmann, devicetree, linux-renesas-soc, linux-kernel

On Thu, Aug 29, 2024 at 11:10:41AM +0200, Geert Uytterhoeven wrote:
> Hi Krzysztof,
> 
> On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > >>>>> 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.
> > >>>>>
> > >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> > >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > >>>>> ---
> > >>>>> v3:
> > >>>>>   - New.
> > >>>>>
> > >>>>> 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

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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-08-29 13:58               ` Rob Herring
@ 2024-08-29 14:34                 ` Geert Uytterhoeven
  2024-08-30 15:47                   ` Rob Herring
  0 siblings, 1 reply; 18+ messages in thread
From: Geert Uytterhoeven @ 2024-08-29 14:34 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, Krzysztof Kozlowski, Conor Dooley,
	Magnus Damm, Srinivas Kandagatla, Yoshihiro Shimoda,
	Arnd Bergmann, devicetree, linux-renesas-soc, linux-kernel

Hi Rob,

On Thu, Aug 29, 2024 at 3:58 PM Rob Herring <robh@kernel.org> wrote:
> On Thu, Aug 29, 2024 at 11:10:41AM +0200, Geert Uytterhoeven wrote:
> > On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > > > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > > >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > > >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > >>>>> 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.
> > > >>>>>
> > > >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > >>>>> ---
> > > >>>>> v3:
> > > >>>>>   - New.
> > > >>>>>
> > > >>>>> 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.

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

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

* Re: [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem
  2024-08-29 14:34                 ` Geert Uytterhoeven
@ 2024-08-30 15:47                   ` Rob Herring
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring @ 2024-08-30 15:47 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Krzysztof Kozlowski, Krzysztof Kozlowski, Conor Dooley,
	Magnus Damm, Srinivas Kandagatla, Yoshihiro Shimoda,
	Arnd Bergmann, devicetree, linux-renesas-soc, linux-kernel

On Thu, Aug 29, 2024 at 04:34:41PM +0200, Geert Uytterhoeven wrote:
> Hi Rob,
> 
> On Thu, Aug 29, 2024 at 3:58 PM Rob Herring <robh@kernel.org> wrote:
> > On Thu, Aug 29, 2024 at 11:10:41AM +0200, Geert Uytterhoeven wrote:
> > > On Thu, Aug 29, 2024 at 10:55 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > > On 28/08/2024 22:10, Geert Uytterhoeven wrote:
> > > > > On Mon, Aug 19, 2024 at 1:11 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > > >> On Wed, Jul 31, 2024 at 09:37:36AM +0200, Geert Uytterhoeven wrote:
> > > > >>> On Tue, Jul 30, 2024 at 6:24 PM Rob Herring <robh@kernel.org> wrote:
> > > > >>>> On Fri, Jul 26, 2024 at 03:38:06PM +0200, Geert Uytterhoeven wrote:
> > > > >>>>> 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.
> > > > >>>>>
> > > > >>>>> Reported-by: Arnd Bergmann <arnd@arndb.de>
> > > > >>>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > > >>>>> ---
> > > > >>>>> v3:
> > > > >>>>>   - New.
> > > > >>>>>
> > > > >>>>> 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.
> 
> 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.

> 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

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

end of thread, other threads:[~2024-08-30 15:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 13:38 [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven
2024-07-26 13:38 ` [PATCH v3 1/7] dt-bindings: fuse: Move renesas,rcar-{efuse,otp} to nvmem Geert Uytterhoeven
2024-07-30 16:24   ` Rob Herring
2024-07-31  7:37     ` Geert Uytterhoeven
2024-08-19 11:11       ` Krzysztof Kozlowski
2024-08-28 20:10         ` Geert Uytterhoeven
2024-08-29  8:55           ` Krzysztof Kozlowski
2024-08-29  9:10             ` Geert Uytterhoeven
2024-08-29 13:58               ` Rob Herring
2024-08-29 14:34                 ` Geert Uytterhoeven
2024-08-30 15:47                   ` Rob Herring
2024-07-26 13:38 ` [PATCH v3 2/7] nvmem: Add R-Car E-FUSE driver Geert Uytterhoeven
2024-07-26 13:38 ` [PATCH v3 3/7] arm64: dts: renesas: r8a779a0: Add E-FUSE node Geert Uytterhoeven
2024-07-26 13:38 ` [PATCH v3 4/7] arm64: dts: renesas: r8a779f0: " Geert Uytterhoeven
2024-07-26 13:38 ` [PATCH v3 5/7] arm64: dts: renesas: r8a779f4: Add UFS tuning parameters in E-FUSE Geert Uytterhoeven
2024-07-26 13:38 ` [PATCH v3 6/7] arm64: dts: renesas: r8a779g0: Add OTP_MEM node Geert Uytterhoeven
2024-07-26 13:38 ` [PATCH v3 7/7] arm64: dts: renesas: r8a779h0: " Geert Uytterhoeven
2024-08-28 18:43 ` [PATCH v3 0/7] Add Renesas R-Car Gen4 E-FUSE support Geert Uytterhoeven

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