Files
linux/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
Rafał Miłecki 6b0584c19d dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding
Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. U-Boot
stores its configuration in an environment data block.

Such blocks are usually stored on flash as a separated partition at
hardcoded address. Broadcom however decided to:
1. Store env data block inside U-Boot partition
2. Avoid sticking to hardcoded offsets
3. Use custom header with "uEnv" magic and env data length

Example (length 0x4000):
$ hexdump -n 32 -C -s 0x40000 /dev/mtdblock0
00040000  76 6e 45 75 00 40 00 00  34 89 7a 82 49 4d 41 47  |vnEu.@..4.z.IMAG|
00040010  45 3d 4e 41 4e 44 3a 31  4d 2c 31 30 32 34 4d 00  |E=NAND:1M,1024M.|
(0x40000 offset is unit specific and can change)

Starting with the commit 118f3fbe51 ("dt-bindings: mtd: partitions:
support label/name only partition") DT can describe partitions matching
them by a name (without specifying actual address). With that feature
and this binding change it's possible to:
1. Specify DT node for Broadcom's U-Boot env data subpartition
2. Add nodes for specific environment data variables
3. Reference them as NVMEM cells

This binding is unlikely to help Broadcom's U-Boot. U-Boot SPL needs to
find environment data early (before it accesses DTB) and it does that by
looking for an "uEnv" magic. Dirty way.

This binding can however be used by operating systems. It allows
describing cleanly U-Boot, its env data and variables. It tells
operating system about Broadcom-specific env data so it can parse it.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Link: https://lore.kernel.org/r/20221018154202.4634-2-zajec5@gmail.com
Signed-off-by: Rob Herring <robh@kernel.org>
2022-10-31 09:46:46 -05:00

97 lines
2.3 KiB
YAML

# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: U-Boot environment variables
description: |
U-Boot uses environment variables to store device parameters and
configuration. They may be used for booting process, setup or keeping end user
info.
Data is stored using U-Boot specific formats (variant specific header and NUL
separated key-value pairs).
Environment data can be stored on various storage entities, e.g.:
1. Raw flash partition
2. UBI volume
This binding allows marking storage device (as containing env data) and
specifying used format.
Right now only flash partition case is covered but it may be extended to e.g.
UBI volumes in the future.
Variables can be defined as NVMEM device subnodes.
maintainers:
- Rafał Miłecki <rafal@milecki.pl>
properties:
compatible:
oneOf:
- description: A standalone env data block
const: u-boot,env
- description: Two redundant blocks with active one flagged
const: u-boot,env-redundant-bool
- description: Two redundant blocks with active having higher counter
const: u-boot,env-redundant-count
- description: Broadcom's variant with custom header
const: brcm,env
reg:
maxItems: 1
bootcmd:
type: object
description: Command to use for automatic booting
ethaddr:
type: object
description: Ethernet interface's MAC address
additionalProperties: false
examples:
- |
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
reg = <0x0 0x40000>;
label = "u-boot";
read-only;
};
env: partition@40000 {
compatible = "u-boot,env";
reg = <0x40000 0x10000>;
mac: ethaddr {
};
};
};
- |
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
reg = <0x0 0x100000>;
compatible = "brcm,u-boot";
label = "u-boot";
partition-u-boot-env {
compatible = "brcm,env";
ethaddr {
};
};
};
};