From patchwork Fri Jul 5 22:58:21 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: 13725582 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 36CE6C38150 for ; Fri, 5 Jul 2024 22:59:08 +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: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:In-Reply-To:References:List-Owner; bh=FiMeeVhiLcAlXej3uBvwyk/ojiuyjSIG1S2ztz0XYNs=; b=wZCcdxtyss0YqdV66WQs5Q/a5a 7iLmpHcuC+1BL7Z9BFb+08NK8RForG6BQbqnGLwkizhCMmQlpd/Lo0g7fxmOZoV7Sf4b4m4dBmPuZ S3KC1ci9qE7qhCuy3CQP3qdVeIcMaY3FEdrBdGAKtQMOe/b0Frry1HcMAJn9u+pxRQK+OZko+rsSq XOqWt6fUpDyNpqauYVRtlIqhI//Ywkb1I/8o0evSxPBxPNWLEWVswj5d6tU/HtOxFKPNxtydpGQYU cvwvR1fSKhVNCs5qBv3VHy12da5i73sB6EC5WeoYMjqzIvjITS+NA2nzhPCKoKZT9ssJMMW4tOmuI +0BzyW8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPrtI-0000000GyJb-200s; Fri, 05 Jul 2024 22:58:56 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sPrt3-0000000GyGN-16Xy; Fri, 05 Jul 2024 22:58:42 +0000 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-58bac81f419so2952926a12.0; Fri, 05 Jul 2024 15:58:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720220319; x=1720825119; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FiMeeVhiLcAlXej3uBvwyk/ojiuyjSIG1S2ztz0XYNs=; b=W+lvLdIj/MZv5WBeMh84VFJBkspFn4MsDa47euK0AcDhULY9LnQkOS0Z9FGeJ3kwrX 7Hvc3SyVKnzGQxmRYOI1w/Ab+LGRxZMFW83pkliVubWRGz2niakqsVDIEUE0frc2vbWf txwEMZcLSnePc2/AC7Ea1qFf3WneixOV5wZ/5J21HdYguzT5/YjWKfebC3DP57roiUDz Rkgk+D1KjL/4Tg2KDAot6nr5BPFDgNkfoOihaVayOkyVR8vo5C5677DnE+EjeJhMONpU apba86dmVRGbpvIlZwSXHgOAdul0DFNXGvs6B/BzDinxUGQ8NvqzKBIzmAiILzZpyJEo 0xNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720220319; x=1720825119; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FiMeeVhiLcAlXej3uBvwyk/ojiuyjSIG1S2ztz0XYNs=; b=NymDRqyXqi188a1SQ7ft6NZu2ZRTIkieZbno3DpK+ufeLkUx/XE2o4sBpsnpfOU9f7 kriCw6Jbo5C+Zcf/lcYF3QqvYmMdPz7fy+DkTRH+3aeLRHY/JbYf1wCyY4un67N6hVhu zdC09cboftARi+Kjmj53kc3a2ls2PJAPB+lLdAqw/gQaprTRrR4sTvdmkGUHTAfS+6G+ fnUBf91xDzU/YgPZtx0UkShnqSCfbpGSsXmQcvuLbYhjb1v2Cw5bLoH+reUZHXqN5WuP kcj5pxudgxk5706k0Es2Vmdd2XWk7c4AtkXN4TK884cqa6PGzueEMoxHMlTjL+wxAj1q q6oQ== X-Forwarded-Encrypted: i=1; AJvYcCW6qcnd0lnLbb9BzFbxVTu26ux4do4H+XehYiwafN+ceslLrvnKWw5bVlgXeRVG95AvqGDoKw5MrOUZwlGyPw4aZv6xDpJOFyQWjTaM0bgvyuFbTaRKaCi4Q4t1AcxhUlR070qJYZSIOsZoefEbu2YJlv8S X-Gm-Message-State: AOJu0YzuVrNhGz5kKtlyjIO645b3esvykS7Si0wLG0LDLnIjgrc2zoAc pWFNtzJBM2z6WzCAB7UkAMaZuv1mztJKFB3hz0zBPxZ9pxEl4Ew3 X-Google-Smtp-Source: AGHT+IF/EnTZ+25wxqkBsWXqxU8jobntZQ97ZpwWquicNED9QnU285ETFWo0voXR6AyZFnJzN7nEIA== X-Received: by 2002:a05:6402:254a:b0:586:6365:b3cf with SMTP id 4fb4d7f45d1cf-58e596592cbmr4608643a12.10.1720220318886; Fri, 05 Jul 2024 15:58:38 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5861381868csm10052128a12.55.2024.07.05.15.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jul 2024 15:58:38 -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] dt-bindings: nvmem: convert U-Boot env to a layout Date: Sat, 6 Jul 2024 00:58:21 +0200 Message-Id: <20240705225821.13196-1-zajec5@gmail.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240705_155841_337398_B01D852C X-CRM114-Status: GOOD ( 18.26 ) 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) --- I'm sending this PATCH without Linux changes to see if this is the right approach - for developers and (DT) maintainers to review it first. My previous attempt (see above Link) turned out in refusal so I'm just trying to save some time in case this one goes wrong as well. Hopefully the included example (which I really think we should add) explains well how I think this binding should be used with layouts. If I get some positive feedback I'll work on V2 with actual Linux changes. .../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>; + }; + }; + }; + }; + };