linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions
@ 2022-10-18 15:42 Rafał Miłecki
  2022-10-18 15:42 ` [PATCH V3 2/2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding Rafał Miłecki
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Rafał Miłecki @ 2022-10-18 15:42 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Srinivas Kandagatla, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Tom Rini, Florian Fainelli, Joel Peshkin,
	William Zhang, Conor Dooley, devicetree, linux-mtd,
	linux-arm-kernel, u-boot, bcm-kernel-feedback-list, linux-kernel,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

U-Boot partition may contain subpartitions. For example Broadcom
includes environment data block in the middle of its U-Boot partition.

This allows describing Broadcom's U-Boot env data and will allow
referencing its NVMEM cell in the future.

Reg: 118f3fbe517f4 ("dt-bindings: mtd: partitions: support label/name only partition")
Ref: dd638202dfb65 ("dt-bindings: mtd: partitions: add additional example for qcom,smem-part")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V3: Add this patch as pre-requirement for u-boot,env.yaml & brcm,env
---
 .../devicetree/bindings/mtd/partitions/u-boot.yaml         | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml b/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml
index 8a88e7d16524..3c56efe48efd 100644
--- a/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml
+++ b/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml
@@ -27,6 +27,10 @@ properties:
           Broadcom stores environment variables inside a U-Boot partition. They
           can be identified by a custom header with magic value.
 
+patternProperties:
+  "^partition-.*$":
+    $ref: partition.yaml#
+
 unevaluatedProperties: false
 
 examples:
@@ -40,6 +44,9 @@ examples:
             compatible = "brcm,u-boot";
             reg = <0x0 0x100000>;
             label = "u-boot";
+
+            partition-u-boot-env {
+            };
         };
 
         partition@100000 {
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH V3 2/2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding
  2022-10-18 15:42 [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Rafał Miłecki
@ 2022-10-18 15:42 ` Rafał Miłecki
  2022-10-31 14:45   ` Rob Herring
  2022-10-18 15:50 ` [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Conor Dooley
  2022-10-31 14:45 ` Rob Herring
  2 siblings, 1 reply; 7+ messages in thread
From: Rafał Miłecki @ 2022-10-18 15:42 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski
  Cc: Srinivas Kandagatla, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Tom Rini, Florian Fainelli, Joel Peshkin,
	William Zhang, Conor Dooley, devicetree, linux-mtd,
	linux-arm-kernel, u-boot, bcm-kernel-feedback-list, linux-kernel,
	Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

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 <rafal@milecki.pl>
---
V2: Work on better commit body & add example
V3: Avoid duplicated "mac" label
---
 .../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..cbc5c69fd405 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";
+
+                ethaddr {
+                };
+            };
+        };
+    };
-- 
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions
  2022-10-18 15:42 [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Rafał Miłecki
  2022-10-18 15:42 ` [PATCH V3 2/2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding Rafał Miłecki
@ 2022-10-18 15:50 ` Conor Dooley
  2022-10-18 15:55   ` Rafał Miłecki
  2022-10-31 14:45 ` Rob Herring
  2 siblings, 1 reply; 7+ messages in thread
From: Conor Dooley @ 2022-10-18 15:50 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Tom Rini,
	Florian Fainelli, Joel Peshkin, William Zhang, Conor Dooley,
	devicetree, linux-mtd, linux-arm-kernel, u-boot,
	bcm-kernel-feedback-list, linux-kernel, Rafał Miłecki

On Tue, Oct 18, 2022 at 05:42:01PM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> U-Boot partition may contain subpartitions. For example Broadcom
> includes environment data block in the middle of its U-Boot partition.
> 
> This allows describing Broadcom's U-Boot env data and will allow
> referencing its NVMEM cell in the future.
> 
> Reg: 118f3fbe517f4 ("dt-bindings: mtd: partitions: support label/name only partition")

Pardon my ignorance here, but what is the significance of a "Reg" tag?
Thanks,
Conor.

> Ref: dd638202dfb65 ("dt-bindings: mtd: partitions: add additional example for qcom,smem-part")
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> V3: Add this patch as pre-requirement for u-boot,env.yaml & brcm,env
> ---
>  .../devicetree/bindings/mtd/partitions/u-boot.yaml         | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml b/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml
> index 8a88e7d16524..3c56efe48efd 100644
> --- a/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml
> +++ b/Documentation/devicetree/bindings/mtd/partitions/u-boot.yaml
> @@ -27,6 +27,10 @@ properties:
>            Broadcom stores environment variables inside a U-Boot partition. They
>            can be identified by a custom header with magic value.
>  
> +patternProperties:
> +  "^partition-.*$":
> +    $ref: partition.yaml#
> +
>  unevaluatedProperties: false
>  
>  examples:
> @@ -40,6 +44,9 @@ examples:
>              compatible = "brcm,u-boot";
>              reg = <0x0 0x100000>;
>              label = "u-boot";
> +
> +            partition-u-boot-env {
> +            };
>          };
>  
>          partition@100000 {
> -- 
> 2.34.1
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions
  2022-10-18 15:50 ` [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Conor Dooley
@ 2022-10-18 15:55   ` Rafał Miłecki
  2022-10-18 16:01     ` Conor Dooley
  0 siblings, 1 reply; 7+ messages in thread
From: Rafał Miłecki @ 2022-10-18 15:55 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Tom Rini,
	Florian Fainelli, Joel Peshkin, William Zhang, Conor Dooley,
	devicetree, linux-mtd, linux-arm-kernel, u-boot,
	bcm-kernel-feedback-list, linux-kernel, Rafał Miłecki

On 18.10.2022 17:50, Conor Dooley wrote:
> On Tue, Oct 18, 2022 at 05:42:01PM +0200, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> U-Boot partition may contain subpartitions. For example Broadcom
>> includes environment data block in the middle of its U-Boot partition.
>>
>> This allows describing Broadcom's U-Boot env data and will allow
>> referencing its NVMEM cell in the future.
>>
>> Reg: 118f3fbe517f4 ("dt-bindings: mtd: partitions: support label/name only partition")
> 
> Pardon my ignorance here, but what is the significance of a "Reg" tag?

That was meant to be "Ref:" and was meant to show commit that introduced
concept of dynamic partitions. I thought it's a new feature not everyone
may be familiar with yet. I thought it may help to review this patch.

If that is pointless though could you Rob just drop those tags while
applying, please? I guess I'll just let you decide.


>> Ref: dd638202dfb65 ("dt-bindings: mtd: partitions: add additional example for qcom,smem-part")
>> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions
  2022-10-18 15:55   ` Rafał Miłecki
@ 2022-10-18 16:01     ` Conor Dooley
  0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2022-10-18 16:01 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla,
	Miquel Raynal, Richard Weinberger, Vignesh Raghavendra, Tom Rini,
	Florian Fainelli, Joel Peshkin, William Zhang, Conor Dooley,
	devicetree, linux-mtd, linux-arm-kernel, u-boot,
	bcm-kernel-feedback-list, linux-kernel, Rafał Miłecki

On Tue, Oct 18, 2022 at 05:55:14PM +0200, Rafał Miłecki wrote:
> On 18.10.2022 17:50, Conor Dooley wrote:
> > On Tue, Oct 18, 2022 at 05:42:01PM +0200, Rafał Miłecki wrote:
> > > From: Rafał Miłecki <rafal@milecki.pl>
> > > 
> > > U-Boot partition may contain subpartitions. For example Broadcom
> > > includes environment data block in the middle of its U-Boot partition.
> > > 
> > > This allows describing Broadcom's U-Boot env data and will allow
> > > referencing its NVMEM cell in the future.
> > > 
> > > Reg: 118f3fbe517f4 ("dt-bindings: mtd: partitions: support label/name only partition")
> > 
> > Pardon my ignorance here, but what is the significance of a "Reg" tag?
> 
> That was meant to be "Ref:" and was meant to show commit that introduced
> concept of dynamic partitions. I thought it's a new feature not everyone
> may be familiar with yet. I thought it may help to review this patch.

Ah nw, I wasn't sure if it ws a typo or "Reg" short for regression.

> 
> If that is pointless though could you Rob just drop those tags while
> applying, please? I guess I'll just let you decide.
> 
> 
> > > Ref: dd638202dfb65 ("dt-bindings: mtd: partitions: add additional example for qcom,smem-part")
> > > Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> 

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions
  2022-10-18 15:42 [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Rafał Miłecki
  2022-10-18 15:42 ` [PATCH V3 2/2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding Rafał Miłecki
  2022-10-18 15:50 ` [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Conor Dooley
@ 2022-10-31 14:45 ` Rob Herring
  2 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-10-31 14:45 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Florian Fainelli, Krzysztof Kozlowski, bcm-kernel-feedback-list,
	linux-mtd, Rob Herring, William Zhang, Vignesh Raghavendra,
	Rafał Miłecki, Joel Peshkin, u-boot, Tom Rini,
	Conor Dooley, Richard Weinberger, devicetree, linux-arm-kernel,
	Miquel Raynal, linux-kernel, Srinivas Kandagatla


On Tue, 18 Oct 2022 17:42:01 +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> U-Boot partition may contain subpartitions. For example Broadcom
> includes environment data block in the middle of its U-Boot partition.
> 
> This allows describing Broadcom's U-Boot env data and will allow
> referencing its NVMEM cell in the future.
> 
> Reg: 118f3fbe517f4 ("dt-bindings: mtd: partitions: support label/name only partition")
> Ref: dd638202dfb65 ("dt-bindings: mtd: partitions: add additional example for qcom,smem-part")
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> V3: Add this patch as pre-requirement for u-boot,env.yaml & brcm,env
> ---
>  .../devicetree/bindings/mtd/partitions/u-boot.yaml         | 7 +++++++
>  1 file changed, 7 insertions(+)
> 

Applied, thanks!

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH V3 2/2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding
  2022-10-18 15:42 ` [PATCH V3 2/2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding Rafał Miłecki
@ 2022-10-31 14:45   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2022-10-31 14:45 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: bcm-kernel-feedback-list, Vignesh Raghavendra, Tom Rini, u-boot,
	devicetree, linux-kernel, Srinivas Kandagatla, Miquel Raynal,
	linux-arm-kernel, Conor Dooley, Krzysztof Kozlowski,
	Richard Weinberger, William Zhang, Joel Peshkin, linux-mtd,
	Rob Herring, Rafał Miłecki, Florian Fainelli


On Tue, 18 Oct 2022 17:42:02 +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 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 <rafal@milecki.pl>
> ---
> V2: Work on better commit body & add example
> V3: Avoid duplicated "mac" label
> ---
>  .../devicetree/bindings/nvmem/u-boot,env.yaml | 21 +++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 

Applied, thanks!

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-31 14:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18 15:42 [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Rafał Miłecki
2022-10-18 15:42 ` [PATCH V3 2/2] dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding Rafał Miłecki
2022-10-31 14:45   ` Rob Herring
2022-10-18 15:50 ` [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions Conor Dooley
2022-10-18 15:55   ` Rafał Miłecki
2022-10-18 16:01     ` Conor Dooley
2022-10-31 14:45 ` Rob Herring

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).