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: 1684931 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=IqYgkVPx; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MfG9307rNz1ypH for ; Sat, 1 Oct 2022 02:37:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A82184DA7; Fri, 30 Sep 2022 18:36:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (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=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="IqYgkVPx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B9CD484D8A; Fri, 30 Sep 2022 18:36:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.8 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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 098B284D9D for ; Fri, 30 Sep 2022 18:36:52 +0200 (CEST) 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-ej1-x629.google.com with SMTP id r18so10144264eja.11 for ; Fri, 30 Sep 2022 09:36:51 -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=fmuotW/m863XSS1N7V0YVqZaACeNCHzL7M9ZyZ9UA8r1/LG0CoZL2iLx8N250a6UyM WhGRsR2NoE/LHorYqdb9r5UT75W+DoxtI2eUvHprG9LUnTjggu89oGa3sIL25bORU+Z4 6yLDAmfyl4wh7JFF1Rm8cPeuSqJpoNIadd4hTMPDfprpSxWac1xTc9Sm63v3Madolhaj CR2uPK0jZyPiSB46tJapsmnYqB698kK2KXNTvvgZh4bVgi4SO+3xU0v1jlgEyjU/rr4P 4jkNI2LdYKed4cGxYhwWokb5oHgVVMXq7ElEO1wAqT/EW5gyEMkQ5ZW9ODNhMh7z1nrW GAzA== X-Gm-Message-State: ACrzQf0gbjjte4YMJ/GXo9r7V7BTqANXek8Vg5hnIBVglmDIzLjLBV6H ETkS33expqHpHvNXnA1aJ9E= 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-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.6 at phobos.denx.de X-Virus-Status: Clean 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 { + }; + }; + }; + };