Skip to content

Commit 5db1c2d

Browse files
Rafał Miłeckirobherring
authored andcommitted
dt-bindings: nvmem: add U-Boot environment variables binding
U-Boot uses environment variables for storing device setup data. It usually needs to be accessed by a bootloader, kernel and often user-space. This binding allows describing environment data located in a raw flash partition. It's treated as NVMEM device and can be reused later for other storage devices. Using DT should be cleaner than hardcoding & duplicating such info in multiple places. Bootloader & kernel can share DTS and user-space can try reading it too or just have correct data exposed by a kernel. A custom "compatible" string allows system to automatically load relevant NVMEM driver but phandle can be also used for reading raw location. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220228131250.16943-1-zajec5@gmail.com
1 parent 3d8fa7a commit 5db1c2d

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: U-Boot environment variables
8+
9+
description: |
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+
Right now only flash partition case is covered but it may be extended to e.g.
25+
UBI volumes in the future.
26+
27+
maintainers:
28+
- Rafał Miłecki <rafal@milecki.pl>
29+
30+
properties:
31+
compatible:
32+
oneOf:
33+
- description: A standalone env data block
34+
const: u-boot,env
35+
- description: Two redundant blocks with active one flagged
36+
const: u-boot,env-redundant-bool
37+
- description: Two redundant blocks with active having higher counter
38+
const: u-boot,env-redundant-count
39+
40+
reg:
41+
maxItems: 1
42+
43+
additionalProperties: false
44+
45+
examples:
46+
- |
47+
partitions {
48+
compatible = "fixed-partitions";
49+
#address-cells = <1>;
50+
#size-cells = <1>;
51+
52+
partition@0 {
53+
reg = <0x0 0x40000>;
54+
label = "u-boot";
55+
read-only;
56+
};
57+
58+
env: partition@40000 {
59+
compatible = "u-boot,env";
60+
reg = <0x40000 0x10000>;
61+
};
62+
};

MAINTAINERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19665,6 +19665,11 @@ W: http://linuxtv.org
1966519665
T: git git://linuxtv.org/media_tree.git
1966619666
F: drivers/media/pci/tw686x/
1966719667

19668+
U-BOOT ENVIRONMENT VARIABLES
19669+
M: Rafał Miłecki <rafal@milecki.pl>
19670+
S: Maintained
19671+
F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
19672+
1966819673
UACCE ACCELERATOR FRAMEWORK
1966919674
M: Zhangfei Gao <zhangfei.gao@linaro.org>
1967019675
M: Zhou Wang <wangzhou1@hisilicon.com>

0 commit comments

Comments
 (0)