From patchwork Mon Jul 15 13:54:33 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: 13733566 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 11664C3DA4B for ; Mon, 15 Jul 2024 13:57:03 +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=zJEofbM7JJv/OPvTziaKTUDT40OBgVWW/o2FBZFQ/8c=; b=sS8epuZvObERaqsTQxmU4yk96P LOEWO0zXnZo6ulNsK672HXcwF9PkJAVaOl9au4xBU1X6XAFpXoilUDjX0qsLBD5SDL4OqUeqsxDOd fzWGiAq4ckRMqFAJGaJAFIWj9ZLoLclWZ/6AJXBUWWNmh7VCNeuRjHX0gmnQCj1jVmLsfV6ZEgfwA Lz4sHQwoH3bVaHJGkmHVjRxqGWrYUmSYogp1siyLktoRIBeLu7lYkyFKdjPT/Rzsbaeg4t0enMEcM SR7QViz8k80CQTqPTio13YoxjeMyx56rHy3Xqlsk4gnJS6lYCmLClUoEvefhj1oHzh2WvQKMHQoLj uU6S1Rxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTMCA-00000007HnK-2RzS; Mon, 15 Jul 2024 13:56:50 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTMBb-00000007HZT-3Tyt; Mon, 15 Jul 2024 13:56:17 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a77e6dd7f72so522649466b.3; Mon, 15 Jul 2024 06:56:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721051773; x=1721656573; 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=zJEofbM7JJv/OPvTziaKTUDT40OBgVWW/o2FBZFQ/8c=; b=iz70JgaIpypbydmFQVRUa4njdx+9s3PRg9D7Pgm6qAyZ65AQW22GiVKhST6G0keU0k 3cp09cgPuy0eCQ+XUn8sL7qCjhOM6BhrUxBw+iGjZJEw8o8RvBvj26CqTykuISUky38z otFm7ki6gmRdNxxG3iUrXCZ4Ksg1fylfpT0jqDlq3YuqG0Je+SVNMM5hFTc6rKpskNOR suCWRMQwNQaPYySAOuujwmzqZcroXroYgILiMX6SmE26xSWiIkEJq/MNbJUI61EK4su7 ++THJcQDwL2A3naoMO6lPoYGcaaLaGvTHu/ykfg96w8hG1ieI8Q49juSZk2IUdDi4jYb o9Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721051773; x=1721656573; 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=zJEofbM7JJv/OPvTziaKTUDT40OBgVWW/o2FBZFQ/8c=; b=Yv9PLitHSQr9y5Qt4rYQZCyy8A9vBVD436ZNfjWia0GIE+SAbH3Q+vVpSEvdM57fjo vD/ay67dmxCS8HkWBczbW7DrW47pTHy1smqH78hRy8irqW/lG7+RNtAipEg4OrEfUHJW sSSbECHbG/6UrmOVMs1gr7PDdELBymgKRAFvqn3VCdmaXPpn41q9RJXofR7ejOwekbdj D0A29UzPbql+EDG1sIN8TdwwjpwcBEMK+lBcBhzpmm/DrxqKO97KdlQLzbl+fSPLP9Oy m5ubMPwWXz6wzc2fb7e40tgwyNQuf5eEKJ1Doyih2KfWgh1W6WgydTGAG+0nJIwi4Lhu V20Q== X-Forwarded-Encrypted: i=1; AJvYcCX11tbLcngjCXewrGZh78iWAwDG8lAz6TB6t/tdXaDvXvSs4X585153RsjIhEc2VWpLuKn08jJJOdrh+fpGeIm+CwLiIiJOa3Ufv9+AKWPtKQj12xaxeTqAC86Y5Z3zyy3YwRrN1i8es9WvUVReCFsx3hqu X-Gm-Message-State: AOJu0Yy8IluJpz1fyuSUlMq88vvz9ms8/N4saBxQmdX0lKFKIBrOeJfK t8S8PfQNrZEdnQzMhoJ5kxcTAOIAkHjwRZhO5Hs6C5B/9N1xNtHR X-Google-Smtp-Source: AGHT+IGFwyv96gykRh2WQAFospTSXU2UQACz9q8YtryxBrJrikNX9BsuYSLrXYopy2ZsFmRYUjaEzg== X-Received: by 2002:a17:906:2797:b0:a77:c5e4:eebf with SMTP id a640c23a62f3a-a780b87ef50mr1185426566b.54.1721051773034; Mon, 15 Jul 2024 06:56:13 -0700 (PDT) Received: from localhost.lan (031011218106.poznan.vectranet.pl. [31.11.218.106]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a79bc820fb5sm214152666b.212.2024.07.15.06.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 06:56:12 -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 1/2] dt-bindings: nvmem: convert U-Boot env to a layout Date: Mon, 15 Jul 2024 15:54:33 +0200 Message-Id: <20240715135434.24992-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-20240715_065615_899054_5F49802E X-CRM114-Status: GOOD ( 15.25 ) 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 resending this approved by Rob PATCH in a proper series .../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>; + }; + }; + }; + }; + };