xref: /linux/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml (revision 52c996d3f40b40f87ef9dc80596903309682acc3)
1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/nvmem/layouts/u-boot,env.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: U-Boot environment variables layout
8
9description: |
10  U-Boot uses environment variables to store device parameters and
11  configuration. They may be used for booting process, setup or keeping end user
12  info.
13
14  Data is stored using U-Boot specific formats (variant specific header and NUL
15  separated key-value pairs).
16
17  Environment data can be stored on various storage entities, e.g.:
18  1. Raw flash partition
19  2. UBI volume
20
21  This binding allows marking storage device (as containing env data) and
22  specifying used format.
23
24  Variables can be defined as NVMEM device subnodes.
25
26maintainers:
27  - Rafał Miłecki <rafal@milecki.pl>
28
29properties:
30  compatible:
31    oneOf:
32      - description: A standalone env data block
33        const: u-boot,env
34      - description: Two redundant blocks with active one flagged
35        const: u-boot,env-redundant-bool
36      - description: Two redundant blocks with active having higher counter
37        const: u-boot,env-redundant-count
38      - description: Broadcom's variant with custom header
39        const: brcm,env
40
41  reg:
42    description: Partition offset and size for env on top of MTD
43    maxItems: 1
44
45  bootcmd:
46    type: object
47    description: Command to use for automatic booting
48
49  ethaddr:
50    type: object
51    description: Ethernet interfaces base MAC address.
52    additionalProperties: false
53
54    properties:
55      "#nvmem-cell-cells":
56        description: The first argument is a MAC address offset.
57        const: 1
58
59allOf:
60  - if:
61      properties:
62        $nodename:
63          not:
64            contains:
65              pattern: "^partition@[0-9a-f]+$"
66    then:
67      properties:
68        reg: false
69
70additionalProperties: false
71
72examples:
73  - |
74    partitions {
75        compatible = "fixed-partitions";
76        #address-cells = <1>;
77        #size-cells = <1>;
78
79        partition@0 {
80            reg = <0x0 0x40000>;
81            label = "u-boot";
82            read-only;
83        };
84
85        env: partition@40000 {
86            compatible = "u-boot,env";
87            reg = <0x40000 0x10000>;
88
89            mac: ethaddr {
90                #nvmem-cell-cells = <1>;
91            };
92        };
93    };
94  - |
95    partitions {
96        compatible = "fixed-partitions";
97        #address-cells = <1>;
98        #size-cells = <1>;
99
100        partition@0 {
101            reg = <0x0 0x100000>;
102            compatible = "brcm,u-boot";
103            label = "u-boot";
104
105            partition-u-boot-env {
106                compatible = "brcm,env";
107
108                ethaddr {
109                };
110            };
111        };
112    };
113  - |
114    partition@0 {
115        reg = <0x0 0x100000>;
116        label = "ubi";
117        compatible = "linux,ubi";
118
119        volumes {
120            ubi-volume-u-boot-env {
121                volname = "env";
122
123                nvmem-layout {
124                    compatible = "u-boot,env";
125
126                    ethaddr {
127                        #nvmem-cell-cells = <1>;
128                    };
129                };
130            };
131        };
132    };
133