[PATCH v4 1/2] dt-bindings: mtd: partitions: Document new dynamic-partition nodes
Rob Herring
robh at kernel.org
Mon Jun 6 06:36:15 PDT 2022
On Sat, Jun 04, 2022 at 12:57:58AM +0200, Ansuel Smith wrote:
> On Wed, Jun 01, 2022 at 04:06:55PM -0500, Rob Herring wrote:
> > On Thu, May 19, 2022 at 01:32:57AM +0200, Ansuel Smith wrote:
> > > Document new dynamic-partition nodes used to provide an OF node for
> > > partition registred at runtime by parsers. This is required for nvmem
> > > system to declare and detect nvmem-cells.
> > >
> > > With these special partitions, the reg / offset is not required.
> > > The label binding is used to match the partition allocated by the
> > > parser at runtime and the parser will provide reg and offset of the mtd.
> > >
> > > NVMEM will use the data from the parser and provide the NVMEM cells
> > > declared in the DTS, "connecting" the dynamic partition with a
> > > static declaration of cells in them.
> > >
> > > Signed-off-by: Ansuel Smith <ansuelsmth at gmail.com>
> > > ---
> > > .../mtd/partitions/dynamic-partition.yaml | 57 +++++++++++++++++++
> > > .../mtd/partitions/qcom,smem-part.yaml | 4 ++
> > > 2 files changed, 61 insertions(+)
> > > create mode 100644 Documentation/devicetree/bindings/mtd/partitions/dynamic-partition.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/mtd/partitions/dynamic-partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/dynamic-partition.yaml
> > > new file mode 100644
> > > index 000000000000..f57d7b9cae7f
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mtd/partitions/dynamic-partition.yaml
> > > @@ -0,0 +1,57 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/mtd/partitions/dynamic-partition.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Dynamic Partition
> > > +
> > > +description: |
> > > + This binding describes a single flash partition that is dynamically allocated
> > > + by a dedicated parser that is not a fixed-partition parser.
> > > +
> > > + Each child of the parser partition node is then compared and if a match with
> > > + the provided label is found then the OF node is assigned.
> > > +
> > > + These special partition definition can be used to give a dynamic partition
> > > + an OF node to declare NVMEM cells. An example is declaring the partition
> > > + label and all the NVMEM cells in it. The parser will detect the correct reg
> > > + and offset and the NVMEM will register the cells in it based on the data
> > > + extracted by the parser.
> > > +
> > > +maintainers:
> > > + - Ansuel Smith <ansuelsmth at gmail.com>
> > > +
> > > +properties:
> > > + label:
> > > + description: The label / name for the partition assigned by the parser at
> > > + runtime. This is needed for sybsystem like NVMEM to define cells and
> >
> > typo
> >
> > > + register with this OF node.
> > > +
> > > +required:
> > > + - label
> > > +
> > > +additionalProperties: true
> > > +
> > > +examples:
> > > + - |
> > > + flash {
> > > + partitions {
> > > + compatible = "qcom,smem-part";
> > > +
> > > + partition-art {
> > > + compatible = "nvmem-cells";
> > > + #address-cells = <1>;
> > > + #size-cells = <1>;
> > > + label = "0:art";
> > > +
> > > + macaddr_art_0: macaddr at 0 {
> > > + reg = <0x0 0x6>;
> > > + };
> > > +
> > > + macaddr_art_6: macaddr at 6 {
> > > + reg = <0x6 0x6>;
> > > + };
> >
> > There's a problem with the schema structure for this which is a common
> > problem where we have parent and child nodes with parent defined
> > properties in the child nodes (label in this case). The issue is that
> > there is not a single schema applied to the child node which contains
> > all possible properties sub-node names. This is necessary to check for
> > extra, undocumented properties using unevaluatedProperties. The creation
> > of spi-periphera-props.yaml is an example of how to address this. I
> > suspect that all the partition schemas may need similar restructuring.
> >
> > The nvmem-cells schema may happen to already have 'label', so it happens
> > to work (that and unevaluatedProperties is probably missing in places).
> >
> > Given this schema is really just one property which is already
> > documented for 'partition' nodes, all we really need is to say is if
> > 'reg' is not present, then 'label' is required:
> >
> > if:
> > not:
> > required: [ reg ]
> > then:
> > required: [ label ]
> >
> >
>
> Just to make sure. The correct way to implement this would be drop the
> current dynamic-partition schema and expand the partition.yaml with the
> additional if and the extra stuff in the description.
> Wanted to keep the 2 thing separated but if necessary I will follow this
> path.
Yes. I agree separate would have been nice documentation wise,
but the schema has ended having such a small difference it doesn't
make sense anymore.
Rob
More information about the linux-mtd
mailing list