diff mbox series

[V2,2/3] dt-bindings: nvmem: add U-Boot environment variables binding

Message ID 20211230090449.11808-2-zajec5@gmail.com
State New
Headers show
Series [V2,1/3] mtd: core: call devm_of_platform_populate() for MTD devices | expand

Commit Message

Rafał Miłecki Dec. 30, 2021, 9:04 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

This binding allows describing a (part of) MTD device (partition) that
contains a block with environment variables. Operating system usually
needs to parse that block to read variables values that may affect
booting process & device configuration.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: s/u,boot/u-boot/
---
 .../devicetree/bindings/nvmem/u-boot,env.yaml | 56 +++++++++++++++++++
 MAINTAINERS                                   |  5 ++
 2 files changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yaml

Comments

Rob Herring (Arm) Jan. 10, 2022, 8:30 p.m. UTC | #1
On Thu, Dec 30, 2021 at 10:04:48AM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> This binding allows describing a (part of) MTD device (partition) that
> contains a block with environment variables. Operating system usually
> needs to parse that block to read variables values that may affect
> booting process & device configuration.

What do the u-boot folks think about this binding? This needs an ack 
from a u-boot maintainer.

> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> V2: s/u,boot/u-boot/
> ---
>  .../devicetree/bindings/nvmem/u-boot,env.yaml | 56 +++++++++++++++++++
>  MAINTAINERS                                   |  5 ++
>  2 files changed, 61 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
> 
> diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
> new file mode 100644
> index 000000000000..e3296e005ffd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: U-Boot environment variables
> +
> +description: |
> +  U-Boot uses environment variables to store device parameters and
> +  configuration. They may be used for booting process, setup or keeping end user
> +  interesting info.
> +
> +  Data is stored on flash partition in a U-Boot specific format (CRC32 and NUL
> +  separated key-value pairs).
> +
> +  This binding allows specifying data location and format (default one or vendor
> +  specific).
> +
> +maintainers:
> +  - Rafał Miłecki <rafal@milecki.pl>
> +
> +allOf:
> +  - $ref: nvmem.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - u-boot,env
> +      - brcm,env
> +
> +  reg:
> +    maxItems: 1
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    partitions {
> +        compatible = "fixed-partitions";
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        partition@0 {
> +            label = "uboot";
> +            reg = <0x0 0x100000>;
> +
> +            #address-cells = <1>;
> +            #size-cells = <1>;
> +
> +            nvmem@10000 {

I think most existing cases define a partition for the u-boot env, but 
this looks like you have it nested with other u-boot related data? Is 
there any reason to nest the partitions? A compatible in a partition 
node should be enough.

> +                compatible = "u-boot,env";
> +                reg = <0x10000 0x10000>;
> +            };
> +        };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 67558097bb66..271c29c84c7d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -19624,6 +19624,11 @@ W:	http://linuxtv.org
>  T:	git git://linuxtv.org/media_tree.git
>  F:	drivers/media/pci/tw686x/
>  
> +U-BOOT ENVIRONMENT VARIABLES
> +M:	Rafał Miłecki <rafal@milecki.pl>
> +S:	Maintained
> +F:	Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
> +
>  UACCE ACCELERATOR FRAMEWORK
>  M:	Zhangfei Gao <zhangfei.gao@linaro.org>
>  M:	Zhou Wang <wangzhou1@hisilicon.com>
> -- 
> 2.31.1
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
new file mode 100644
index 000000000000..e3296e005ffd
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
@@ -0,0 +1,56 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: U-Boot environment variables
+
+description: |
+  U-Boot uses environment variables to store device parameters and
+  configuration. They may be used for booting process, setup or keeping end user
+  interesting info.
+
+  Data is stored on flash partition in a U-Boot specific format (CRC32 and NUL
+  separated key-value pairs).
+
+  This binding allows specifying data location and format (default one or vendor
+  specific).
+
+maintainers:
+  - Rafał Miłecki <rafal@milecki.pl>
+
+allOf:
+  - $ref: nvmem.yaml#
+
+properties:
+  compatible:
+    enum:
+      - u-boot,env
+      - brcm,env
+
+  reg:
+    maxItems: 1
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    partitions {
+        compatible = "fixed-partitions";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        partition@0 {
+            label = "uboot";
+            reg = <0x0 0x100000>;
+
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            nvmem@10000 {
+                compatible = "u-boot,env";
+                reg = <0x10000 0x10000>;
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 67558097bb66..271c29c84c7d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19624,6 +19624,11 @@  W:	http://linuxtv.org
 T:	git git://linuxtv.org/media_tree.git
 F:	drivers/media/pci/tw686x/
 
+U-BOOT ENVIRONMENT VARIABLES
+M:	Rafał Miłecki <rafal@milecki.pl>
+S:	Maintained
+F:	Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
+
 UACCE ACCELERATOR FRAMEWORK
 M:	Zhangfei Gao <zhangfei.gao@linaro.org>
 M:	Zhou Wang <wangzhou1@hisilicon.com>