Resolve BCMBCA DT validation errors
cover Resolve BCMBCA DT validation errors
Greetings DT schema folks,
This is a small changeset to resolve DT validation errors in some files located within arm64/*/broadcom/bcmbca/. It consists of a relaxation of the BCM4908 partitioning schema, followed by two fixes to board-level DTs in order to pass validation fully.
The motivation for this changeset was to resolve validation errors flagged by Rob's bot when I tried to introduce a new DT to this directory [1].
Happy spooky month,
Sam
[1]: https://lore.kernel.org/linux-devicetree/[email protected]/
COMMITTER NOTE: Email being what it is, the capitalization of my email address is apparently getting discarded. If it is important that the author email address have identical capitalization to the Signed-off-by, please explain why so I can investigate why this is happening and/or get these patches to you in a desired format.
Sam Edwards (3):
dt-bindings: mtd: Relax BCM4908 partition schema
arm64: dts: broadcom: bcmbca: bcm4908: Fix Asus GT-AC5300's cferom
partition
arm64: dts: broadcom: bcmbca: bcm4908: Fix Netgear R8000P partitioning
.../mtd/partitions/brcm,bcm4908-partitions.yaml | 17 +++++++++++------ .../broadcom/bcmbca/bcm4906-netgear-r8000p.dts | 4 +--- .../broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts | 12 +++++------- 3 files changed, 17 insertions(+), 16 deletions(-)
Signature · 1 line
2.44.2
PATCH 1/3 dt-bindings: mtd: Relax BCM4908 partition schema
The BCM4908 partition "parser" is really just a fixed partitions table, with a special partition compatible (brcm,bcm4908-firmware) that automatically labels the partition as "firmware" or "backup" depending on what CFE is communicating as the selected active partition.
The bcm4908-partitions schema is currently too restrictive, requiring that all child nodes use this special compatible or none at all. This not only contracits what is allowed by the "parser" but also causes warnings for an existing file ("bcm4908-asus-gt-ac5300.dts").
Modify the schema to be strict only for child partitions that use the -firmware compatible. Also update the child name regex to agree with fixed-partitions, so that these differences apply consistently.
--- .../mtd/partitions/brcm,bcm4908-partitions.yaml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml +11 -6
@@ -30,12 +30,17 @@ properties: enum: [ 1, 2 ] patternProperties: - "^partition@[0-9a-f]+$": - $ref: partition.yaml# - properties: - compatible: - const: brcm,bcm4908-firmware - unevaluatedProperties: false + "^partition(-.+|@[0-9a-f]+)$": + type: object + if: + properties: + compatible: + const: brcm,bcm4908-firmware + then: + $ref: partition.yaml# + properties: + compatible: true + unevaluatedProperties: false required: - "#address-cells"
Signature · 1 line
2.44.2
PATCH 2/3 arm64: dts: broadcom: bcmbca: bcm4908: Fix Asus GT-AC5300's cferom partition
In reply to Sam EdwardsSince the previous patch relaxed the BCM4908 partition DT rules, it is now possible to have nvmem-cells directly under a BCM4908-partitioned MTD. Make use of this in order to refer to the nvmem MAC address the "correct" way, and pass the DTB check, for Asus GT-AC5300.
--- .../dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/broadcom/bcmbca/bcm4908-asus-gt-ac5300.dts +5 -7
@@ -185,17 +185,15 @@ partitions { #size-cells = <1>; partition@0 { + compatible = "nvmem-cells"; label = "cferom"; reg = <0x0 0x100000>; - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; + #address-cells = <1>; + #size-cells = <1>; - base_mac_addr: mac@106a0 { - reg = <0x106a0 0x6>; - }; + base_mac_addr: mac@106a0 { + reg = <0x106a0 0x6>; }; };
Signature · 1 line
2.44.2
PATCH 3/3 arm64: dts: broadcom: bcmbca: bcm4908: Fix Netgear R8000P partitioning
In reply to Sam EdwardsAs we have just modified the DT schema for BCM4908 partitioning in order to accommodate nvmem-cells partitions, the workaround of using fixed-partitions is no longer necessary to pass the DT check. Promote this partition table to full-blown BCM4908 active-partition detection and remove an inappropriate ranges property, thus fully complying with the schema.
--- .../arm64/boot/dts/broadcom/bcmbca/bcm4906-netgear-r8000p.dts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm64/boot/dts/broadcom/bcmbca/bcm4906-netgear-r8000p.dts +1 -3
@@ -139,7 +139,7 @@ &nandcs { #size-cells = <0>; partitions { - compatible = "fixed-partitions"; + compatible = "brcm,bcm4908-partitions"; #address-cells = <1>; #size-cells = <1>;
@@ -150,7 +150,6 @@ partition@0 { #address-cells = <1>; #size-cells = <1>; - ranges = <0 0x0 0x100000>; base_mac_addr: mac@106a0 { reg = <0x106a0 0x6>;
@@ -159,7 +158,6 @@ base_mac_addr: mac@106a0 { partition@100000 { compatible = "brcm,bcm4908-firmware"; - label = "firmware"; reg = <0x100000 0x4400000>; }; };
Signature · 1 line
2.44.2
Rob Herring (Arm)
maintainerRe: [PATCH 1/3] dt-bindings: mtd: Relax BCM4908 partition schema
In reply to Sam EdwardsQuoted 10 lines · Sam Edwards
The BCM4908 partition "parser" is really just a fixed partitions table, with a special partition compatible (
brcm,bcm4908-firmware) that automatically labels the partition as "firmware" or "backup" depending on what CFE is communicating as the selected active partition.The bcm4908-partitions schema is currently too restrictive, requiring that all child nodes use this special compatible or none at all. This not only contracits what is allowed by the "parser" but also causes warnings for an existing file ("
bcm4908-asus-gt-ac5300.dts").
Quoted 9 lines
Modify the schema to be strict only for child partitions that use the -firmware compatible. Also update the child name regex to agree with fixed-partitions, so that these differences apply consistently.
Signed-off-by Sam Edwards <[email protected]>--- .../mtd/partitions/brcm,bcm4908-partitions.yaml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml: patternProperties:^partition(-.+|@[0-9a-f]+)$: 'if' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml: patternProperties:^partition(-.+|@[0-9a-f]+)$: 'then' is not one of ['type', 'description', 'dependencies', 'dependentRequired', 'dependentSchemas', 'properties', 'patternProperties', 'additionalProperties', 'unevaluatedProperties', 'deprecated', 'required', 'not', 'allOf', 'anyOf', 'oneOf', '$ref']
from schema $id: http://devicetree.org/meta-schemas/nodes.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Rob Herring
maintainerRe: [PATCH 1/3] dt-bindings: mtd: Relax BCM4908 partition schema
In reply to Sam EdwardsQuoted 29 lines · Sam Edwards
The BCM4908 partition "parser" is really just a fixed partitions table, with a special partition compatible (
brcm,bcm4908-firmware) that automatically labels the partition as "firmware" or "backup" depending on what CFE is communicating as the selected active partition.The bcm4908-partitions schema is currently too restrictive, requiring that all child nodes use this special compatible or none at all. This not only contracits what is allowed by the "parser" but also causes warnings for an existing file ("
bcm4908-asus-gt-ac5300.dts").Modify the schema to be strict only for child partitions that use the -firmware compatible. Also update the child name regex to agree with fixed-partitions, so that these differences apply consistently.
Signed-off-by Sam Edwards <[email protected]>--- .../mtd/partitions/brcm,bcm4908-partitions.yaml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml +0
-2@@ -30,12 +30,17 @@ properties: enum: [ 1, 2 ] patternProperties: - "^partition@[0-9a-f]+$": - $ref: partition.yaml#
Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml properties: · line 38
Quoted 10 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml +6
-4- properties: - compatible: - const: brcm,bcm4908-firmware - unevaluatedProperties: false + "^partition(-.+|@[0-9a-f]+)$": + type: object + if: + properties: + compatible: + const: brcm,bcm4908-firmware
What schema applies to the node if this is not true? That needs to be addressed. You should be able to use oneOf here rather than if/then schema.
Quoted 11 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml +5
-0+ then: + $ref: partition.yaml# + properties: + compatible: true + unevaluatedProperties: false required: - "#address-cells"Signature · 1 line
2.44.2
Re: [PATCH 1/3] dt-bindings: mtd: Relax BCM4908 partition schema
Quoted 28 lines · Rob Herring
Quoted 26 lines · Sam Edwards
The BCM4908 partition "parser" is really just a fixed partitions table, with a special partition compatible (
brcm,bcm4908-firmware) that automatically labels the partition as "firmware" or "backup" depending on what CFE is communicating as the selected active partition.The bcm4908-partitions schema is currently too restrictive, requiring that all child nodes use this special compatible or none at all. This not only contracits what is allowed by the "parser" but also causes warnings for an existing file ("
bcm4908-asus-gt-ac5300.dts").Modify the schema to be strict only for child partitions that use the -firmware compatible. Also update the child name regex to agree with fixed-partitions, so that these differences apply consistently.
Signed-off-by Sam Edwards <[email protected]>--- .../mtd/partitions/brcm,bcm4908-partitions.yaml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml +0
-0@@ -30,12 +30,17 @@ properties: enum: [ 1, 2 ]
Quoted 13 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml properties: · line 38
Quoted 13 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml +6
-6patternProperties: - "^partition@[0-9a-f]+$": - $ref: partition.yaml# - properties: - compatible: - const: brcm,bcm4908-firmware - unevaluatedProperties: false + "^partition(-.+|@[0-9a-f]+)$": + type: object + if: + properties: + compatible: + const: brcm,bcm4908-firmware
Hi Rob,
Thanks for your attention on this one! This is an odd case where I'm not sure what else could be done, and I'm a newbie to modifying DT schemata, so I'm glad to be receiving your feedback. :)
Quoted 3 lines
What schema applies to the node if this is not true? That needs to be addressed. You should be able to use oneOf here rather than if/then schema.
The schema that should apply "in general" is partition.yaml, though moving the '$ref:' outside of 'then:' made the 'unevaluatedProperties:
false' disallow everything. The if block here is just trying to memorialize bcm4908-firmware as a valid compatible at this level, and (ideally) disallow unevaluated properties if so.
Could that be done with a oneOf? I would think if one of the arms of the oneOf was "unmodified $partition.yaml, unevaluated allowed" it would always match, rendering the "unevaluated disallowed when compatible=bcm4908-firmware" arm unused.
Best,
Sam
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml +5
-1+ then: + $ref: partition.yaml# + properties: + compatible: true + unevaluatedProperties: false required: - "#address-cells" --2.44.2