[PATCH RFC linux] dt-bindings: nvmem: Add binding for U-Boot environment NVMEM provider

Rob Herring robh+dt at kernel.org
Thu Oct 14 16:41:44 CEST 2021


On Wed, Oct 13, 2021 at 6:20 PM Marek Behún <kabel at kernel.org> wrote:
>
> Add device tree bindings for U-Boot environment NVMEM provider.
>
> U-Boot environment can be stored at a specific offset of a MTD device,
> EEPROM, MMC, NAND or SATA device, on an UBI volume, or in a file on a
> filesystem.
>
> The environment can contain information such as device's MAC address,
> which should be used by the ethernet controller node.
>
> Signed-off-by: Marek Behún <kabel at kernel.org>
> ---
>  .../bindings/nvmem/denx,u-boot-env.yaml       | 88 +++++++++++++++++++
>  include/dt-bindings/nvmem/u-boot-env.h        | 18 ++++
>  2 files changed, 106 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/denx,u-boot-env.yaml
>  create mode 100644 include/dt-bindings/nvmem/u-boot-env.h
>
> diff --git a/Documentation/devicetree/bindings/nvmem/denx,u-boot-env.yaml b/Documentation/devicetree/bindings/nvmem/denx,u-boot-env.yaml
> new file mode 100644
> index 000000000000..56505c08e622
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/denx,u-boot-env.yaml
> @@ -0,0 +1,88 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/denx,u-boot-env.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: U-Boot environment NVMEM Device Tree Bindings
> +
> +maintainers:
> +  - Marek Behún <kabel at kernel.org>
> +
> +description:
> +  This binding represents U-Boot's environment NVMEM settings which can be
> +  stored on a specific offset of an EEPROM, MMC, NAND or SATA device, or
> +  an UBI volume, or in a file on a filesystem.
> +
> +properties:
> +  compatible:
> +    const: denx,u-boot-env

'u-boot' is a vendor prefix. Unless you are saying Denx owns u-boot...

> +
> +  path:
> +    description:
> +      The path to the file containing the environment if on a filesystem.
> +    $ref: /schemas/types.yaml#/definitions/string
> +
> +patternProperties:
> +  "^[^=]+$":
> +    type: object
> +
> +    description:
> +      This node represents one U-Boot environment variable, which is also one
> +      NVMEM data cell.
> +
> +    properties:
> +      name:

'name' is already a property for every node, so this would collide. It
used to be in the dtb itself, but current revisions generate it from
the node name.

> +        description:
> +          If the variable name contains characters not allowed in device tree node
> +          name, use this property to specify the name, otherwise the variable name
> +          is equal to node name.
> +        $ref: /schemas/types.yaml#/definitions/string
> +
> +      type:

'type' is really too generic. Any given property name should have 1
meaning and data type.

But I expect based on other comments already, all this is going away anyways.

> +        description:
> +          Type of the variable. Since variables, even integers and MAC addresses,
> +          are stored as strings in U-Boot environment, for proper conversion the
> +          type needs to be specified. Use one of the U_BOOT_ENV_TYPE_* prefixed
> +          definitions from include/dt-bindings/nvmem/u-boot-env.h.
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        minimum: 0
> +        maximum: 5


More information about the U-Boot mailing list