From patchwork Mon Jul 29 08:07:32 2024 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: 13744534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AAD7BC3DA4A for ; Mon, 29 Jul 2024 08:09:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rl8HdNLgtv5Fxv2Nk9Of+lDPOeD8hPV7F8FWHfhtTmU=; b=D8CK41VN1NKCH3TCRHq8dYAK+H 1q/rm7Gv5VdWxFjzwfAoZGN8JtHOcee6om3Jl/gldgEsfPHLsjAsdxYgph/swATZv+iSQyKed/9Oj DwWyhPjO6RVfxIW9AnC0tshc+u4fOoY1QH9/zTWFQECt3njgFt2aSb34NzKbOoFwWsF/Lx8rBGKhi f8BnEn8xQsU1p0F/1+w6u0d4zRVjUnODFSR1X7hI1jcZBA3nD5qWrjsZI+qeEgW/BXlxU8BDPBdDe oN8HzQz9gEWWXBEhQqLMAn+0fsGyaycGpV4dJlEqHXDeYxIymiACaqiG+g3t0U48vmkbDIT2iZRzp 3QLnEHDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYLRF-0000000AUFz-3Puk; Mon, 29 Jul 2024 08:09:01 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYLQJ-0000000ATqk-03IR; Mon, 29 Jul 2024 08:08:04 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5a2ffc34431so2690783a12.0; Mon, 29 Jul 2024 01:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722240481; x=1722845281; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rl8HdNLgtv5Fxv2Nk9Of+lDPOeD8hPV7F8FWHfhtTmU=; b=L1zem4BRaDof0M7gyu4UiTqZv3uVDmr3EokSpkPM+1XKfpSkzuRb8Y84+V+eg1301R yIxEiiAJgMaA8b7MQlI6+Vj1rp6qTQWO5GUmCVR/v3GqO2LeRuZWSrL3i873BrHEIYcm jLKzsbEajze06mT5GEDgBtd1qW1UNKYcsOeSvLqw47Yge6IAbCWGtVIm81MDLfsMCi9P pKWaYjuoLBYEG84BUj+9lLEQms6ywdH7XpuQInMzmBsCrHxJsKf/nmFE9fPAwNRkaBFY TwDQwyL+p7QCfW9AIlOWQ/9QKx8eOGcT8dikaZNCRwsQias+x/8GfgsHQfItunoCNubj aMgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722240481; x=1722845281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rl8HdNLgtv5Fxv2Nk9Of+lDPOeD8hPV7F8FWHfhtTmU=; b=HHVzAAPih7VIqfC+HWSWad+icdgVq1p5oBn/Zl8XykhHCjTA0dKwHAnH93qdQ+5Ve0 GB4xrKmliy0gVG6H7L68IfmrVVxXzkL4lgKSgb5AxiVxY8xYl4muxivgB5Rlo/FoVVKO mj7pYQngkU+OSCuoQxh+FdvaPTm4LMkSEI8qILBVKgTfpGVjKf5p4aI2hCpGtE7n4gr/ EWTr20vcKkyKOVv3HiTx4NudEqeYiTNsSV13XUGc3Nq/X51ONJVB+ugulqKWr/gnP7hG D7UcwuFCs0Cc/qXTd3P89Jn/u4oakAxuAQtOrm846LoF9fDqfKfOy531uQn0CFsIz5sh BMKA== X-Forwarded-Encrypted: i=1; AJvYcCWAMFsE0D8bfpEWEJFlw5Y0wr4dtT4E9wsIdp+K6xBuUHB7+BjHVtcU7VurOIbvlKyFj5lTgylYos56hYz2oOAKsnMrWhNEV/Fgbaxj6U4viDsmcBYgE5+voap2CTTslvzjXXFTMYMoebhLFI1S7HlABozY X-Gm-Message-State: AOJu0YyXOhMa9fNRF2LZ4tGfRhTA1uHPCOP+JVZtfMzyCERbCqOIaans ydxo3xClqTDYZfrNQ9rHlvHdP/8nsTLAHgg+3bQsGMqe9oHR+Aik X-Google-Smtp-Source: AGHT+IGSPZPkd0loh76eNxSCbXh4tWMsSkZqipMIwMD0/JvF8wieYG1nkZYy/AvmyWaLsR5QnAao4Q== X-Received: by 2002:a05:6402:51cc:b0:5a1:de88:a5ef with SMTP id 4fb4d7f45d1cf-5b02317f4c0mr5275599a12.27.1722240480627; Mon, 29 Jul 2024 01:08:00 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63590cedsm5352868a12.29.2024.07.29.01.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jul 2024 01:08:00 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Greg Kroah-Hartman , Michael Walle , Miquel Raynal , devicetree@vger.kernel.org, linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, u-boot@lists.denx.de, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2 2/3] dt-bindings: nvmem: convert U-Boot env to a layout Date: Mon, 29 Jul 2024 10:07:32 +0200 Message-Id: <20240729080733.16839-2-zajec5@gmail.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240729080733.16839-1-zajec5@gmail.com> References: <20240729080733.16839-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240729_010803_088395_6256C6F7 X-CRM114-Status: GOOD ( 15.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rafał Miłecki U-Boot environment variables can be stored in various data sources. MTD is just one of available options. Refactor DT binding into a layout so it can be used with UBI volumes and other NVMEM devices. Link: https://lore.kernel.org/all/20231221173421.13737-1-zajec5@gmail.com/ Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring (Arm) --- .../bindings/nvmem/layouts/nvmem-layout.yaml | 1 + .../nvmem/{ => layouts}/u-boot,env.yaml | 39 ++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) rename Documentation/devicetree/bindings/nvmem/{ => layouts}/u-boot,env.yaml (75%) diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml index 3b40f7880774..382507060651 100644 --- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml +++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml @@ -21,6 +21,7 @@ oneOf: - $ref: fixed-layout.yaml - $ref: kontron,sl28-vpd.yaml - $ref: onie,tlv-layout.yaml + - $ref: u-boot,env.yaml properties: compatible: true diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml similarity index 75% rename from Documentation/devicetree/bindings/nvmem/u-boot,env.yaml rename to Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml index 9c36afc7084b..56a8f55d4a09 100644 --- a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml +++ b/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml @@ -1,10 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause %YAML 1.2 --- -$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml# +$id: http://devicetree.org/schemas/nvmem/layouts/u-boot,env.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: U-Boot environment variables +title: U-Boot environment variables layout description: | U-Boot uses environment variables to store device parameters and @@ -21,9 +21,6 @@ description: | 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. - Variables can be defined as NVMEM device subnodes. maintainers: @@ -42,6 +39,7 @@ properties: const: brcm,env reg: + description: Partition offset and size for env on top of MTD maxItems: 1 bootcmd: @@ -58,6 +56,17 @@ properties: description: The first argument is a MAC address offset. const: 1 +allOf: + - if: + properties: + $nodename: + not: + contains: + pattern: "^partition@[0-9a-f]+$" + then: + properties: + reg: false + additionalProperties: false examples: @@ -101,3 +110,23 @@ examples: }; }; }; + - | + partition@0 { + reg = <0x0 0x100000>; + label = "ubi"; + compatible = "linux,ubi"; + + volumes { + ubi-volume-u-boot-env { + volname = "env"; + + nvmem-layout { + compatible = "u-boot,env"; + + ethaddr { + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + };