devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	upstream@airoha.com
Subject: Re: [PATCH 2/3] dt-bindings: mtd: Add Documentation for Airoha fixed-partitions
Date: Wed, 25 Sep 2024 13:52:56 +0200	[thread overview]
Message-ID: <20240925135256.32d3a0f7@xps-13> (raw)
In-Reply-To: <66f3f58e.5d0a0220.5d655.b48a@mx.google.com>

Hi Christian,

ansuelsmth@gmail.com wrote on Wed, 25 Sep 2024 13:35:38 +0200:

> On Wed, Sep 25, 2024 at 01:30:03PM +0200, Miquel Raynal wrote:
> > Hi Christian,
> > 
> > ansuelsmth@gmail.com wrote on Wed, 25 Sep 2024 12:13:58 +0200:
> >   
> > > Add Documentation for Airoha fixed-partitions compatibles.
> > > 
> > > Airoha based SoC declare a dedicated partition at the end of the flash to
> > > store calibration and device specific data, in addition to fixed
> > > partitions.
> > > 
> > > The offset of this special partition is not well defined as a custom bad
> > > block management driver is used that reserve space at the end of the flash.
> > > 
> > > This binding allows defining all fixed partitions and marking the last one
> > > to detect the correct offset.
> > > 
> > > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > > ---
> > >  .../partitions/airoha,fixed-partitions.yaml   | 80 +++++++++++++++++++
> > >  .../bindings/mtd/partitions/partitions.yaml   |  1 +
> > >  2 files changed, 81 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml
> > > new file mode 100644
> > > index 000000000000..a45df51065af
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mtd/partitions/airoha,fixed-partitions.yaml
> > > @@ -0,0 +1,80 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/mtd/partitions/airoha,fixed-partitions.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Airoha SoC partitioning
> > > +
> > > +description: |
> > > +  Airoha based SoC declare a dedicated partition at the end of the flash to
> > > +  store calibration and device specific data, in addition to fixed partitions.
> > > +
> > > +  The offset of this special partition is not well defined as a custom bad block
> > > +  management driver is used that reserve space at the end of the flash.
> > > +
> > > +  This binding allows defining all fixed partitions and marking the last one to
> > > +  detect the correct offset from the new end of the flash.
> > > +
> > > +maintainers:
> > > +  - Christian Marangi <ansuelsmth@gmail.com>
> > > +
> > > +select: false
> > > +
> > > +properties:
> > > +  compatible:
> > > +    const: airoha,fixed-partitions
> > > +
> > > +  "#address-cells":
> > > +    enum: [ 1, 2 ]
> > > +
> > > +  "#size-cells":
> > > +    enum: [ 1, 2 ]
> > > +
> > > +patternProperties:
> > > +  "^partition@[0-9a-f]+$":
> > > +    $ref: partition.yaml#
> > > +    properties:
> > > +      compatible:
> > > +        const: airoha,dynamic-art
> > > +    unevaluatedProperties: false
> > > +
> > > +required:
> > > +  - "#address-cells"
> > > +  - "#size-cells"
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +    partitions {
> > > +        compatible = "airoha,fixed-partitions";
> > > +        #address-cells = <1>;
> > > +        #size-cells = <1>;
> > > +
> > > +        partition@0 {
> > > +          label = "bootloader";
> > > +          reg = <0x00000000 0x00080000>;
> > > +        };
> > > +
> > > +        partition@80000 {
> > > +          label = "tclinux";
> > > +          reg = <0x00080000 0x02800000>;
> > > +        };
> > > +
> > > +        partition@2880000 {
> > > +          label = "tclinux_slave";
> > > +          reg = <0x02880000 0x02800000>;
> > > +        };
> > > +
> > > +        partition@5080000 {
> > > +          label = "rootfs_data";
> > > +          reg = <0x5080000 0x00800000>;
> > > +        };
> > > +
> > > +        partition@ffffffff {
> > > +          compatible = "airoha,dynamic-art";
> > > +          label = "art";
> > > +          reg = <0xffffffff 0x00300000>;  
> > 
> > I'm a little bit puzzled by this kind of information which is known to
> > be wrong. As the partition offset and size must be dynamically
> > calculated, this reg property (as well as the size parameter of the
> > previous one) are notably wrong. I guess we are not fully constrained
> > by the fixed-partitions schema here, so could we avoid the reg property
> > in the airoha,dynamic-art partition? Maybe we also need a #define for a
> > specific placeholder in the penultimate reg property too (for the size).
> >  
> 
> Maybe instead of reg we can use a property like size?
> 
> Can you better elaborate the suggestion about the #define?
> 
> Do you mean for case where the last partition might overlap
> with the penultimate? Honestly in such case I would error hard, that
> case happen when too much space is reserved and that is a
> misconfiguration of the system (developer error)

That's not what I mean.

In the above case you say partition "partition@5080000" is 0x800000
bytes long. This is obviously wrong otherwise you would know where the
art partition starts. And right after you're saying partition
"partition@ffffffff" starts at 0xffffffff and is 0x300000 bytes long.
This is also wrong because 0xffffffff is not a valid start address and
IIUC 0x300000 is also unknown and dynamically derived.

So for the art partition my advise if you know nothing about the
start/length is to just skip the reg property. For the previous
partition I'd maybe use a definition (whose name is to discuss) instead
of the wrong size argument (the start offset being correct on his side).

Thanks, Miquèl

  reply	other threads:[~2024-09-25 11:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 10:13 [PATCH 0/3] mtd: Add support for Airoha partition scheme Christian Marangi
2024-09-25 10:13 ` [PATCH 1/3] of: also export of_update_property Christian Marangi
2024-09-25 10:13 ` [PATCH 2/3] dt-bindings: mtd: Add Documentation for Airoha fixed-partitions Christian Marangi
2024-09-25 11:30   ` Miquel Raynal
2024-09-25 11:35     ` Christian Marangi
2024-09-25 11:52       ` Miquel Raynal [this message]
2024-09-25 12:06         ` Christian Marangi
2024-09-30  9:48           ` Miquel Raynal
2024-09-30 10:10             ` Christian Marangi
2024-10-01  8:42               ` Miquel Raynal
2024-10-01 10:28                 ` Christian Marangi
2024-10-02  8:00                   ` Miquel Raynal
2024-10-16  7:33                     ` Christian Marangi
2024-10-16  8:58                       ` Miquel Raynal
2024-10-16 17:33                       ` Andreas Gnau
2024-09-25 10:13 ` [PATCH 3/3] mtd: parser: add support for Airoha parser 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=20240925135256.32d3a0f7@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=ansuelsmth@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    --cc=richard@nod.at \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=upstream@airoha.com \
    --cc=vigneshr@ti.com \
    --cc=wsa+renesas@sang-engineering.com \
    /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).