diff mbox series

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

Message ID 20220929072004.874795-4-sergio.paracuellos@gmail.com (mailing list archive)
State Superseded
Headers show
Series dt-bindings: mips: add CPU bindings for MIPS architecture | expand

Commit Message

Sergio Paracuellos Sept. 29, 2022, 7:20 a.m. UTC
Convert the yaml binding for available CPUs in BMIPS architecture.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 .../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

Comments

Rob Herring (Arm) Sept. 30, 2022, 5:43 p.m. UTC | #1
On Thu, Sep 29, 2022 at 09:20:04AM +0200, Sergio Paracuellos wrote:
> Convert the yaml binding for available CPUs in BMIPS architecture.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  .../bindings/mips/brcm/brcm,bmips-cpus.yaml   | 102 ++++++++++++++++++
>  .../bindings/mips/brcm/brcm,bmips.txt         |   8 --

Ah, here it is.

>  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
> 
> diff --git a/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml b/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
> new file mode 100644
> index 000000000000..60aa7df9a543
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
> @@ -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 <hauke@hauke-m.de>
> +  - Rafał Miłecki <zajec5@gmail.com>
> +
> +description: |

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

> +  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.

> +
> +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

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
Sergio Paracuellos Oct. 1, 2022, 3:44 a.m. UTC | #2
Hi Rob,

On Fri, Sep 30, 2022 at 7:43 PM Rob Herring <robh@kernel.org> wrote:
>
> On Thu, Sep 29, 2022 at 09:20:04AM +0200, Sergio Paracuellos wrote:
> > Convert the yaml binding for available CPUs in BMIPS architecture.
> >
> > Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> > ---
> >  .../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 :)

>
> >  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
> >
> > diff --git a/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml b/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
> > new file mode 100644
> > index 000000000000..60aa7df9a543
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
> > @@ -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 <hauke@hauke-m.de>
> > +  - Rafał Miłecki <zajec5@gmail.com>
> > +
> > +description: |
>
> Don't need '|' if no formatting to preserve.

Understood.

>
> > +  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.

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

>
> > +
> > +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
>
> 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

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

>
> Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml b/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
new file mode 100644
index 000000000000..60aa7df9a543
--- /dev/null
+++ b/Documentation/devicetree/bindings/mips/brcm/brcm,bmips-cpus.yaml
@@ -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 <hauke@hauke-m.de>
+  - Rafał Miłecki <zajec5@gmail.com>
+
+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>;
+           };
+         };
+       };
diff --git a/Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt b/Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt
deleted file mode 100644
index 8ef71b4085ca..000000000000
--- a/Documentation/devicetree/bindings/mips/brcm/brcm,bmips.txt
+++ /dev/null
@@ -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.