From: Christian Marangi <ansuelsmth@gmail.com>
To: "Rafał Miłecki" <rafal@milecki.pl>,
"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Christian Marangi <ansuelsmth@gmail.com>
Subject: [PATCH 1/3] dt-bindings: nvmem: u-boot,env: Add support for u-boot,env-size
Date: Mon, 24 Jul 2023 10:26:30 +0200 [thread overview]
Message-ID: <20230724082632.21133-1-ansuelsmth@gmail.com> (raw)
Add support for u-boot,env-size new property.
Permit to declare a custom size of the U-Boot env that differs than the
partition size where the U-Boot env is located.
U-Boot env is validated by calculating the CRC32 on the entire env
and in some specific case, the env size might differ from the partition
size resulting in wrong CRC32 calculation than the expected one saved at
the start of the partition.
This happens when U-Boot is compiled by hardcoding a specific env size
but the env is actually placed in a bigger partition, resulting in needing
to provide a custom value.
Declaring this property, this value will be used for NVMEM size instead of
the mtd partition.
Add also an example to make it clear the scenario of mismatched
partition size and actual U-Boot env.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
.../devicetree/bindings/nvmem/u-boot,env.yaml | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
index 36d97fb87865..3970725a2c57 100644
--- a/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
+++ b/Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
@@ -44,6 +44,24 @@ properties:
reg:
maxItems: 1
+ u-boot,env-size:
+ description: |
+ Permit to declare a custom size of the U-Boot env that differs than the
+ partition size where the U-Boot env is located.
+
+ U-Boot env is validated by calculating the CRC32 on the entire env
+ and in some specific case, the env size might differ from the partition
+ size resulting in wrong CRC32 calculation than the expected one saved at
+ the start of the partition.
+
+ This happens when U-Boot is compiled by hardcoding a specific env size
+ but the env is actually placed in a bigger partition, resulting in needing
+ to provide a custom value.
+
+ Declaring this property, this value will be used for NVMEM size instead of
+ the mtd partition.
+ $ref: /schemas/types.yaml#/definitions/uint32
+
bootcmd:
type: object
description: Command to use for automatic booting
@@ -99,3 +117,32 @@ examples:
};
};
};
+ - |
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ reg = <0x0 0xc80000>;
+ label = "qcadata";
+ read-only;
+ };
+
+ partition@c80000 {
+ label = "APPSBL";
+ reg = <0xc80000 0x500000>;
+ read-only;
+ };
+
+ partition@1180000 {
+ compatible = "u-boot,env";
+ reg = <0x1180000 0x80000>;
+
+ u-boot,env-size = <0x40000>;
+
+ mac1: ethaddr {
+ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
--
2.40.1
next reply other threads:[~2023-07-24 15:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 8:26 Christian Marangi [this message]
2023-07-24 8:26 ` [PATCH 2/3] nvmem: u-boot-env: Permit to declare custom env-size Christian Marangi
2023-07-24 8:26 ` [PATCH 3/3] nvmem: u-boot-env: Handle "reduced" ASCII address declaration Christian Marangi
2023-07-26 16:36 ` [PATCH 1/3] dt-bindings: nvmem: u-boot,env: Add support for u-boot,env-size Rob Herring
2023-07-27 19:04 ` Christian Marangi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230724082632.21133-1-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafal@milecki.pl \
--cc=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).