From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: "Marek Behún" <kabel@kernel.org>,
robh+dt@kernel.org, devicetree@vger.kernel.org,
"U-Boot Mailing List" <u-boot@lists.denx.de>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Luka Kovacic <luka.kovacic@sartura.hr>
Subject: Re: [PATCH RFC linux] dt-bindings: nvmem: Add binding for U-Boot environment NVMEM provider
Date: Thu, 14 Oct 2021 09:26:27 +0100 [thread overview]
Message-ID: <629c8ba1-c924-565f-0b3c-8b625f4e5fb0@linaro.org> (raw)
In-Reply-To: <20211013232048.16559-1-kabel@kernel.org>
On 14/10/2021 00:20, Marek Behún 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.
>
Have you looked at
./Documentation/devicetree/bindings/mtd/partitions/nvmem-cells.yaml ?
--srini
> Signed-off-by: Marek Behún <kabel@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@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
> +
> + 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:
> + 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:
> + 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
> +
> + required:
> + - type
> +
> +required:
> + - compatible
> +
> +additionalProperties: true
> +
> +examples:
> + - |
> +
> + #include <dt-bindings/nvmem/u-boot-env.h>
> +
> + spi-flash {
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition@180000 {
> + compatible = "denx,u-boot-env";
> + label = "u-boot-env";
> + reg = <0x180000 0x10000>;
> +
> + eth0_addr: ethaddr {
> + type = <U_BOOT_ENV_TYPE_MAC_ADDRESS>;
> + };
> + };
> + };
> + };
> +
> + ethernet-controller {
> + nvmem-cells = <ð0_addr>;
> + nvmem-cell-names = "mac-address";
> + };
> +
> +...
> diff --git a/include/dt-bindings/nvmem/u-boot-env.h b/include/dt-bindings/nvmem/u-boot-env.h
> new file mode 100644
> index 000000000000..760e5b240619
> --- /dev/null
> +++ b/include/dt-bindings/nvmem/u-boot-env.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Macros for U-Boot environment NVMEM device tree bindings.
> + *
> + * Copyright (C) 2021 Marek Behún <kabel@kernel.org>
> + */
> +
> +#ifndef __DT_BINDINGS_NVMEM_U_BOOT_ENV_H
> +#define __DT_BINDINGS_NVMEM_U_BOOT_ENV_H
> +
> +#define U_BOOT_ENV_TYPE_STRING 0
> +#define U_BOOT_ENV_TYPE_ULONG 1
> +#define U_BOOT_ENV_TYPE_BOOL 2
> +#define U_BOOT_ENV_TYPE_MAC_ADDRESS 3
> +#define U_BOOT_ENV_TYPE_ULONG_HEX 4
> +#define U_BOOT_ENV_TYPE_ULONG_DEC 5
> +
> +#endif /* __DT_BINDINGS_NVMEM_U_BOOT_ENV_H */
>
next prev parent reply other threads:[~2021-10-14 8:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 23:20 [PATCH RFC linux] dt-bindings: nvmem: Add binding for U-Boot environment NVMEM provider Marek Behún
2021-10-14 8:26 ` Srinivas Kandagatla [this message]
2021-10-14 10:06 ` Marek Behún
2021-10-14 10:30 ` Srinivas Kandagatla
2021-10-14 10:55 ` Marek Behún
2021-10-14 11:36 ` Srinivas Kandagatla
2021-10-14 13:33 ` Tom Rini
2021-10-14 14:31 ` Rob Herring
2021-10-14 14:41 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=629c8ba1-c924-565f-0b3c-8b625f4e5fb0@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=kabel@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luka.kovacic@sartura.hr \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).