dt-bindings: mips: add CPU bindings for MIPS architecture
Subsystems (3)
PATCH v2 1/1 dt-bindings: mips: add CPU bindings for MIPS architecture
Add the yaml binding for available CPUs in MIPS architecture.
---
Changes in v2:
- Remove 'bindings/mips/brcm/brcm,bmips.txt'
- Include 'mips-hpt-frequency' in cpus YAML schema for bmips CPUS's
- Add a BMIPS CPU node sample
.../bindings/mips/brcm/brcm,bmips.txt | 8 -- .../devicetree/bindings/mips/cpus.yaml | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 8 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt create mode 100644 Documentation/devicetree/bindings/mips/cpus.yaml
Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt deleted +0 -8
@@ -1,8 +0,0 @@ -* Broadcom MIPS (BMIPS) CPUs - -Required properties: -- compatible: "brcm,bmips3300", "brcm,bmips4350", "brcm,bmips4380", - "brcm,bmips5000" - -- mips-hpt-frequency: This is common to all CPUs in the system so it lives - under the "cpus" node.
Documentation/devicetree/bindings/mips/cpus.yaml new file +100 -0
100 lines not on this page · raw message
Signature · 1 line
2.25.1
Thomas Bogendoerfer
maintainerQuoted 5 lines · Sergio Paracuellos
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ compatible: + enum: + - brcm,bmips3300 + - brcm,bmips4350 + - brcm,bmips4380
Documentation/devicetree/bindings/mips/cpus.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10
-0+ - brcm,bmips5000 + - brcm,bmips5200 + - ingenic,xburst-mxu1.0 + - ingenic,xburst-fpu1.0-mxu1.1 + - ingenic,xburst-fpu2.0-mxu2.0 + - loongson,gs264 + - mips,mips1004Kc + - mips,m14Kc + - mips,mips24KEc + - mips,mips4KEc
could you add mips,mips4Kc ? I have a board, which I'm switching to DT, which uses that core.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Hi Thomas,
Quoted 18 lines · Thomas Bogendoerfer
Quoted 5 lines · Sergio Paracuellos
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ compatible: + enum: + - brcm,bmips3300 + - brcm,bmips4350 + - brcm,bmips4380Documentation/devicetree/bindings/mips/cpus.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10
-0+ - brcm,bmips5000 + - brcm,bmips5200 + - ingenic,xburst-mxu1.0 + - ingenic,xburst-fpu1.0-mxu1.1 + - ingenic,xburst-fpu2.0-mxu2.0 + - loongson,gs264 + - mips,mips1004Kc + - mips,m14Kc + - mips,mips24KEc + - mips,mips4KEc
Quoted 2 lines
could you add mips,mips4Kc ? I have a board, which I'm switching to DT, which uses that core.
Sure, I will add it and send v3. I am going to wait to send v3 until Rob's review just in case something is still wrong / missing here.
Thanks,
Sergio Paracuellos
Quoted 6 lines
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
Quoted 3 lines · Sergio Paracuellos
Add the yaml binding for available CPUs in MIPS architecture.
Signed-off-by Sergio Paracuellos <[email protected]>
Rebase on some recent Linux kernel tree and use scripts/get_maintainers.pl
Quoted 32 lines
---
Changes in v2:
- Remove 'bindings/mips/brcm/brcm,bmips.txt'
- Include 'mips-hpt-frequency' in cpus YAML schema for bmips CPUS's
- Add a BMIPS CPU node sample.../bindings/mips/brcm/brcm,bmips.txt | 8 -- .../devicetree/bindings/mips/cpus.yaml | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 8 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt create mode 100644 Documentation/devicetree/bindings/mips/cpus.yamlDocumentation/devicetree/bindings/mips/brcm/brcm,bmips.txt deleted +0
-8@@ -1,8 +0,0 @@ -* Broadcom MIPS (BMIPS) CPUs - -Required properties: -- compatible: "brcm,bmips3300", "brcm,bmips4350", "brcm,bmips4380", - "brcm,bmips5000" - -- mips-hpt-frequency: This is common to all CPUs in the system so it lives - under the "cpus" node.Documentation/devicetree/bindings/mips/cpus.yaml new file +0
-0
Documentation/devicetree/bindings/mips/cpus.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10
-0@@ -0,0 +1,100 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mips/cpus.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MIPS CPUs bindings + +maintainers: + - Sergio Paracuellos <[email protected]>
What about existing maintainers?
Documentation/devicetree/bindings/mips/cpus.yaml line 12
Quoted 2 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +2
-0+ +description: |+
|+ seems not needed
Documentation/devicetree/bindings/mips/cpus.yaml line 15
Quoted 3 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +3
-0+ The device tree allows to describe the layout of CPUs in a system through + the "cpus" node, which in turn contains a number of subnodes (ie "cpu") + defining properties for every cpu.
s/cpu/CPU/
Documentation/devicetree/bindings/mips/cpus.yaml line 21
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+ +properties: + reg: + maxItems: 1 + + compatible:
compatible goes first.
Documentation/devicetree/bindings/mips/cpus.yaml line 33
Quoted 12 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +12
-0+ enum: + - brcm,bmips3300 + - brcm,bmips4350 + - brcm,bmips4380 + - brcm,bmips5000 + - brcm,bmips5200 + - ingenic,xburst-mxu1.0 + - ingenic,xburst-fpu1.0-mxu1.1 + - ingenic,xburst-fpu2.0-mxu2.0 + - loongson,gs264 + - mips,mips1004Kc + - mips,m14Kc
Maybe keep alphabetical order?
Documentation/devicetree/bindings/mips/cpus.yaml line 43
Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10
-0+ - mips,mips24KEc + - mips,mips4KEc + - mips,mips74Kc + - mips,mips24Kc + - mti,mips24KEc + - mti,mips14KEc + - mti,mips14Kc + - mti,interaptiv + +if:
Out it in allOf block
Documentation/devicetree/bindings/mips/cpus.yaml line 54
Quoted 11 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +11
-0+ properties: + compatible: + enum: + - brcm,bmips3300 + - brcm,bmips4350 + - brcm,bmips4380 + - brcm,bmips5000 + - brcm,bmips5200 +then: + patternProperties: + mips-hpt-frequency:
It's not a pattern. Did you test the bindings?
Documentation/devicetree/bindings/mips/cpus.yaml line 55
Quoted 1 line
Documentation/devicetree/bindings/mips/cpus.yaml new file +1
-0+ $ref: /schemas/types.yaml#/definitions/uint32
Missing description.
else mips-hpt-frequency: false
Documentation/devicetree/bindings/mips/cpus.yaml line 60
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ +required: + - compatible + +additionalProperties: true
and this is why you did not notice errors...
Quoted 17 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +17
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>;
Documentation/devicetree/bindings/mips/cpus.yaml line 87
Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10
-0+ }; + }; + + - | + // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;
Does not match your bindings. Are you sure you tested the patches?
Documentation/devicetree/bindings/mips/cpus.yaml line 100
Quoted 13 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +13
-0+ + cpu@0 { + compatible = "brcm,bmips4350"; + device_type = "cpu"; + reg = <0>; + }; + + cpu@1 { + compatible = "brcm,bmips4350"; + device_type = "cpu"; + reg = <1>; + }; + };
Best regards,
Krzysztof
Quoted 7 lines · Krzysztof Kozlowski
Quoted 3 lines · Sergio Paracuellos
Add the yaml binding for available CPUs in MIPS architecture.
Signed-off-by Sergio Paracuellos <[email protected]>Rebase on some recent Linux kernel tree and use
scripts/get_maintainers.pl
Understood.
Quoted 38 lines
Quoted 38 lines
---
Changes in v2:
- Remove 'bindings/mips/brcm/brcm,bmips.txt'
- Include 'mips-hpt-frequency' in cpus YAML schema for bmips CPUS's
- Add a BMIPS CPU node sample.../bindings/mips/brcm/brcm,bmips.txt | 8 -- .../devicetree/bindings/mips/cpus.yaml | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 8 deletions(-) delete mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt create mode 100644 Documentation/devicetree/bindings/mips/cpus.yamlDocumentation/devicetree/bindings/mips/brcm/brcm,bmips.txt deleted +0
-8@@ -1,8 +0,0 @@ -* Broadcom MIPS (BMIPS) CPUs - -Required properties: -- compatible: "brcm,bmips3300", "brcm,bmips4350", "brcm,bmips4380", - "brcm,bmips5000" - -- mips-hpt-frequency: This is common to all CPUs in the system so it lives - under the "cpus" node.Documentation/devicetree/bindings/mips/cpus.yaml new file +4
-0@@ -0,0 +1,100 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mips/cpus.yaml#
Quoted 8 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 10
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: MIPS CPUs bindings + +maintainers: + - Sergio Paracuellos <[email protected]>What about existing maintainers?
Will add Thomas as maintainer, thanks.
Quoted 7 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 12
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +2
-0+ +description: |+|+ seems not needed
Will drop.
Quoted 7 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 15
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +3
-0+ The device tree allows to describe the layout of CPUs in a system through + the "cpus" node, which in turn contains a number of subnodes (ie "cpu") + defining properties for every cpu.s/cpu/CPU/
Will change.
Quoted 9 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 21
Quoted 7 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+ +properties: + reg: + maxItems: 1 + + compatible:compatible goes first.
Understood.
Quoted 14 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 33
Quoted 13 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +12
-0+ enum: + - brcm,bmips3300 + - brcm,bmips4350 + - brcm,bmips4380 + - brcm,bmips5000 + - brcm,bmips5200 + - ingenic,xburst-mxu1.0 + - ingenic,xburst-fpu1.0-mxu1.1 + - ingenic,xburst-fpu2.0-mxu2.0 + - loongson,gs264 + - mips,mips1004Kc + - mips,m14Kc
Quoted 1 line
Maybe keep alphabetical order?
Ok.
Quoted 13 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 43
Quoted 11 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10
-0+ - mips,mips24KEc + - mips,mips4KEc + - mips,mips74Kc + - mips,mips24Kc + - mti,mips24KEc + - mti,mips14KEc + - mti,mips14Kc + - mti,interaptiv + +if:Out it in allOf block
Understood.
Quoted 13 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 54
Quoted 12 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +11
-0+ properties: + compatible: + enum: + - brcm,bmips3300 + - brcm,bmips4350 + - brcm,bmips4380 + - brcm,bmips5000 + - brcm,bmips5200 +then: + patternProperties: + mips-hpt-frequency:
Quoted 5 lines
It's not a pattern. Did you test the bindings?
Documentation/devicetree/bindings/mips/cpus.yaml line 55
Quoted 1 line
Documentation/devicetree/bindings/mips/cpus.yaml new file +1
-0+ $ref: /schemas/types.yaml#/definitions/uint32Missing description.
Will add it.
Quoted 10 lines
else mips-hpt-frequency: false
Documentation/devicetree/bindings/mips/cpus.yaml line 60
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Current arch/mips/boot/dts folder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?
Quoted 22 lines
Quoted 22 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |
Quoted 8 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 87
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtb
Can you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.
Thanks in advance for your time.
Best regards,
Sergio Paracuellos
Quoted 18 lines
Quoted 4 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +3
-0+ + cpu@0 { + compatible = "brcm,bmips4350";Documentation/devicetree/bindings/mips/cpus.yaml line 100
Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10
-0+ device_type = "cpu"; + reg = <0>; + }; + + cpu@1 { + compatible = "brcm,bmips4350"; + device_type = "cpu"; + reg = <1>; + }; + };Best regards,
Krzysztof
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Documentation/devicetree/bindings/mips/cpus.yaml line 60
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?
This is okay, but it caused you did not notice errors...
Quoted 43 lines
Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 87
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtb
Quoted 5 lines
Can you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
The second should work, but then it's a bit cluttered (top-level mixed with cpus).
Best regards,
Krzysztof
Hi Krzysztof,
Quoted 68 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Documentation/devicetree/bindings/mips/cpus.yaml line 60
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 43 lines
Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 87
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbQuoted 5 lines
Can you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.
Quoted 7 lines
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
The second should work, but then it's a bit cluttered (top-level mixed with cpus).
I don't know if I am understanding you but maybe it is because my explanation about the requirement was not good at all. So let me explain a bit better.
This is the normal way of definition of cpus for BMIPS:
cpus {
#address-cells = <1>;
#size-cells = <0>;
mips-hpt-frequency = <150000000>;
cpu@0 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <0>;
};
cpu@1 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <1>;
};
};What I need to say in schema is that 'mips-hpt-frequency' must be only present if cpu@0 and cpu@1 nodes contain a compatible matching brcm,bmips*. In the same cpu@0 or cpu@1 node
the following below will be sufficient. How can I express the same but referring that 'mips-hpt-frequency' must be on the parent node? Because as it is below the validator complains because 'mips-hpt-frequency'
is not present in cpu@0 and cpu@1 nodes:
allOf:
- if:
properties:
compatible:
enum:
- brcm,bmips3300
- brcm,bmips4350
- brcm,bmips4380
- brcm,bmips5000
- brcm,bmips5200
then:
required:
- mips-hpt-frequency
else:
properties:
mips-hpt-frequency: false
Thanks,
Sergio Paracuellos
Quoted 3 lines
Best regards,
Krzysztof
Quoted 77 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 73 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Documentation/devicetree/bindings/mips/cpus.yaml line 60
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 43 lines
Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 87
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbQuoted 5 lines
Can you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
Quoted 8 lines
Quoted 2 lines
The second should work, but then it's a bit cluttered (top-level mixed with cpus).
I don't know if I am understanding you but maybe it is because my explanation about the requirement was not good at all. So let me explain a bit better.
This is the normal way of definition of cpus for BMIPS:
I know, I checked the DTS.
Quoted 20 lines
cpus {
#address-cells = <1>;
#size-cells = <0>;
mips-hpt-frequency = <150000000>;
cpu@0 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <0>;
};
cpu@1 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <1>;
};
};Quoted 5 lines
What I need to say in schema is that 'mips-hpt-frequency' must be only present if cpu@0 and cpu@1 nodes contain a compatible matching brcm,bmips*. In the same cpu@0 or cpu@1 node
the following below will be sufficient. How can I express the same but referring that 'mips-hpt-frequency' must be on the parent node?
As I said you had two ways. In your current patch, I think you cannot.
Quoted 4 lines
Because as it is below the validator complains because 'mips-hpt-frequency'
is not present in cpu@0 and cpu@1 nodes:
Quoted 17 lines
allOf:
- if:
properties:
compatible:
enum:
- brcm,bmips3300
- brcm,bmips4350
- brcm,bmips4380
- brcm,bmips5000
- brcm,bmips5200
then:
required:
- mips-hpt-frequency
else:
properties:
mips-hpt-frequency: false
Best regards,
Krzysztof
Hi Krzysztof,
Quoted 74 lines · Krzysztof Kozlowski
Quoted 72 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 68 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Documentation/devicetree/bindings/mips/cpus.yaml line 60
Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Documentation/devicetree/bindings/mips/cpus.yaml line 87
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbCan you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
Ok so if I am understanding correctly having two schemas is a way to go:
One for brcm,bmips-cpus.yaml (since there is no compatible, should this be a valid name for this?) containing something like:
properties:
$nodename:
const: cpus
mips-hpt-frequency:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
This is common to all CPUs in the system so it lives
under the "cpus" node.
additionalProperties: true
examples:
- |
cpus {
#address-cells = <1>;
#size-cells = <0>;
mips-hpt-frequency = <150000000>;
cpu@0 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <0>;
};
cpu@1 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <1>;
};};
And the other as 'cpus.yaml' having:
properties:
compatible:
enum:
- brcm,bmips3300
- brcm,bmips4350
- brcm,bmips4380
- brcm,bmips5000
- brcm,bmips5200
- ingenic,xburst-mxu1.0
- ingenic,xburst-fpu1.0-mxu1.1
- ingenic,xburst-fpu2.0-mxu2.0
- loongson,gs264
- mips,m14Kc
- mips,mips4Kc
- mips,mips4KEc
- mips,mips24Kc
- mips,mips24KEc
- mips,mips74Kc
- mips,mips1004Kc
- mti,interaptiv
- mti,mips24KEc
- mti,mips14KEc
- mti,mips14Kc
reg:
maxItems: 1
required:
- compatible
additionalProperties: true
examples:
- |
cpus {
#size-cells = <0>;
#address-cells = <1>;
cpu@0 {
device_type = "cpu";
compatible = "mips,mips1004Kc";
reg = <0>;
};
cpu@1 {
device_type = "cpu";
compatible = "mips,mips1004Kc";
reg = <1>;
};
};Should this be a valid approach?
Thanks,
Sergio Paracuellos
Quoted 64 lines
Quoted 9 lines
Quoted 3 lines
The second should work, but then it's a bit cluttered (top-level mixed with cpus).
I don't know if I am understanding you but maybe it is because my explanation about the requirement was not good at all. So let me explain a bit better.
This is the normal way of definition of cpus for BMIPS:
I know, I checked the DTS.
Quoted 20 lines
cpus { #address-cells = <1>; #size-cells = <0>; mips-hpt-frequency = <150000000>; cpu@0 { compatible = "brcm,bmips4350"; device_type = "cpu"; reg = <0>; }; cpu@1 { compatible = "brcm,bmips4350"; device_type = "cpu"; reg = <1>; }; };Quoted 5 lines
What I need to say in schema is that 'mips-hpt-frequency' must be only present if cpu@0 and cpu@1 nodes contain a compatible matching brcm,bmips*. In the same cpu@0 or cpu@1 node
the following below will be sufficient. How can I express the same but referring that 'mips-hpt-frequency' must be on the parent node?As I said you had two ways. In your current patch, I think you cannot.
Quoted 4 lines
Because as it is below the validator complains because 'mips-hpt-frequency'
is not present in cpu@0 and cpu@1 nodes:Quoted 17 lines
allOf:
- if:
properties:
compatible:
enum:
- brcm,bmips3300
- brcm,bmips4350
- brcm,bmips4380
- brcm,bmips5000
- brcm,bmips5200
then:
required:
- mips-hpt-frequency
else:
properties:
mips-hpt-frequency: falseBest regards,
Krzysztof
Quoted 92 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 74 lines · Krzysztof Kozlowski
Quoted 72 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 68 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Review
Quoted 5 lines
(quoted diff) +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
(quoted diff) +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbCan you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
Ok so if I am understanding correctly having two schemas is a way to go:
One for brcm,bmips-cpus.yaml (since there is no compatible, should this be a valid name for this?) containing something like:
properties:
$nodename:
const: cpus
Quoted 7 lines
mips-hpt-frequency:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
This is common to all CPUs in the system so it lives
under the "cpus" node.additionalProperties: true
Almost. Such schema will allow mips-hpt-frequency in each cpus node, everywhere. On every board and architecture.
You need to limit it per top-level compatibles.
You can also wait a week and maybe Rob will have some ideas.
Quoted 20 lines
examples:
- |cpus { #address-cells = <1>; #size-cells = <0>; mips-hpt-frequency = <150000000>; cpu@0 { compatible = "brcm,bmips4350"; device_type = "cpu"; reg = <0>; }; cpu@1 { compatible = "brcm,bmips4350"; device_type = "cpu"; reg = <1>; };
Quoted 3 lines
};
And the other as '
cpus.yaml' having:
Yes.
Best regards,
Krzysztof
Hi Krzysztof,
Quoted 100 lines · Krzysztof Kozlowski
Quoted 98 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 74 lines · Krzysztof Kozlowski
Quoted 72 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 68 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Review
Quoted 5 lines
(quoted diff) +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
(quoted diff) +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbCan you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
Ok so if I am understanding correctly having two schemas is a way to go:
One for brcm,bmips-cpus.yaml (since there is no compatible, should this be a valid name for this?) containing something like:
properties:
$nodename:
const: cpusmips-hpt-frequency:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
This is common to all CPUs in the system so it lives
under the "cpus" node.
Quoted 4 lines
Quoted 1 line
additionalProperties: true
Almost. Such schema will allow mips-hpt-frequency in each cpus node, everywhere. On every board and architecture.
Yes, that is what I thought since no compatible to match this is included in current node.
Quoted 2 lines
You need to limit it per top-level compatibles.
Any sample of how to do this? So this bmips SoCs use compatible strings that are described in:
https://elixir.bootlin.com/linux/v6.0-rc5/source/Documentation/devicetree/bindings/mips/brcm/soc.txt
Can the top level compatible string be used in some way to filter this easily from this new 'brcm,bmips-cpus.yaml'
Quoted 2 lines
You can also wait a week and maybe Rob will have some ideas.
Ideas are always welcome :). Ok, we can wait to Rob and see what should be the correct approach to handle this.
Thanks,
Sergio Paracuellos
Quoted 29 lines
Quoted 21 lines
examples:
- |cpus { #address-cells = <1>; #size-cells = <0>; mips-hpt-frequency = <150000000>; cpu@0 { compatible = "brcm,bmips4350"; device_type = "cpu"; reg = <0>; }; cpu@1 { compatible = "brcm,bmips4350"; device_type = "cpu"; reg = <1>; };Quoted 3 lines
};
And the other as '
cpus.yaml' having:Yes.
Best regards,
Krzysztof
Quoted 113 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 100 lines · Krzysztof Kozlowski
Quoted 98 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 74 lines · Krzysztof Kozlowski
Quoted 72 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 68 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Review
Quoted 5 lines
(quoted diff) +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
(quoted diff) +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbCan you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
Ok so if I am understanding correctly having two schemas is a way to go:
One for brcm,bmips-cpus.yaml (since there is no compatible, should this be a valid name for this?) containing something like:
properties:
$nodename:
const: cpusmips-hpt-frequency:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
This is common to all CPUs in the system so it lives
under the "cpus" node.Quoted 4 lines
Quoted 1 line
additionalProperties: true
Almost. Such schema will allow mips-hpt-frequency in each cpus node, everywhere. On every board and architecture.
Yes, that is what I thought since no compatible to match this is included in current node.
Quoted 1 line
Quoted 5 lines
Quoted 1 line
You need to limit it per top-level compatibles.
Any sample of how to do this? So this bmips SoCs use compatible strings that are described in:
https://elixir.bootlin.com/linux/v6.0-rc5/source/Documentation/devicetree/bindings/mips/brcm/soc.txt
Could be something like this:
https://lore.kernel.org/all/[email protected]/
which is a part of top-level schema or add a new one. The new one will duplicate the compatibles and parts from that one there, so maybe better to keep it in top-level?
I am not sure, any suggestions are welcome. Also platform/architecture maintainers might have their preference to organize it.
Anyway, you did not Cc the actual platform maintainers (Rafał and Hauke).
Quoted 3 lines
Can the top level compatible string be used in some way to filter this easily from this new 'brcm,bmips-cpus.yaml'
Yes. If schema matches the top level compatible, then in allOf:if:then you can add restriction to disallow it for other variants:
For example:
https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml#L212
Best regards,
Krzysztof
Hi Krzysztof,
[cc: Hauke Mehrtens and Rafał Miłecki as maintainers for 'Documentation/devicetree/bindings/mips/brcm/']
Quoted 121 lines · Krzysztof Kozlowski
Quoted 113 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 100 lines · Krzysztof Kozlowski
Quoted 98 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 74 lines · Krzysztof Kozlowski
Quoted 72 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 68 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Review
Quoted 5 lines
(quoted diff) +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
(quoted diff) +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbCan you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
Ok so if I am understanding correctly having two schemas is a way to go:
One for brcm,bmips-cpus.yaml (since there is no compatible, should this be a valid name for this?) containing something like:
properties:
$nodename:
const: cpusmips-hpt-frequency:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
This is common to all CPUs in the system so it lives
under the "cpus" node.Quoted 4 lines
Quoted 1 line
additionalProperties: true
Almost. Such schema will allow mips-hpt-frequency in each cpus node, everywhere. On every board and architecture.
Yes, that is what I thought since no compatible to match this is included in current node.
Quoted 1 line
Quoted 5 lines
Quoted 1 line
You need to limit it per top-level compatibles.
Any sample of how to do this? So this bmips SoCs use compatible strings that are described in:
https://elixir.bootlin.com/linux/v6.0-rc5/source/Documentation/devicetree/bindings/mips/brcm/soc.txt
Quoted 8 lines
Could be something like this:
https://lore.kernel.org/all/[email protected]/
which is a part of top-level schema or add a new one. The new one will duplicate the compatibles and parts from that one there, so maybe better to keep it in top-level?I am not sure, any suggestions are welcome. Also platform/architecture maintainers might have their preference to organize it.
I am also not sure.
Quoted 2 lines
Anyway, you did not Cc the actual platform maintainers (Rafał and Hauke).
True, sorry for the inconvenience. Added now to CC list.
Quoted 5 lines
Quoted 4 lines
Can the top level compatible string be used in some way to filter this easily from this new 'brcm,bmips-cpus.yaml'
Quoted 7 lines
Yes. If schema matches the top level compatible, then in allOf:if:then you can add restriction to disallow it for other variants:
For example:
https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml#L212
Thanks for the clue.
I'll try to do some tests and come back here later :)
Thanks,
Sergio Paracuellos
Quoted 4 lines
Best regards,
Krzysztof
Hi Krzysztof,
Quoted 153 lines · Sergio Paracuellos
Hi Krzysztof,
[cc: Hauke Mehrtens and Rafał Miłecki as maintainers for '
Documentation/devicetree/bindings/mips/brcm/']Quoted 121 lines · Krzysztof Kozlowski
Quoted 113 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 100 lines · Krzysztof Kozlowski
Quoted 98 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 74 lines · Krzysztof Kozlowski
Quoted 72 lines · Sergio Paracuellos
Hi Krzysztof,
Quoted 68 lines · Krzysztof Kozlowski
Quoted 11 lines · Sergio Paracuellos
Quoted 10 lines
else mips-hpt-frequency: false
Review
Quoted 5 lines
(quoted diff) +5
-0+ +required: + - compatible + +additionalProperties: trueand this is why you did not notice errors...
Quoted 3 lines
Current
arch/mips/boot/dtsfolder dts files are a mess for cpu nodes, so I set additionalProperties to true and only make required for 'compatible'. What should be the correct approach?This is okay, but it caused you did not notice errors...
Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
(quoted diff) +21
-0+ +examples: + - | + cpus { + #size-cells = <0>; + #address-cells = <1>; + + cpu@0 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <0>; + }; + + cpu@1 { + device_type = "cpu"; + compatible = "mips,mips1004Kc"; + reg = <1>; + }; + }; + + - |Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ // Example 2 (BMIPS CPU) + cpus { + #address-cells = <1>; + #size-cells = <0>; + + mips-hpt-frequency = <150000000>;Does not match your bindings. Are you sure you tested the patches?
Yes I did:
$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/cpus.yaml LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/cpus.example.dts DTC Documentation/devicetree/bindings/mips/cpus.example.dtb ' CHECK Documentation/devicetree/bindings/mips/cpus.example.dtbCan you please point me to a sample of how to make required in a parent node of cpu@X property 'mips-hpt-frequency' only for some compatible strings inside the node? What can this be properly expressed using schema??
I was looking and testing different things for a while without success at all.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
You either define new schema for /cpus node (and match by name, define children etc) or include it in schema for top-level properties. The first is tricky, because the cpus node does not have compatible (like nvidia,tegra194-ccplex.yaml).
Ok so if I am understanding correctly having two schemas is a way to go:
One for brcm,bmips-cpus.yaml (since there is no compatible, should this be a valid name for this?) containing something like:
properties:
$nodename:
const: cpusmips-hpt-frequency:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
This is common to all CPUs in the system so it lives
under the "cpus" node.Quoted 4 lines
Quoted 1 line
additionalProperties: true
Almost. Such schema will allow mips-hpt-frequency in each cpus node, everywhere. On every board and architecture.
Yes, that is what I thought since no compatible to match this is included in current node.
Quoted 1 line
Quoted 5 lines
Quoted 1 line
You need to limit it per top-level compatibles.
Any sample of how to do this? So this bmips SoCs use compatible strings that are described in:
https://elixir.bootlin.com/linux/v6.0-rc5/source/Documentation/devicetree/bindings/mips/brcm/soc.txtQuoted 8 lines
Could be something like this:
https://lore.kernel.org/all/[email protected]/
which is a part of top-level schema or add a new one. The new one will duplicate the compatibles and parts from that one there, so maybe better to keep it in top-level?I am not sure, any suggestions are welcome. Also platform/architecture maintainers might have their preference to organize it.
I am also not sure.
Quoted 2 lines
Anyway, you did not Cc the actual platform maintainers (Rafał and Hauke).
True, sorry for the inconvenience. Added now to CC list.
Quoted 8 lines
Quoted 4 lines
Can the top level compatible string be used in some way to filter this easily from this new 'brcm,bmips-cpus.yaml'
Yes. If schema matches the top level compatible, then in allOf:if:then you can add restriction to disallow it for other variants:
Quoted 8 lines
Quoted 4 lines
For example:
https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml#L212Thanks for the clue.
I'll try to do some tests and come back here later :)
How about this?
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
---
$id: http://devicetree.org/schemas/mips/brcm/brcm,bmips-cpus.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: BMIPS CPUs bindings
maintainers:
- Hauke Mehrtens <[email protected]>
- Rafał Miłecki <[email protected]>
description: |
The device tree allows to describe the layout of BMIPS CPUs.
properties:
$nodename:
const: "/"
compatible:
enum:
- "brcm,bcm3368"
- "brcm,bcm3384"
- "brcm,bcm33843"
- "brcm,bcm3384-viper"
- "brcm,bcm33843-viper"
- "brcm,bcm6328"
- "brcm,bcm6358"
- "brcm,bcm6362"
- "brcm,bcm6368"
- "brcm,bcm63168"
- "brcm,bcm63268"
- "brcm,bcm7125"
- "brcm,bcm7346"
- "brcm,bcm7358"
- "brcm,bcm7360"
- "brcm,bcm7362"
- "brcm,bcm7420"
- "brcm,bcm7425"
cpus:
type: object
additionalProperties: true
properties:
'#address-cells':
const: 1
'#size-cells':
const: 0
mips-hpt-frequency:
description: This is common to all CPUs in the system so it lives
under the "cpus" node.
$ref: /schemas/types.yaml#/definitions/uint32
required:
- '#address-cells'
- '#size-cells'
allOf:
- if:
properties:
compatible:
contains:
enum:
- "brcm,bcm3368"
- "brcm,bcm3384"
- "brcm,bcm33843"
- "brcm,bcm3384-viper"
- "brcm,bcm33843-viper"
- "brcm,bcm6328"
- "brcm,bcm6358"
- "brcm,bcm6362"
- "brcm,bcm6368"
- "brcm,bcm63168"
- "brcm,bcm63268"
- "brcm,bcm7125"
- "brcm,bcm7346"
- "brcm,bcm7358"
- "brcm,bcm7360"
- "brcm,bcm7362"
- "brcm,bcm7420"
- "brcm,bcm7425"
then:
required:
- mips-hpt-frequency
additionalProperties: true
examples:
- |
/ {
#address-cells = <1>;
#size-cells = <1>;
compatible = "brcm,bcm3368";
cpus {
#address-cells = <1>;
#size-cells = <0>;
mips-hpt-frequency = <150000000>;
cpu@0 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <0>;
};
cpu@1 {
compatible = "brcm,bmips4350";
device_type = "cpu";
reg = <1>;
};
};
};This seems to work as expected with this node:
make dt_binding_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dts DTC Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb CHECK Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb
/home/sergio/GNUBEE-SERGIO-TEST/linux/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb:
/: 'model' is a required property
From schema: /home/sergio/.local/lib/python3.8/site-packages/dtschema/schemas/root-node.yaml
If I remove the property from the CPU nodes I get:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dts DTC Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb CHECK Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb
/home/sergio/GNUBEE-SERGIO-TEST/linux/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb:
/: cpus: 'mips-hpt-frequency' is a required property
From schema: /home/sergio/GNUBEE-SERGIO-TEST/linux/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml /home/sergio/GNUBEE-SERGIO-TEST/linux/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb:
/: 'model' is a required property
From schema: /home/sergio/.local/lib/python3.8/site-packages/dtschema/schemas/root-node.yaml
And if I change the top level compatible it does not complain also:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
LINT Documentation/devicetree/bindings CHKDT Documentation/devicetree/bindings/processed-schema.json SCHEMA Documentation/devicetree/bindings/processed-schema.json DTEX Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dts DTC Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb CHECK Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb
/home/sergio/GNUBEE-SERGIO-TEST/linux/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.example.dtb:
/: 'model' is a required property
However, the root-node schema requires 'model' as property and there is no model at all in any real DTS file. I don't know if can be added only in this sample to avoid the check fail.
Thanks,
Sergio Paracuellos
Quoted 7 lines
Thanks,
Sergio ParacuellosQuoted 4 lines
Best regards,
Krzysztof