Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4253118pxb; Thu, 14 Oct 2021 01:29:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtdWBUX8hY+lJ7d8vBXuoURLb3vvcjpBJcZXgL6sBbO2hBkQLfvKCImp6CYgCNNZt2Cy/0 X-Received: by 2002:a17:906:1bb1:: with SMTP id r17mr2042944ejg.533.1634200143081; Thu, 14 Oct 2021 01:29:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634200143; cv=none; d=google.com; s=arc-20160816; b=vHlNTFIKmG5IZFFvdXmKi+KbyzAsG5MXAaaDLTzOxmx8ieBvSdvnbG8Rqe6dEWJDbb fg7AZwe6FrGrhBSq1lR7mKtO8rxkcGRM2jZd0J/P3Eh3oGMeimDkn027T2r3UwH9SobW k3U7QlWcu/ok+/mVJpmS7KnCtRlBp2EPIoyRKSI4LzQ1nUj+XuVyCmJ8L62E8JcNrS5y doPkV914dFoNfBGB7zhQr7PJoF4csXUzl1N8X6pNhS+m7ApQfcVQgR6WIZUvYeWstYV+ mD7HnhLQXNRpvNLCrpB0yOWrdyTcFhsFOTrx2rWHmUeozLbCYNFsPJSbMKXMI4m6W1wU ZOtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=gnT7ITUDew6zP4Lg5jF9hadktZV+ii+Iy6W/r1hLHv0=; b=iGGCffTTpx30NoSAwKGuUnfD/vb8j3gYO9kgO67gFnu7xCPp+ry9UtZEb+WqmSda3X Y4KjrHMWL2oTWuuacbXwuWHOaXiAhwYPL6r3U40EFIPvMAg4SenDQm+L+QHsuhRF8I/M zS1fE4sTzVFFnON4GeQQRdx/c/YUlaU8jofAVgQ80y3G+TzBPxG2NgnhxrLBJQWZjpMc Qp6LhAVkMjvGAI2icbw+NNJ1BhR7nGmwlQi5cmkmWCHiCm0eUBKkraKJZwO7KI+iMsaH HLKLZS85rYJa1IK6I556gzJxM1XveoSYgQi93m+UF15n9qkDTdsNu/Sz7bbNFyj6oV3f BRoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ch547gAZ; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh16si2648542ejb.666.2021.10.14.01.28.39; Thu, 14 Oct 2021 01:29:03 -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=@linaro.org header.s=google header.b=ch547gAZ; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbhJNI2h (ORCPT + 99 others); Thu, 14 Oct 2021 04:28:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbhJNI2g (ORCPT ); Thu, 14 Oct 2021 04:28:36 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D852C06174E for ; Thu, 14 Oct 2021 01:26:30 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id r10so16738572wra.12 for ; Thu, 14 Oct 2021 01:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gnT7ITUDew6zP4Lg5jF9hadktZV+ii+Iy6W/r1hLHv0=; b=ch547gAZR+Q3c3Y327p3FYyn/arYGkYkc8PECoQM73tPd7llbZqpZ9kvJ7xF/juuU3 fk4AzzHKo5JYR3JKmSx1FB/kq/Zq2hoQMwvG+b7MdXQap36mMbu3DBq8IApbuZDBXTGZ D0IVrEFt1HC9S/0NuF1mFN+KLgXevLgODHWfV7omjKTUpGr2+A7WGRHyUpYSPgF4RMId zmf7LbwtLBKkeWyUH1OoDPG/s3oqpFjGauXbC2p9WZGHHA8o/Un/vXt6NY93Y+8HKG92 ArjVUr/hXPp3vZleNy2IVa5mPocPo5silIz9Bzc3rLl+0CxMQVL0tVu3rckQJ8n0S9lm uZLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gnT7ITUDew6zP4Lg5jF9hadktZV+ii+Iy6W/r1hLHv0=; b=O7rs210BKVU1e1zum17MXKaErN4jTRgvuX9qopyRwH8gXPl+kkCELBdYJN9G5TUBHk AD0QUD1xFBOqX8foDl7QdP7fBv97uYAC8GfB+zWD0kYqjWSYaEaW1BrYP5+9hLYW0xCY bCGeuukT8DxJCTzOPXzeAgAhNQ+BZN+taxxhtSo5SJZkxddfrU9V6c2X+iqdARbeec2H D3PYN1RkbbXuRyVwqvyQuOsBjZyW9exYrKg199XCzXqD/RCu0cPPreITpKxQ3yXsmhBq MeG//aAWkVyKyTcTI7JGU5f5EKUmFoiCVNtfq28fk3/fsoRlX83pmxxZxqkkSpLTQx6M nHUA== X-Gm-Message-State: AOAM533dpan2m3DJajOO5QLMcDxQ/O+zMuHVBs876PA6Lbm2HLzbUSaR TYPzxYRLJwl2WyuwF5KGuyhfWXTToX07Ww== X-Received: by 2002:a5d:47ac:: with SMTP id 12mr4811542wrb.352.1634199988926; Thu, 14 Oct 2021 01:26:28 -0700 (PDT) Received: from [192.168.86.34] (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.googlemail.com with ESMTPSA id l20sm10597428wmq.42.2021.10.14.01.26.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Oct 2021 01:26:28 -0700 (PDT) Subject: Re: [PATCH RFC linux] dt-bindings: nvmem: Add binding for U-Boot environment NVMEM provider To: =?UTF-8?Q?Marek_Beh=c3=ban?= , robh+dt@kernel.org, devicetree@vger.kernel.org, U-Boot Mailing List Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Luka Kovacic References: <20211013232048.16559-1-kabel@kernel.org> From: Srinivas Kandagatla Message-ID: <629c8ba1-c924-565f-0b3c-8b625f4e5fb0@linaro.org> Date: Thu, 14 Oct 2021 09:26:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211013232048.16559-1-kabel@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 > --- > .../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 */ >