From patchwork Fri Sep 30 16:36:31 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: 12995777 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 21707C433FE for ; Fri, 30 Sep 2022 16:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=bOrRS1lI8Nq1+bZtxryXAqKCq+MxKY1pADV+yZ+cSrs=; b=iHtvBwSodxtNgD JWmsZuGo0GGyOA2qeljncKpP7eKwOS00ZKeDcGdCa6v8Godqcvj258VnsJvyFnT+tlJj+xRDMEAbu cmk2kgc5gVx9yZHQocTRgzbQxrOOcPAJZbIlTnT7Gz5x8EFmiz9jgLhR2yywvj2vz3MQDfsF3XRnB uovswGhnjSlNhwAHO2gSHeVPEn/HH2exuq8CSnUi9/AQrZQZc0d8TbHsDKeHMFbuXmYDrHsstCglV mRrH9WVJo8RKaIcxu2PM56rlmWJ6j6sJr96ts+gRtReKOTCud9mLckMsN2us6R2l8/g+GkSbmtT9Y wzgrm6s2pAlrWQBi/jjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeJ0h-00AcHo-4N; Fri, 30 Sep 2022 16:37:11 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeJ0c-00AcA6-Fg for linux-arm-kernel@lists.infradead.org; Fri, 30 Sep 2022 16:37:09 +0000 Received: by mail-ej1-x635.google.com with SMTP id hy2so10142444ejc.8 for ; Fri, 30 Sep 2022 09:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=l0m+9E3RrPBGmSZwDiB5yg6wloqO1uP7wOWBDHufpvI=; b=IqYgkVPxNnZS+HZ4Fydqs2C+P87Mp+AjKACFm38IcYDHP07Lk34vzrWuuctCmCEt0I s4ghgmYgxxL4gOGaCmm/GcUX49SgFw8BCDlont1Pd+7ujU2QI6bsm6RswV1MCtKhpLRW fC5IBBL+bKRdbeUgesaz3Z0PEPnfbomQVT9KYbAyly9cq8T6tI6NsFqom48lDbukU2+5 zrJe89/1PQ64UjPn9zuyYnqiPEDALb0U3iWXB0cLz/w+706nQRBDp9q8RC2ple0ysH8X o9F3CoqOQ7DVRU4hOLmUV+EZcxMsRDATQK6DY5eJI2Xlw9vHj15Gv6R/BaZUeyVh82C4 G/RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=l0m+9E3RrPBGmSZwDiB5yg6wloqO1uP7wOWBDHufpvI=; b=6iQq8xYGOf0GyRzAB5L3GPNyCYC1+2wHMOuTla9FMgs/hymQqJuz9d3jvgFzWPWFHW BtsrWrVB4kenbygumYaMQYCt4WXkdfLI5JGFUFyzd6zaflntirsDKq8dKXfThYxGLhd+ WklXqpcgcgI9wpZ0qkQwzuKppm44Z5Eol5j2MAiHIvMNn3Ew7G477p6RnXaCbc5M58Wo 8YBZx4TkBQQ261tQVXNaQ9prh+dQAhiLnM6M+vXkszpBpfuKWurqTrJbOVGoHXhrNIAo iwSKalaw332MVSezjGZgFaPZVgYPkOTUg/yufPHaFZieFqJQEARYYC+S+pYvRqawQYBE fp4g== X-Gm-Message-State: ACrzQf1+BfSyNbqBJkewfWII4ckcXqqmwiMiszxFVN1Odh2pJAQnKA9a pHTFcW0YSLv19r3xslzAKU8= X-Google-Smtp-Source: AMsMyM4rzbG75FeYajqjF9cZOtKOOqQn5jYjboiHfFP5mZmGr5AdUXqB6NwhFyTrELxTWrwBr73GcQ== X-Received: by 2002:a17:907:25c1:b0:77b:9966:ccf1 with SMTP id ae1-20020a17090725c100b0077b9966ccf1mr7181056ejc.763.1664555811525; Fri, 30 Sep 2022 09:36:51 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id t12-20020a056402240c00b0044e7862ab3fsm2011020eda.7.2022.09.30.09.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 09:36:50 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Rob Herring , Krzysztof Kozlowski , Srinivas Kandagatla Cc: Tom Rini , Florian Fainelli , Joel Peshkin , William Zhang , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, u-boot@lists.denx.de, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH V2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding Date: Fri, 30 Sep 2022 18:36:31 +0200 Message-Id: <20220930163631.27040-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220930_093706_547742_8BFA103E X-CRM114-Status: GOOD ( 13.33 ) 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 Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. U-Boot stores its configuration in an environment data block. Such blocks are usually stored on flash as a separated partition at hardcoded address. Broadcom however decided to: 1. Store env data block inside U-Boot partition 2. Avoid sticking to hardcoded offsets 3. Use custom header with "uEnv" magic and env data length Example (length 0x4000): $ hexdump -n 32 -C -s 0x40000 /dev/mtdblock0 00040000 76 6e 45 75 00 40 00 00 34 89 7a 82 49 4d 41 47 |vnEu.@..4.z.IMAG| 00040010 45 3d 4e 41 4e 44 3a 31 4d 2c 31 30 32 34 4d 00 |E=NAND:1M,1024M.| (0x40000 offset is unit specific and can change) Starting with the commit 118f3fbe517f4 ("dt-bindings: mtd: partitions: support label/name only partition") DT can describe partitions matching them by a name (without specifying actual address). With that feature and this binding change it's possible to: 1. Specify DT node for Broadcom's U-Boot env data subpartition 2. Add nodes for specific environment data variables 3. Reference them as NVMEM cells This binding is unlikely to help Broadcom's U-Boot. U-Boot SPL needs to find environment data early (before it accesses DTB) and it does that by looking for an "uEnv" magic. Dirty way. This binding can however be used by operating systems. It allows describing cleanly U-Boot, its env data and variables. It tells operating system about Broadcom-specific env data so it can parse it. Signed-off-by: Rafał Miłecki Signed-off-by: Conor Dooley --- V2: Work on better commit body & add example --- .../devicetree/bindings/nvmem/u-boot,env.yaml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml index e96bca99f2d9..987957e3ffc8 100644 --- a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml +++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml @@ -38,6 +38,8 @@ properties: const: u-boot,env-redundant-bool - description: Two redundant blocks with active having higher counter const: u-boot,env-redundant-count + - description: Broadcom's variant with custom header + const: brcm,env reg: maxItems: 1 @@ -73,3 +75,22 @@ examples: }; }; }; + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x100000>; + compatible = "brcm,u-boot"; + label = "u-boot"; + + partition-u-boot-env { + compatible = "brcm,env"; + + mac: ethaddr { + }; + }; + }; + };