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: 610949 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1627593pvb; Fri, 30 Sep 2022 09:37:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5BrEENvf/rn6sx1LYSbxkO1bzj2ah96FChBE+RAmfJYM1aTNKs9H+mI/aT7ukYAmUOZfwe X-Received: by 2002:a17:907:75c1:b0:783:a093:2d34 with SMTP id jl1-20020a17090775c100b00783a0932d34mr7116434ejc.454.1664555828895; Fri, 30 Sep 2022 09:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664555828; cv=none; d=google.com; s=arc-20160816; b=L0Et8htW98eT5pt6bLqcDStN6EYgyIMRxzh8M6q57/vbttzEWQq0uHmX3BVKZcfCI1 r9ipOvakBo8P2Q81kY5+hUH8UZYsfDiwLtrlp6Cm/3OWAeCxPYtXOZXmQLi7zFGEb89J dvxSOsqDaLlVIbWkRDlVFG5m9oIX0M9fMMa4GOG/wz56LKhRWREnCG0hkkBJha47gK2v quEhPel8tNwdcZVRHN7aVYcoUGwsDdYhbaMcCwDr0nI9yzy58Fqxpbodk9Q9V2Bj6f1z MA7L8b/6SaupHoZf7YFq0o9j3GwODEioPwmdlWRO0YhSc9q8SvdzTVMdbNRnJdX25WgL jBxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=l0m+9E3RrPBGmSZwDiB5yg6wloqO1uP7wOWBDHufpvI=; b=GbqG/ZTi5sK1rhaUH1Se7dusp+I6Yv4JCnCbxrbP0SinlDrZM5BpG+lB+buyKa7M/F iEKmdTXc3oozU36Gpb+JY9OyV8Ua1fplesPxTBKQFHGvsiq6URST75MUURgqMCcyknDv lhLKwP5bptBeF3UPzt/Ngsf3dv/XJDMHmb2x6LND0GJHzXj9ZrB1J8K59kWw/K9v6Uqy kcvsNF04NEJnU+8QHWcd79pejbA50A6kXpKW2vhbifd0MFXIxxf4EEEAV/8PvcNdodlC LqA5K8neo/XIp5w9ESNPIMa9phT2VDudqxLklvWYWXc9g5HG5kpWnNd32leplTLX6DDy t86w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=IqYgkVPx; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id sa13-20020a1709076d0d00b00782f88a28d6si2141903ejc.71.2022.09.30.09.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 09:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=IqYgkVPx; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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-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 { + }; + }; + }; + };