Skip to contentSkip to conversation

dt-bindings: add U-Boot chosen for environment data phandle

RFC PATCH In review Rafał Miłecki 2 participants 2 messages Feb 17, 2022 Device tree bindings

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 dt-bindings: add U-Boot chosen for environment data phandle

From: Rafał Miłecki <[email protected]>

This is RFC and request for a help & discussion.

While reviewing patch for U-Boot env binding it has been mentioned that:

1. /Processing/ whole DT in U-Boot may be too much work Handling flash devices, partitions, their formats & NVMEM may require too many U-Boot drivers involved.

2. It'd be nice to have env data storage devices pointed in chosen

I wrote this hacky PATCH to give a rough idea how it could look like.

Please review this and let me know:
1. If solution with chosen + phandles is acceptable
2. How to properly name .yaml file
3. Where it put it

---
 .../devicetree/bindings/u-boot,chosen.yaml    | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/u-boot,chosen.yaml
Documentation/devicetree/bindings/u-boot,chosen.yaml new file +39 -0
new file mode 100644
index 000000000000..8369da91193d
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/u-boot,chosen.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: U-Boot setup
+
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+properties:
+  u-boot,env:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: |
+      A list of storage volumes containing U-Boot environment data.
+
+      Env data can be stored on various kinds of storage devices, e.g.:
+      1. Raw flash partition
+      2. UBI volume
+
+additionalProperties: true
+
+examples:
+  - |
+    chosen {
+        u-boot,env = <&env>;
+    };
+
+    partitions {
+        compatible = "fixed-partitions";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        env: partition@0 {
+            reg = <0x0000000 0x1000>;
+            label = "u-boot-env";
+        };
+    };
Signature · 1 line
2.34.1
#1 lore raw
Quoted 49 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

This is RFC and request for a help & discussion.

While reviewing patch for U-Boot env binding it has been mentioned that:

1. /Processing/ whole DT in U-Boot may be too much work Handling flash devices, partitions, their formats & NVMEM may require too many U-Boot drivers involved.

2. It'd be nice to have env data storage devices pointed in chosen

I wrote this hacky PATCH to give a rough idea how it could look like.

Please review this and let me know:
1. If solution with chosen + phandles is acceptable
2. How to properly name .yaml file
3. Where it put it

---
 .../devicetree/bindings/u-boot,chosen.yaml    | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/u-boot,chosen.yaml
Documentation/devicetree/bindings/u-boot,chosen.yaml new file +17 -0
new file mode 100644
index 000000000000..8369da91193d
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/u-boot,chosen.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: U-Boot setup
+
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+properties:
+  u-boot,env:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description: |
+      A list of storage volumes containing U-Boot environment data.
+

Documentation/devicetree/bindings/u-boot,chosen.yaml line 27

Quoted 10 lines
Documentation/devicetree/bindings/u-boot,chosen.yaml new file +10 -0
+      Env data can be stored on various kinds of storage devices, e.g.:
+      1. Raw flash partition
+      2. UBI volume
+
+additionalProperties: true
+
+examples:
+  - |
+    chosen {
+        u-boot,env = <&env>;

You should look at the u-boot config support:

https://github.com/devicetree-org/dt-schema/commit/0986f729eff0f40a66e85ab9dfb37681bf025ac4