Skip to contentSkip to conversation

dt-bindings: mips: add CPU bindings for MIPS architecture

PATCH Superseded Sergio Paracuellos 2 participants 8 messages Sep 29, 2022 – Oct 1, 2022

Subsystems (3)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v3 cover dt-bindings: mips: add CPU bindings for MIPS architecture

Hi all,

This series tries to make the correct thing to represent in schema all the current documentation related with MIPS CPUs.

Current 'arch/mips/boot/dts' folder dts files are a bit messy for cpu nodes, so I set additionalProperties to true and only make required for 'compatible' in mips/cpus.yaml schema.

Broadcom cpus node is a bit special and need to use the property 'mips-hpt-frequency'. Since 'compatible' string is not in the 'cpus' parent node itself, we need a way to filter this to be valid only for Broadcom SoCs. To make this possible I have introduced two new schemas:
- One to describe the Broadcom SoCs and its compatibles.
- One to describe the BMIPS CPU's referring inside to 'brcm/soc.yaml' and 'mips/cpus.yaml' schemas.

Another thing to notice is that the root-node schema requires 'model' as property and there is no model at all in any real DTS file for any cpus node in 'arch/mips/boot/dts'. I have just added it in the schema sample to avoid the following check fail:

/: 'model' is a required property
From schema: /home/sergio/.local/lib/python3.8/site-packages/dtschema/schemas/root-node.yaml

Don't really know if this is a way to go.

Thanks in advance for your time and comments.

Best regards,
Sergio Paracuellos

Changes in v3:
- cpus.yaml:
* address Krzysztof comment in v2:
* add Thomas as maintainer since this is architecture binding.
* s/cpu/CPU
* compatible goes first
* Add compatible 'mips,mips4Kc' as per Thomas request.
- Introduce two new schemas for Broadcom BMIPS:
* soc.yaml: describing the BRCM SoC's
* brcm,bmips-cpus.yaml: describing the cpu nodes for this platform.

Previous series:
v1: https://lore.kernel.org/all/CAMhs-H-eUTOHjAXAbywOXQJgc_j5Ex-1sB7eBZU_bWt1fpNVzA@mail.gmail.com/T/
v2: https://lore.kernel.org/all/[email protected]/T/

Thanks,
Sergio Paracuellos

Sergio Paracuellos (3):
dt-bindings: mips: add CPU bindings for MIPS architecture
dt-bindings: mips: brcm: convert Broadcom SoCs to schema
dt-bindings: mips: brcm: convert CPU bindings for BMIPS architecture

 .../bindings/mips/brcm/brcm,bmips-cpus.yaml   | 102 ++++++++++++++++++
 .../bindings/mips/brcm/brcm,bmips.txt         |   8 --
 .../devicetree/bindings/mips/brcm/soc.yaml    |  97 +++++++++++++++++
 .../devicetree/bindings/mips/cpus.yaml        |  66 ++++++++++++
 4 files changed, 265 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/soc.yaml
 create mode 100644 Documentation/devicetree/bindings/mips/cpus.yaml
Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/3 dt-bindings: mips: add CPU bindings for MIPS architecture

Add the yaml binding for available CPUs in MIPS architecture.

---
 .../devicetree/bindings/mips/cpus.yaml        | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mips/cpus.yaml
Documentation/devicetree/bindings/mips/cpus.yaml new file +66 -0
new file mode 100644
index 000000000000..4f8891f0755b
@@ -0,0 +1,66 @@
+# 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:
+  - Thomas Bogendoerfer <[email protected]>
+
+description: |
+  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.
+
+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>;
+      };
+    };
Signature · 1 line
2.25.1
maintainer
#2 lore raw
Quoted 28 lines · Sergio Paracuellos

Add the yaml binding for available CPUs in MIPS architecture.

---
 .../devicetree/bindings/mips/cpus.yaml        | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mips/cpus.yaml
Documentation/devicetree/bindings/mips/cpus.yaml new file +14 -0
new file mode 100644
index 000000000000..4f8891f0755b
@@ -0,0 +1,66 @@
+# 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:
+  - Thomas Bogendoerfer <[email protected]>
+
+description: |
+  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")

Documentation/devicetree/bindings/mips/cpus.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10 -0
+  defining properties for every CPU.
+
+properties:
+  compatible:
+    enum:
+      - brcm,bmips3300
+      - brcm,bmips4350
+      - brcm,bmips4380
+      - brcm,bmips5000
+      - brcm,bmips5200

Need to remove Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt.

Documentation/devicetree/bindings/mips/cpus.yaml line 27

Quoted 3 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +3 -0
+      - ingenic,xburst-mxu1.0
+      - ingenic,xburst-fpu1.0-mxu1.1
+      - ingenic,xburst-fpu2.0-mxu2.0

So we should remove Documentation/devicetree/bindings/mips/ingenic/ingenic,cpu.yaml?

Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5 -0
+      - loongson,gs264
+      - mips,m14Kc
+      - mips,mips4Kc
+      - mips,mips4KEc
+      - mips,mips24Kc

Documentation/devicetree/bindings/mips/cpus.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10 -0
+      - mips,mips24KEc
+      - mips,mips74Kc
+      - mips,mips1004Kc
+      - mti,interaptiv
+      - mti,mips24KEc
+      - mti,mips14KEc
+      - mti,mips14Kc
+
+  reg:
+    maxItems: 1

Does the numbering have some basis in the h/w?

Documentation/devicetree/bindings/mips/cpus.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5 -0
+
+required:
+  - compatible
+
+additionalProperties: true

Do you need this to be true? What's missing besides 'device_type'?

We've got the same issue for Arm cpu schema, so fine for now if there's not an easy fix.

Rob

#3 lore raw

Hi Rob,

Quoted 35 lines · Rob Herring
Quoted 33 lines · Sergio Paracuellos

Add the yaml binding for available CPUs in MIPS architecture.

---
 .../devicetree/bindings/mips/cpus.yaml        | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mips/cpus.yaml
Documentation/devicetree/bindings/mips/cpus.yaml new file +19 -0
new file mode 100644
index 000000000000..4f8891f0755b
@@ -0,0 +1,66 @@
+# 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:
+  - Thomas Bogendoerfer <[email protected]>
+
+description: |
+  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.
+
+properties:
+  compatible:
+    enum:
Quoted 8 lines

Documentation/devicetree/bindings/mips/cpus.yaml line 24

Quoted 5 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5 -0
+      - brcm,bmips3300
+      - brcm,bmips4350
+      - brcm,bmips4380
+      - brcm,bmips5000
+      - brcm,bmips5200

Need to remove Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt.

This is removed in the BMIPS CPUs related PATCH.

Quoted 7 lines

Documentation/devicetree/bindings/mips/cpus.yaml line 27

Quoted 4 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +3 -0
+      - ingenic,xburst-mxu1.0
+      - ingenic,xburst-fpu1.0-mxu1.1
+      - ingenic,xburst-fpu2.0-mxu2.0

So we should remove Documentation/devicetree/bindings/mips/ingenic/ingenic,cpu.yaml?

Oh, I missed that documentation, thanks. I guess I can include that info in this schema and remove the file? Or maybe just drop this ingenic compatible from here? I wonder what is the best approach.

Quoted 17 lines
Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5 -0
+      - loongson,gs264
+      - mips,m14Kc
+      - mips,mips4Kc
+      - mips,mips4KEc
+      - mips,mips24Kc

Documentation/devicetree/bindings/mips/cpus.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +10 -0
+      - mips,mips24KEc
+      - mips,mips74Kc
+      - mips,mips1004Kc
+      - mti,interaptiv
+      - mti,mips24KEc
+      - mti,mips14KEc
+      - mti,mips14Kc
+
+  reg:
+    maxItems: 1
Quoted 1 line

Does the numbering have some basis in the h/w?

Looking into the current mainlined dts files I ended up with this. Other than that I don't really know.

Quoted 8 lines

Documentation/devicetree/bindings/mips/cpus.yaml line 47

Quoted 6 lines
Documentation/devicetree/bindings/mips/cpus.yaml new file +5 -0
+
+required:
+  - compatible
+
+additionalProperties: true

Do you need this to be true? What's missing besides 'device_type'?

As I tried to explain in the cover letter of this series, current 'arch/mips/boot/dts' folder dts files are a bit messy
for cpu nodes, so I set additionalProperties to true and only make them required for 'compatible' in this schema.
Just to avoid surprises. I guess I can try to set this to false and add clock and other properties required for some compatibles, if that is preferred.

Quoted 4 lines

We've got the same issue for Arm cpu schema, so fine for now if there's not an easy fix.

Rob

Thanks,
Sergio Paracuellos

#4 lore raw

PATCH v3 2/3 dt-bindings: mips: brcm: convert Broadcom SoCs to schema

In reply to Sergio Paracuellos

Convert Broadcom cable/DSL/settop platforms to YAML schema.

---
 .../devicetree/bindings/mips/brcm/soc.yaml    | 97 +++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/soc.yaml
Documentation/devicetree/bindings/mips/brcm/soc.yaml new file +97 -0
new file mode 100644
index 000000000000..37353709b5a7
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mips/brcm/soc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom cable/DSL/settop platforms Device Tree Bindings
+
+maintainers:
+  - Hauke Mehrtens <[email protected]>
+  - Rafał Miłecki <[email protected]>
+
+description: |
+    Boards Broadcom cable/DSL/settop SoC shall have the following properties.
+    The experimental -viper variants are for running Linux on the 3384's
+    BMIPS4355 cable modem CPU instead of the BMIPS5000 application processor.
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: Boards with Broadcom bcm3368 SoC
+        items:
+          - const: brcm,bcm3368
+
+      - description: Boards with Broadcom bcm3384 SoC
+        items:
+          - const: brcm,bcm3384
+
+      - description: Boards with Broadcom bcm33843 SoC
+        items:
+          - const: brcm,bcm33843
+
+      - description: Boards with Broadcom bcm3384-viper SoC
+        items:
+          - const: brcm,bcm3384-viper
+
+      - description: Boards with Broadcom bcm33843-viper SoC
+        items:
+          - const: brcm,bcm33843-viper
+
+      - description: Boards with Broadcom bcm6328 SoC
+        items:
+          - const: brcm,bcm6328
+
+      - description: Boards with Broadcom bcm6358 SoC
+        items:
+          - const: brcm,bcm6358
+
+      - description: Boards with Broadcom bcm6362 SoC
+        items:
+          - const: brcm,bcm6362
+
+      - description: Boards with Broadcom bcm6368 SoC
+        items:
+          - const: brcm,bcm6368
+
+      - description: Boards with Broadcom bcm63168 SoC
+        items:
+          - const: brcm,bcm63168
+
+      - description: Boards with Broadcom bcm63268 SoC
+        items:
+          - const: brcm,bcm63268
+
+      - description: Boards with Broadcom bcm7125 SoC
+        items:
+          - const: brcm,bcm7125
+
+      - description: Boards with Broadcom bcm7346 SoC
+        items:
+          - const: brcm,bcm7346
+
+      - description: Boards with Broadcom bcm7358 SoC
+        items:
+          - const: brcm,bcm7358
+
+      - description: Boards with Broadcom bcm7360 SoC
+        items:
+          - const: brcm,bcm7360
+
+      - description: Boards with Broadcom bcm7362 SoC
+        items:
+          - const: brcm,bcm7362
+
+      - description: Boards with Broadcom bcm7420 SoC
+        items:
+          - const: brcm,bcm7420
+
+      - description: Boards with Broadcom bcm7425 SoC
+        items:
+          - const: brcm,bcm7425
+
+additionalProperties: true
+
+...
Signature · 1 line
2.25.1
#5 lore raw

PATCH v3 3/3 dt-bindings: mips: brcm: convert CPU bindings for BMIPS architecture

In reply to Sergio Paracuellos

Convert the yaml binding for available CPUs in BMIPS architecture.

---
 .../bindings/mips/brcm/brcm,bmips-cpus.yaml   | 102 ++++++++++++++++++
 .../bindings/mips/brcm/brcm,bmips.txt         |   8 --
 2 files changed, 102 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +102 -0
new file mode 100644
index 000000000000..60aa7df9a543
@@ -0,0 +1,102 @@
+# 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: MIPS CPUs bindings
+
+maintainers:
+  - Hauke Mehrtens <[email protected]>
+  - Rafał Miłecki <[email protected]>
+
+description: |
+  The device tree allows to describe the layout of BMIPS CPUs.
+
+patternProperties:
+  "^/":
+    type: object
+    $ref: "/schemas/mips/brcm/soc.yaml#"
+
+properties:
+  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
+
+    patternProperties:
+      "^cpu@[0-9]$":
+        type: object
+        $ref: "/schemas/mips/cpus.yaml#"
+
+    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:
+  - |
+     / {
+         compatible = "brcm,bcm3368";
+         #address-cells = <1>;
+         #size-cells = <1>;
+         model = "Broadcom 3368";
+
+         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>;
+           };
+         };
+       };
Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt deleted +0 -8
deleted file mode 100644
index 8ef71b4085ca..000000000000
@@ -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.
Signature · 1 line
2.25.1
maintainer
#6 lore raw

Re: [PATCH v3 3/3] dt-bindings: mips: brcm: convert CPU bindings for BMIPS architecture

Quoted 6 lines · Sergio Paracuellos

Convert the yaml binding for available CPUs in BMIPS architecture.

---
 .../bindings/mips/brcm/brcm,bmips-cpus.yaml   | 102 ++++++++++++++++++
 .../bindings/mips/brcm/brcm,bmips.txt         |   8 --

Ah, here it is.

Quoted 13 lines
 2 files changed, 102 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +3 -0
new file mode 100644
index 000000000000..60aa7df9a543
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---

Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml line 13

Quoted 10 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +10 -0
+$id: http://devicetree.org/schemas/mips/brcm/brcm,bmips-cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MIPS CPUs bindings
+
+maintainers:
+  - Hauke Mehrtens <[email protected]>
+  - Rafał Miłecki <[email protected]>
+
+description: |

Don't need '|' if no formatting to preserve.

Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml line 19

Quoted 6 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +6 -0
+  The device tree allows to describe the layout of BMIPS CPUs.
+
+patternProperties:
+  "^/":
+    type: object
+    $ref: "/schemas/mips/brcm/soc.yaml#"

This is doesn't do anything.

Your schema is never applied either as 'select' defaults to false if there's not 'compaatible' or '$nodename' in the schema.

Quoted 43 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +43 -0
+
+properties:
+  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
+
+    patternProperties:
+      "^cpu@[0-9]$":
+        type: object
+        $ref: "/schemas/mips/cpus.yaml#"
+
+    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"

Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml line 72

Quoted 10 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +10 -0
+                  - "brcm,bcm7125"
+                  - "brcm,bcm7346"
+                  - "brcm,bcm7358"
+                  - "brcm,bcm7360"
+                  - "brcm,bcm7362"
+                  - "brcm,bcm7420"
+                  - "brcm,bcm7425"
+        then:
+          required:
+            - mips-hpt-frequency

Other than this property, the cpus.yaml schema in dtschema covers all this.

You allow mips-hpt-frequency on any platform including non-MIPS if this schema actually got applied. Is this intended for all MIPS platforms or just for Broadcom platforms? The former is hard to support as how do we express which platforms are MIPS in schemas. In the latter case, brcm/soc.yaml could have something like this:

properties:
cpus:
$ref: /schemas/cpus.yaml#
unevaluatedProperties: false

properties:
mips-hpt-frequency:
...

required:
- mips-hpt-frequency

Rob

#7 lore raw

Re: [PATCH v3 3/3] dt-bindings: mips: brcm: convert CPU bindings for BMIPS architecture

Hi Rob,

Quoted 10 lines · Rob Herring
Quoted 6 lines · Sergio Paracuellos

Convert the yaml binding for available CPUs in BMIPS architecture.

---
 .../bindings/mips/brcm/brcm,bmips-cpus.yaml   | 102 ++++++++++++++++++
 .../bindings/mips/brcm/brcm,bmips.txt         |   8 --

Ah, here it is.

Yes, this has to be removed :)

Quoted 18 lines
Quoted 18 lines
 2 files changed, 102 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
 delete mode 100644 Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +7 -0
new file mode 100644
index 000000000000..60aa7df9a543
@@ -0,0 +1,102 @@
+# 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: MIPS CPUs bindings
Quoted 8 lines

Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml line 13

Quoted 6 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +6 -0
+
+maintainers:
+  - Hauke Mehrtens <[email protected]>
+  - Rafał Miłecki <[email protected]>
+
+description: |

Don't need '|' if no formatting to preserve.

Understood.

Quoted 10 lines

Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml line 19

Quoted 7 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +6 -0
+  The device tree allows to describe the layout of BMIPS CPUs.
+
+patternProperties:
+  "^/":
+    type: object
+    $ref: "/schemas/mips/brcm/soc.yaml#"

This is doesn't do anything.

Quoted 2 lines

Your schema is never applied either as 'select' defaults to false if there's not 'compaatible' or '$nodename' in the schema.

I see, I thought referring to this was enough since 'compatible' and $nodename are defined in soc.yaml schema.

Quoted 69 lines
Quoted 44 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +43 -0
+
+properties:
+  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
+
+    patternProperties:
+      "^cpu@[0-9]$":
+        type: object
+        $ref: "/schemas/mips/cpus.yaml#"
+
+    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"

Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml line 72

Quoted 10 lines
Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml new file +10 -0
+                  - "brcm,bcm7125"
+                  - "brcm,bcm7346"
+                  - "brcm,bcm7358"
+                  - "brcm,bcm7360"
+                  - "brcm,bcm7362"
+                  - "brcm,bcm7420"
+                  - "brcm,bcm7425"
+        then:
+          required:
+            - mips-hpt-frequency

Other than this property, the cpus.yaml schema in dtschema covers all this.

You allow mips-hpt-frequency on any platform including non-MIPS if this schema actually got applied. Is this intended for all MIPS platforms or just for Broadcom platforms? The former is hard to support as how do we express which platforms are MIPS in schemas. In the latter case, brcm/soc.yaml could have something like this:

properties:
cpus:
$ref: /schemas/cpus.yaml#
unevaluatedProperties: false

Quoted 6 lines

properties:
mips-hpt-frequency:
...

required:
- mips-hpt-frequency

Ok, since this is only for Broadcom platforms, I will move this information to the soc.yaml schema and completely drop this patch in v4.

Thanks for reviewing, Rob.

Best regards,
Sergio Paracuellos

Quoted 2 lines

Rob