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