xref: /linux/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml (revision d30c1683aaecb93d2ab95685dc4300a33d3cea7a)
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  env-size:
50    description:
51      Size in bytes of the environment data used by U-Boot for CRC
52      calculation. If omitted, the full NVMEM region size is used.
53    $ref: /schemas/types.yaml#/definitions/uint32
54
55  ethaddr:
56    type: object
57    description: Ethernet interfaces base MAC address.
58    additionalProperties: false
59
60    properties:
61      "#nvmem-cell-cells":
62        description: The first argument is a MAC address offset.
63        const: 1
64
65allOf:
66  - if:
67      properties:
68        $nodename:
69          not:
70            contains:
71              pattern: "^partition@[0-9a-f]+$"
72    then:
73      properties:
74        reg: false
75
76additionalProperties: false
77
78examples:
79  - |
80    partitions {
81        compatible = "fixed-partitions";
82        #address-cells = <1>;
83        #size-cells = <1>;
84
85        partition@0 {
86            reg = <0x0 0x40000>;
87            label = "u-boot";
88            read-only;
89        };
90
91        env: partition@40000 {
92            compatible = "u-boot,env";
93            reg = <0x40000 0x10000>;
94
95            mac: ethaddr {
96                #nvmem-cell-cells = <1>;
97            };
98        };
99    };
100  - |
101    partitions {
102        compatible = "fixed-partitions";
103        #address-cells = <1>;
104        #size-cells = <1>;
105
106        partition@0 {
107            reg = <0x0 0x100000>;
108            compatible = "brcm,u-boot";
109            label = "u-boot";
110
111            partition-u-boot-env {
112                compatible = "brcm,env";
113                env-size = <0x20000>;
114
115                ethaddr {
116                };
117            };
118        };
119    };
120  - |
121    partition@0 {
122        reg = <0x0 0x100000>;
123        label = "ubi";
124        compatible = "linux,ubi";
125
126        volumes {
127            ubi-volume-u-boot-env {
128                volname = "env";
129
130                nvmem-layout {
131                    compatible = "u-boot,env";
132
133                    ethaddr {
134                        #nvmem-cell-cells = <1>;
135                    };
136                };
137            };
138        };
139    };
140