From patchwork Mon Feb 28 13:12:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1598876 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=IMXYolFv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K6gmX4FBYz9s8s for ; Tue, 1 Mar 2022 00:13:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D56BF83BCA; Mon, 28 Feb 2022 14:13:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IMXYolFv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5236083B82; Mon, 28 Feb 2022 14:13:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 65D0383A7A for ; Mon, 28 Feb 2022 14:13:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=zajec5@gmail.com Received: by mail-lf1-x132.google.com with SMTP id f37so21224205lfv.8 for ; Mon, 28 Feb 2022 05:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EdNKXJkj2Hxc1yhKt9uLoL/rsONSDoRoULDQeNZCOcU=; b=IMXYolFvHnfacLay39iifcDxdLKD4Oe83NhqHvBStZwgk1PKAEcMzX9htgXOU8rFDP 2xgENzHIst3hifPjBROpgglz1mnWrDyqDPyiu3mwmho+f+u9fmQ/SRi8Q018g5mukNMh LKVFEdy0mm81XfobwjyNcL7WrIQj2MdfJt7FaArruWs+bSsNW0R4Yl+/8NvcNuPeX0q3 Sja9GH5vH8geCI6CUFgvicUCGSiz0kJLMkYXsDPTgd5f0Trw1TeW5vYkWD9iI6xRtPWp cCqiNoaqof0i0inU6uzFzrPGh7tcefl09AamjjOPI41VHgMGpkpxAoH5OighSSrb1lRu XzSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EdNKXJkj2Hxc1yhKt9uLoL/rsONSDoRoULDQeNZCOcU=; b=8Feh4MBQxxfYgONtC8s3k3zmnJv1rl9bEddVE7Aypnq5e7FxZv0JycUBKXqTln1arK a2MMq9ns+VVsWN++Kx2N4XbgddkdwewZUYzpKfS+eg/BfJLwKBXfLXiyihJF7PzUV8sw YFd5guHwKVoRGGkUzg1Ip/HAxqtqdRSzAR3WxeAV1S5K59e2qudLlrABweSbg5cDEV1E Bd1ivZVxT0ZK1AHe39estUUE5dJwlEoQZVyO1vy1wNoA09Sa3RYHWJhW+i8XznJ8F29p FZhGhbspA+bYl9bvh1JX39knOxMKDww7KTxwAg9OkDhQSpbm7bQJ5y1qhg2Tk0xZl9YK 543A== X-Gm-Message-State: AOAM530S7SSrPWtBlrx+xGZD1SFYKfV47mZiXszQgwtlsC6kdN+/L5WX yC2VgPiY2rTh+KRXkwDh0A0= X-Google-Smtp-Source: ABdhPJzQWEpJrtVBfYUwsC1x5fwzu5Xqz652nAKgxPDmWHbqx9Hq944/Px6uTO9b4lqDQTdU8LP3TQ== X-Received: by 2002:a05:6512:3b06:b0:443:3b12:a1ff with SMTP id f6-20020a0565123b0600b004433b12a1ffmr12116447lfv.157.1646053979536; Mon, 28 Feb 2022 05:12:59 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id l9-20020a2ea309000000b00246299de080sm1316532lje.48.2022.02.28.05.12.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 05:12:59 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Rob Herring , Tom Rini Cc: Srinivas Kandagatla , Krzysztof Kozlowski , Ricardo Salveti , Michal Simek , Jorge Ramirez-Ortiz , Sean Anderson , devicetree@vger.kernel.org, u-boot@lists.denx.de, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V3] dt-bindings: nvmem: add U-Boot environment variables binding Date: Mon, 28 Feb 2022 14:12:50 +0100 Message-Id: <20220228131250.16943-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Tom Rini --- 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