Message ID | 20221028235933.934850-13-miquel.raynal@bootlin.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | Improve MTD bindings | expand |
On Sat, Oct 29, 2022 at 01:59:33AM +0200, Miquel Raynal wrote: > Parser compatibles cannot be used anywhere, and the list is limited. In > order to constrain this list, enumerate them all under the top > "partitions" subnode. New parsers will have to add their own compatible > here as well. > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> > --- > Documentation/devicetree/bindings/mtd/mtd.yaml | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml > index bddb7bdf441b..29db0b5c115e 100644 > --- a/Documentation/devicetree/bindings/mtd/mtd.yaml > +++ b/Documentation/devicetree/bindings/mtd/mtd.yaml > @@ -27,13 +27,29 @@ properties: > partitions: > type: object > properties: > + compatible: > + contains: > + enum: > + - fixed-partitions > + - arm,arm-firmware-suite > + - brcm,bcm4908-partitions > + - brcm,bcm947xx-cfe-partitions > + - nksys,ns-partitions > + - nvmem-cells > + - qcom,smem-part > + - redboot-fis > + > '#address-cells': true > + > '#size-cells': true Alternatively, you could add a 'oneOf' with $ref's to each partition type. Then we don't have the same compatible in 2 places. If you do, then the partition schemas should have a 'select: false' so we don't apply the schema twice. Or keeping it like this is fine too. Reviewed-by: Rob Herring <robh@kernel.org> Rob
diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml index bddb7bdf441b..29db0b5c115e 100644 --- a/Documentation/devicetree/bindings/mtd/mtd.yaml +++ b/Documentation/devicetree/bindings/mtd/mtd.yaml @@ -27,13 +27,29 @@ properties: partitions: type: object properties: + compatible: + contains: + enum: + - fixed-partitions + - arm,arm-firmware-suite + - brcm,bcm4908-partitions + - brcm,bcm947xx-cfe-partitions + - nksys,ns-partitions + - nvmem-cells + - qcom,smem-part + - redboot-fis + '#address-cells': true + '#size-cells': true patternProperties: "partition@[0-9a-f]+": $ref: partitions/partition.yaml + required: + - compatible + patternProperties: "@[0-9a-f]+$": $ref: partitions/partition.yaml
Parser compatibles cannot be used anywhere, and the list is limited. In order to constrain this list, enumerate them all under the top "partitions" subnode. New parsers will have to add their own compatible here as well. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> --- Documentation/devicetree/bindings/mtd/mtd.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)