* [PATCH v2 0/3] nvmem: s32g-ocotp: Add driver for S32G OCOTP
@ 2025-08-26 16:37 Dan Carpenter
2025-08-26 16:38 ` [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file Dan Carpenter
2025-08-26 16:38 ` [PATCH V2 3/3] arm64: dts: s32g: Add device tree information for the OCOTP driver Dan Carpenter
0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2025-08-26 16:37 UTC (permalink / raw)
To: Chester Lin
Cc: Ciprian Costea, Conor Dooley, devicetree, Fabio Estevam,
Ghennadi Procopciuc, imx, Krzysztof Kozlowski, linux-arm-kernel,
linux-kernel, Matthias Brugger, NXP S32 Linux Team,
Pengutronix Kernel Team, Rob Herring, Sascha Hauer, Shawn Guo,
Srinivas Kandagatla, linaro-s32
This driver provides a way to access the On Chip One-Time Programmable
Controller (OCOTP) on the s32g chipset. There are three versions of this
chip but they're compatible.
v2:
I have fixed everything that people pointed out about version 1.
Sorry, Rob and Krzysztof, for the problems with the device tree YAML
file. I had an issue with my dtschema installation and it's fixed now.
I also screwed up the From headers in v1. I called git format-patch
without passing the --from argument. I've fixed my scripts so that
won't happen again. I also messed up the Signed-off by lines in patch
1 and 2. Sorry!
My other mistakes were from not being a familiar enough with the
subsystem and those are addressed as well. Especially re-writing the
driver using keepouts cut down a lot of lines of code. I've tested it
and the results are the same before and after.
Ciprian Costea (2):
dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file
nvmem: s32g-ocotp: Add driver for S32G OCOTP
Dan Carpenter (1):
arm64: dts: s32g: Add device tree information for the OCOTP driver
.../bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml | 45 ++++++++
arch/arm64/boot/dts/freescale/s32g2.dtsi | 7 ++
arch/arm64/boot/dts/freescale/s32g3.dtsi | 7 ++
drivers/nvmem/Kconfig | 10 ++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/s32g-ocotp-nvmem.c | 101 ++++++++++++++++++
6 files changed, 172 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
create mode 100644 drivers/nvmem/s32g-ocotp-nvmem.c
--
2.47.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file
2025-08-26 16:37 [PATCH v2 0/3] nvmem: s32g-ocotp: Add driver for S32G OCOTP Dan Carpenter
@ 2025-08-26 16:38 ` Dan Carpenter
2025-08-27 16:27 ` Frank Li
2025-08-27 17:26 ` Conor Dooley
2025-08-26 16:38 ` [PATCH V2 3/3] arm64: dts: s32g: Add device tree information for the OCOTP driver Dan Carpenter
1 sibling, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2025-08-26 16:38 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Ciprian Costea,
devicetree, linux-kernel, NXP S32 Linux Team, linaro-s32
From: Ciprian Costea <ciprianmarian.costea@nxp.com>
Add bindings to expose the On Chip One-Time Programmable Controller
(OCOTP) for the NXP s32g chipset. There are three versions of this
chip but they're compatible so we can fall back to the nxp,s32g2-ocotp
compatible.
Signed-off-by: Ciprian Costea <ciprianmarian.costea@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: dt_binding_check DT_SCHEMA_FILES=nxp,s32g-ocotp-nvmem.yaml is clean
make CHECK_DTBS=y freescale/*.dtb is clean. Particularly the
freescale/s32g274a-evb.dtb file which Rob mentioned.
remove bogus include file
remove redundant "reg" description
remove #address-cells and #size-cells since they are already in
nvmem.yaml
Fix email From header
.../bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml | 45 +++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
diff --git a/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
new file mode 100644
index 000000000000..01adc6093c68
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/nxp,s32g-ocotp-nvmem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP S32G OCOTP NVMEM driver
+
+maintainers:
+ - Ciprian Costea <ciprianmarian.costea@nxp.com>
+
+description: |
+ The drivers provides an interface to access One Time
+ Programmable memory pages, such as TMU fuse values.
+
+allOf:
+ - $ref: nvmem.yaml#
+
+properties:
+ compatible:
+ oneOf:
+ - enum:
+ - nxp,s32g2-ocotp
+ - items:
+ - enum:
+ - nxp,s32r45-ocotp
+ - nxp,s32g3-ocotp
+ - const: nxp,s32g2-ocotp
+ reg:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ ocotp: nvmem@400a4000 {
+ compatible = "nxp,s32g2-ocotp";
+ reg = <0x400a4000 0x400>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH V2 3/3] arm64: dts: s32g: Add device tree information for the OCOTP driver
2025-08-26 16:37 [PATCH v2 0/3] nvmem: s32g-ocotp: Add driver for S32G OCOTP Dan Carpenter
2025-08-26 16:38 ` [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file Dan Carpenter
@ 2025-08-26 16:38 ` Dan Carpenter
2025-08-26 16:46 ` Frank Li
1 sibling, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2025-08-26 16:38 UTC (permalink / raw)
To: Chester Lin
Cc: Matthias Brugger, Ghennadi Procopciuc, NXP S32 Linux Team,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-kernel,
imx, devicetree, linux-kernel, linaro-s32
Add the device tree information for the S32G On Chip One-Time
Programmable Controller (OCOTP) chip.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: change "ocotp: ocotp@400a4000 {" to "ocotp: nvmem@400a4000 {"
arch/arm64/boot/dts/freescale/s32g2.dtsi | 7 +++++++
arch/arm64/boot/dts/freescale/s32g3.dtsi | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/s32g2.dtsi b/arch/arm64/boot/dts/freescale/s32g2.dtsi
index 6a7cc7b33754..e8cfddabfc24 100644
--- a/arch/arm64/boot/dts/freescale/s32g2.dtsi
+++ b/arch/arm64/boot/dts/freescale/s32g2.dtsi
@@ -701,5 +701,12 @@ gic: interrupt-controller@50800000 {
interrupt-controller;
#interrupt-cells = <3>;
};
+
+ ocotp: nvmem@400a4000 {
+ compatible = "nxp,s32g2-ocotp";
+ reg = <0x400a4000 0x400>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
};
};
diff --git a/arch/arm64/boot/dts/freescale/s32g3.dtsi b/arch/arm64/boot/dts/freescale/s32g3.dtsi
index 61ee08f0cfdc..8fe1fa35e9ac 100644
--- a/arch/arm64/boot/dts/freescale/s32g3.dtsi
+++ b/arch/arm64/boot/dts/freescale/s32g3.dtsi
@@ -765,6 +765,13 @@ gic: interrupt-controller@50800000 {
<0x50420000 0x2000>;
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
};
+
+ ocotp: nvmem@400a4000 {
+ compatible = "nxp,s32g3-ocotp", "nxp,s32g2-ocotp";
+ reg = <0x400a4000 0x400>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
};
timer {
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2 3/3] arm64: dts: s32g: Add device tree information for the OCOTP driver
2025-08-26 16:38 ` [PATCH V2 3/3] arm64: dts: s32g: Add device tree information for the OCOTP driver Dan Carpenter
@ 2025-08-26 16:46 ` Frank Li
0 siblings, 0 replies; 6+ messages in thread
From: Frank Li @ 2025-08-26 16:46 UTC (permalink / raw)
To: Dan Carpenter
Cc: Chester Lin, Matthias Brugger, Ghennadi Procopciuc,
NXP S32 Linux Team, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-arm-kernel, imx,
devicetree, linux-kernel, linaro-s32
On Tue, Aug 26, 2025 at 07:38:15PM +0300, Dan Carpenter wrote:
> Add the device tree information for the S32G On Chip One-Time
> Programmable Controller (OCOTP) chip.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: change "ocotp: ocotp@400a4000 {" to "ocotp: nvmem@400a4000 {"
>
> arch/arm64/boot/dts/freescale/s32g2.dtsi | 7 +++++++
> arch/arm64/boot/dts/freescale/s32g3.dtsi | 7 +++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/s32g2.dtsi b/arch/arm64/boot/dts/freescale/s32g2.dtsi
> index 6a7cc7b33754..e8cfddabfc24 100644
> --- a/arch/arm64/boot/dts/freescale/s32g2.dtsi
> +++ b/arch/arm64/boot/dts/freescale/s32g2.dtsi
> @@ -701,5 +701,12 @@ gic: interrupt-controller@50800000 {
> interrupt-controller;
> #interrupt-cells = <3>;
> };
> +
> + ocotp: nvmem@400a4000 {
> + compatible = "nxp,s32g2-ocotp";
> + reg = <0x400a4000 0x400>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
Please keep order according to address, 0x400a4000 < 0x50800000
Frank Li
> };
> };
> diff --git a/arch/arm64/boot/dts/freescale/s32g3.dtsi b/arch/arm64/boot/dts/freescale/s32g3.dtsi
> index 61ee08f0cfdc..8fe1fa35e9ac 100644
> --- a/arch/arm64/boot/dts/freescale/s32g3.dtsi
> +++ b/arch/arm64/boot/dts/freescale/s32g3.dtsi
> @@ -765,6 +765,13 @@ gic: interrupt-controller@50800000 {
> <0x50420000 0x2000>;
> interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
> };
> +
> + ocotp: nvmem@400a4000 {
> + compatible = "nxp,s32g3-ocotp", "nxp,s32g2-ocotp";
> + reg = <0x400a4000 0x400>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
> };
>
> timer {
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file
2025-08-26 16:38 ` [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file Dan Carpenter
@ 2025-08-27 16:27 ` Frank Li
2025-08-27 17:26 ` Conor Dooley
1 sibling, 0 replies; 6+ messages in thread
From: Frank Li @ 2025-08-27 16:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ciprian Costea, devicetree, linux-kernel,
NXP S32 Linux Team, linaro-s32
On Tue, Aug 26, 2025 at 07:38:03PM +0300, Dan Carpenter wrote:
> From: Ciprian Costea <ciprianmarian.costea@nxp.com>
>
> Add bindings to expose the On Chip One-Time Programmable Controller
> (OCOTP) for the NXP s32g chipset. There are three versions of this
> chip but they're compatible so we can fall back to the nxp,s32g2-ocotp
> compatible.
>
> Signed-off-by: Ciprian Costea <ciprianmarian.costea@nxp.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: dt_binding_check DT_SCHEMA_FILES=nxp,s32g-ocotp-nvmem.yaml is clean
> make CHECK_DTBS=y freescale/*.dtb is clean. Particularly the
> freescale/s32g274a-evb.dtb file which Rob mentioned.
> remove bogus include file
> remove redundant "reg" description
> remove #address-cells and #size-cells since they are already in
> nvmem.yaml
> Fix email From header
>
> .../bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml | 45 +++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
>
> diff --git a/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
> new file mode 100644
> index 000000000000..01adc6093c68
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/nxp,s32g-ocotp-nvmem.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP S32G OCOTP NVMEM driver
> +
> +maintainers:
> + - Ciprian Costea <ciprianmarian.costea@nxp.com>
> +
> +description: |
Needn't |
https://yaml.org/spec/1.2.2/#scalars show "|" ">" "" 's difference.
> + The drivers provides an interface to access One Time
> + Programmable memory pages, such as TMU fuse values.
> +
> +allOf:
> + - $ref: nvmem.yaml#
Move just before examples in case need if-else later.
> +
> +properties:
> + compatible:
> + oneOf:
> + - enum:
> + - nxp,s32g2-ocotp
> + - items:
> + - enum:
> + - nxp,s32r45-ocotp
> + - nxp,s32g3-ocotp
Keep alphabet order for enum
Frank
> + - const: nxp,s32g2-ocotp
> + reg:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + ocotp: nvmem@400a4000 {
> + compatible = "nxp,s32g2-ocotp";
> + reg = <0x400a4000 0x400>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file
2025-08-26 16:38 ` [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file Dan Carpenter
2025-08-27 16:27 ` Frank Li
@ 2025-08-27 17:26 ` Conor Dooley
1 sibling, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2025-08-27 17:26 UTC (permalink / raw)
To: Dan Carpenter
Cc: Srinivas Kandagatla, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Ciprian Costea, devicetree, linux-kernel,
NXP S32 Linux Team, linaro-s32
[-- Attachment #1: Type: text/plain, Size: 2500 bytes --]
On Tue, Aug 26, 2025 at 07:38:03PM +0300, Dan Carpenter wrote:
> From: Ciprian Costea <ciprianmarian.costea@nxp.com>
>
> Add bindings to expose the On Chip One-Time Programmable Controller
> (OCOTP) for the NXP s32g chipset. There are three versions of this
> chip but they're compatible so we can fall back to the nxp,s32g2-ocotp
> compatible.
>
> Signed-off-by: Ciprian Costea <ciprianmarian.costea@nxp.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> v2: dt_binding_check DT_SCHEMA_FILES=nxp,s32g-ocotp-nvmem.yaml is clean
> make CHECK_DTBS=y freescale/*.dtb is clean. Particularly the
> freescale/s32g274a-evb.dtb file which Rob mentioned.
> remove bogus include file
> remove redundant "reg" description
> remove #address-cells and #size-cells since they are already in
> nvmem.yaml
> Fix email From header
>
> .../bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml | 45 +++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
>
> diff --git a/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
> new file mode 100644
> index 000000000000..01adc6093c68
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/nxp,s32g-ocotp-nvmem.yaml
> @@ -0,0 +1,45 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/nxp,s32g-ocotp-nvmem.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP S32G OCOTP NVMEM driver
> +
> +maintainers:
> + - Ciprian Costea <ciprianmarian.costea@nxp.com>
> +
> +description: |
> + The drivers provides an interface to access One Time
> + Programmable memory pages, such as TMU fuse values.
> +
> +allOf:
> + - $ref: nvmem.yaml#
> +
> +properties:
> + compatible:
> + oneOf:
> + - enum:
> + - nxp,s32g2-ocotp
> + - items:
> + - enum:
> + - nxp,s32r45-ocotp
> + - nxp,s32g3-ocotp
> + - const: nxp,s32g2-ocotp
> + reg:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + ocotp: nvmem@400a4000 {
If you respin, drop the "ocotp" label, since the example doesn't use it.
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-27 17:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 16:37 [PATCH v2 0/3] nvmem: s32g-ocotp: Add driver for S32G OCOTP Dan Carpenter
2025-08-26 16:38 ` [PATCH V2 1/3] dt-bindings: nvmem: Add the nxp,s32g-ocotp yaml file Dan Carpenter
2025-08-27 16:27 ` Frank Li
2025-08-27 17:26 ` Conor Dooley
2025-08-26 16:38 ` [PATCH V2 3/3] arm64: dts: s32g: Add device tree information for the OCOTP driver Dan Carpenter
2025-08-26 16:46 ` Frank Li
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).