Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3929661pxb; Wed, 13 Oct 2021 16:22:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+UQeEAZjW2qXNejJOhsmV17JZMplQ7oslRD/X6qXTS4ZG78WDnbi7ceTkYgZdKqlEB71g X-Received: by 2002:a05:6a00:1703:b0:44c:caeb:482b with SMTP id h3-20020a056a00170300b0044ccaeb482bmr1864172pfc.60.1634167344304; Wed, 13 Oct 2021 16:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634167344; cv=none; d=google.com; s=arc-20160816; b=GyPpsbeIqsNXlKKBsfuVeJd3oVtd9Mo0+i6JYUTufJCVdBUqwnXEz60Y6XDE357MMo N1KM9BLEL7WTEhFvuGK9TBfuA30f5470H5mhx2UxNFN5Apf+LffYFJzDuo6AAazz7Ot+ NruDogyt1uIoyi4X43+LmH7HsoEOrf0L5A3XAwXbYbR5eGjQyMdPyIzpQDdTZvx0gBYW 4lSEP0paGN5wxxtHhg/qQ6EuJRWlv9ixGAvoXBqe7P0JuBBp8iLAeKyvM5E2pG9sU2nw GqPJiwxFb8W8kWd7vj8BlN8DNyAUIT1f6KTJNAnnCCk+7Earm38ak1QcGZRh20x5CyHz jOfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=eVfiSIrhSXWdcVggKEHvqPllODzMaKW22iEw/R+cm3I=; b=R9jPkqQnt8V6aJwelvTkSeKiWpby6yK+A5CoBUvVDswAzd5UHsU5ys1ix3tV3d9T0m 0vFN9JdTzdT865KaxB1quvVw4IBRWB5CCJ7/QZ0IqQrTIPvKIOhCkTql3JwYLCltLiI0 QXx3ssbEGeE4i0d74Et1U/8cc13DGnGK/79lHE/ZGjzrJIEeTAnyQnDBDC4uhdeAz0OL Vq0B0/vtIvGBZg5otlMVHoGL26K0wEY8ZBfItcVIASDUElnQXM1G9c9pl7fbM30fRu2n tvgHHACl9/PybuiD19C6jUS4uYY0EPoJLRBl1iODY4nr430cZW/0+6WCbstsWI+H25hE S93A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KhZRpBRu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z11si1289058pge.484.2021.10.13.16.22.10; Wed, 13 Oct 2021 16:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KhZRpBRu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbhJMXXD (ORCPT + 99 others); Wed, 13 Oct 2021 19:23:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229668AbhJMXXD (ORCPT ); Wed, 13 Oct 2021 19:23:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9F0E8610CE; Wed, 13 Oct 2021 23:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634167259; bh=n7BXvPLigLzcROSkXhiYOaoGmDt3FNTnukgsfSYaSmk=; h=From:To:Cc:Subject:Date:From; b=KhZRpBRuoW22HuxOVTLjBlHDiDTPcMjJ635XAWz/vN0M2G5aAQ7mQl+QxkpQ/WjiL 3dSkXIBOyfdOhlmpgVHSIxtMVQaFpFarlOVX3MXGfPwqzN4AQSkHUoikE7lPxHn9Mo jDksWBqFx8cvWvJT19xDHxQFo4ndm0cVqfw4PczHEEvIUB0vDX4YXTcQPQlxxtbx2L gN1h3u3hsZM4Sg1ANhuhmZhLFQv9up6uR08qR5c9e+FayeitVgFro0pIvD8P4N+aKb pc6M80WVtDTAbckSjqZkbmtwolbteekriaP/bkmdAYSI+Kymi2Opukf0Lm8x6jfCDH OTLWkmR4Nu6dg== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: robh+dt@kernel.org, devicetree@vger.kernel.org, Srinivas Kandagatla , U-Boot Mailing List Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Luka Kovacic , =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH RFC linux] dt-bindings: nvmem: Add binding for U-Boot environment NVMEM provider Date: Thu, 14 Oct 2021 01:20:48 +0200 Message-Id: <20211013232048.16559-1-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../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 + +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 + + 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 = ; + }; + }; + }; + }; + + 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 + */ + +#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 */ -- 2.32.0