Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp769652pxp; Fri, 11 Mar 2022 14:39:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYF6UTXqIeB+jyhfr+08AEUOKZ/MyLouvbGZHuTK7Q3oABq7ZuxOtJ+wCAHmj0CBn3W91F X-Received: by 2002:a17:90a:178f:b0:1bf:5f5a:728 with SMTP id q15-20020a17090a178f00b001bf5f5a0728mr13303167pja.171.1647038345945; Fri, 11 Mar 2022 14:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647038345; cv=none; d=google.com; s=arc-20160816; b=L989g9GUknd8YfrSkKbHlsF7PtpgHXELNv1dQb/i0hP+iVcf4lezgBM6t1eM/oTogh xq6KHgn/pfGHUkVkTO2A4fBT5P4hPka376syiqV41iS+ygu7muqh8z9DhxC1LyXLf2s3 /xYQP4D41pvRpevl4bYsyk2xUpdWaIHhtY16KZ5lshCgPcVNS87n7jvn958ux2nkm8Ey TJy74XuXJxWFpwI0oo9LgRImIT9jjCjpXDNXhNwr+a01c8TQsgp0T4IEdbiQRk3uvR56 1O+78fY6td3/P0uSwRJLMTHFMCYhhG2LKRZlYMzGIzf3/XTb6gMrLViK/nOS860jrFyv BuUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=Xsz2Lkc59BEsun7yjrO91nkFvMRDtNpNPTs688heElw=; b=J2JatimqkECLj6m4S5cgbrZTCrtjLTqlzFtrDSvQCQZSPlp5p/BJ6FXYhv2ECqH9Co 785aAo9EYlkP5hvAF8YSznEqpyCDzo/odE9V7/bJyQjE+N2PCqnhRKvW0vqJ6PoRS/lm Sf1iJfBx2aZHmFEW8K9xq6+9PsSDnaQO6QxF1+NvVu3NbEEDNPGZzZbwL9IQScs2TBYr iv43+yqsFWTcnUKaljmql+JERNdNC2bwKicTDntd66rrv+WaWUaOymmpkaSu+LtTUwkF oBxHYKQQyFmTPifBKrtYn3jZRcX/PC/2iCjxSz5jCo7sMGJGsNTp7ExjEh4c+mgqfAMc nIKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nCf1DdLQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j9-20020a056a00130900b004f777b51012si5815171pfu.306.2022.03.11.14.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:39:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nCf1DdLQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5402312BF53; Fri, 11 Mar 2022 13:45:22 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240847AbiCJJfO (ORCPT + 99 others); Thu, 10 Mar 2022 04:35:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbiCJJfN (ORCPT ); Thu, 10 Mar 2022 04:35:13 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24DBDE5425; Thu, 10 Mar 2022 01:34:12 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id h11so6877606ljb.2; Thu, 10 Mar 2022 01:34:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:to:cc:references :from:in-reply-to:content-transfer-encoding; bh=Xsz2Lkc59BEsun7yjrO91nkFvMRDtNpNPTs688heElw=; b=nCf1DdLQyptXs38LgEvsF/o3PS7VluBDu4YHfX/AlwCyZwxsbCNMVOFyJ1kQsbwKFZ y1AgzsybGfgx+/4bwTjBoDhsJc7Q54hdRyT7TYKW7tF/jw7t4xtyO3Hd4l9uH6SQjFZT 0Z1sicd12qoreNXIWx3RhqjUy7t/1PzRpmO9VibO6KRp0sLqzElp6MxHRmk8XmvwFrOQ 1VQaUhCia0AO5VO6PodBRbhdHXss95vaizkS2Cw/TYW0S0tNLnpfLPAMcpLwqf70zESd qHmNVvBbthLwvCsil5cI0aZhTQKzeZAoTERDXq6oYbUSkD88mq3dUbcw5c4p+KULCNan LjbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :to:cc:references:from:in-reply-to:content-transfer-encoding; bh=Xsz2Lkc59BEsun7yjrO91nkFvMRDtNpNPTs688heElw=; b=QCxRyPaz9PQ7IQj0xx+cEtn1pq2eessRnNdJWFljY7Y3rJU0evAvQvA0W6UYbsY9jv zug6azOtEMmbTbON8vm8qoL7UjL5FT604XqzN8nuOjDrkKXskAWmnlXxWx/P9EXLhoIF l1pZ+B0F5f9gd3lHCqe4E3gsJS32rkBplK2HlfgOQT+oI/1idmgxMeWFR7LqulAm4ru5 /ysDt7HYhT+bWZAMg+EJfmAHKFZMCbtZ9qfvZtlO/7mpWbyOLXAGcnbnGyJcO1h+jVza 4tfClM1Gu3bkEN9J6BpWwRq44VyiFgaGVkIRMmwyNHFmsDeynr1hfktM23iAwbH/+DF6 5t6w== X-Gm-Message-State: AOAM532OuCJBh3I9PU7osqmb7of2BVXZra0mfRB1faZYSGe8783hhPQL sCFoOCHZ9dNUviWHTog+5Dk= X-Received: by 2002:a2e:a586:0:b0:247:e785:49cd with SMTP id m6-20020a2ea586000000b00247e78549cdmr2425999ljp.503.1646904850417; Thu, 10 Mar 2022 01:34:10 -0800 (PST) Received: from [192.168.26.149] (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.googlemail.com with ESMTPSA id u13-20020a056512094d00b0043e6c108925sm875010lft.136.2022.03.10.01.34.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Mar 2022 01:34:10 -0800 (PST) Message-ID: <2ddb9373-82b6-8ea8-e880-52e25ed8c7f6@gmail.com> Date: Thu, 10 Mar 2022 10:34:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Thunderbird/96.0 Subject: Re: [PATCH V3] dt-bindings: nvmem: add U-Boot environment variables binding To: Michal Simek , Rob Herring Cc: Tom Rini , Simon Glass , Srinivas Kandagatla , Krzysztof Kozlowski , Ricardo Salveti , Jorge Ramirez-Ortiz , Sean Anderson , devicetree@vger.kernel.org, u-boot@lists.denx.de, linux-kernel@vger.kernel.org, =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= References: <20220228131250.16943-1-zajec5@gmail.com> <578e243d-2273-add3-898c-959888c2a155@xilinx.com> <20220309154041.GA3202199@robh.at.kernel.org> <9e340aaf-8d26-24fb-7097-9bcce63ea07e@xilinx.com> From: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= In-Reply-To: <9e340aaf-8d26-24fb-7097-9bcce63ea07e@xilinx.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10.03.2022 09:45, Michal Simek wrote: > > > On 3/9/22 16:40, Rob Herring wrote: >> On Wed, Mar 09, 2022 at 02:42:43PM +0100, Michal Simek wrote: >>> >>> >>> On 2/28/22 14:12, Rafał Miłecki wrote: >>>> From: Rafał Miłecki >>>> >>>> U-Boot uses environment variables for storing device setup data. It >>>> usually needs to be accessed by a bootloader, kernel and often >>>> user-space. >>>> >>>> This binding allows describing environment data located in a raw flash >>>> partition. It's treated as NVMEM device and can be reused later for >>>> other storage devices. >>>> >>>> Using DT should be cleaner than hardcoding & duplicating such info in >>>> multiple places. Bootloader & kernel can share DTS and user-space can >>>> try reading it too or just have correct data exposed by a kernel. >>>> >>>> A custom "compatible" string allows system to automatically load >>>> relevant NVMEM driver but phandle can be also used for reading raw >>>> location. >>>> >>>> Signed-off-by: Rafał Miłecki >>>> --- >>>> V2: Update descriptions to don't make this binding MTD (flash partition) >>>>       specific. Mention multiple possible storage ways. >>>> V3: Drop >>>>       allOf: >>>>         - $ref: nvmem.yaml# >>>>       as we don't use anything rom the nvmem.yaml. Thanks Rob. >>>> --- >>>>    .../devicetree/bindings/nvmem/u-boot,env.yaml | 62 +++++++++++++++++++ >>>>    MAINTAINERS                                   |  5 ++ >>>>    2 files changed, 67 insertions(+) >>>>    create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yaml >>>> >>>> diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml >>>> new file mode 100644 >>>> index 000000000000..e70b2a60cb9a >>>> --- /dev/null >>>> +++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml >>>> @@ -0,0 +1,62 @@ >>>> +# 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. >>>> + >>>> +maintainers: >>>> +  - Rafał Miłecki >>>> + >>>> +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 >>>> + >>>> +  reg: >>>> +    maxItems: 1 >>>> + >>>> +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>; >>>> +        }; >>>> +    }; >>>> diff --git a/MAINTAINERS b/MAINTAINERS >>>> index db8052bc1d26..24fc181a7e6c 100644 >>>> --- a/MAINTAINERS >>>> +++ b/MAINTAINERS >>>> @@ -19958,6 +19958,11 @@ W:    http://linuxtv.org >>>>    T:    git git://linuxtv.org/media_tree.git >>>>    F:    drivers/media/pci/tw686x/ >>>> +U-BOOT ENVIRONMENT VARIABLES >>>> +M:    Rafał Miłecki >>>> +S:    Maintained >>>> +F:    Documentation/devicetree/bindings/nvmem/u-boot,env.yaml >>>> + >>>>    UACCE ACCELERATOR FRAMEWORK >>>>    M:    Zhangfei Gao >>>>    M:    Zhou Wang >>> >>> I think that parsing these partitions is quite sw intensive process and I >>> can't still see the value to have compatible string here. >> >> It's always good to know what a node represents. > > Also agree but isn't it enough to use proper label for it? Let me quote Rob here: > 'label' is supposed to correspond to a sticker on a port or something > human identifiable ^^ https://patchwork.ozlabs.org/comment/2812214/ "label" is already abused for naming MTD partitions, I don't think it's a good idea to abuse it even more for different purposes. Also "compatible" is a standard way for describing hardware blocks & various entities (identifying them). I'm also wondering if using "label" instead of "compatible" wouldn't require breaking changes in some DT files. What if someone uses a random "label" (e.g. "ub00tenv") and has user-space based on that MTD partition name? If we require changing "label" that will require people to also update names in other places (user-space). I'm not sure how valid is that argument, just wondering.