diff mbox series

[v2,1/7] dt-bindings: loongarch: Add CPU bindings for LoongArch

Message ID 0e70f7d95104fc9d0a8038c3f0652f5fdfafa4d0.1692088166.git.zhoubinbin@loongson.cn
State Changes Requested, archived
Headers show
Series LoongArch: Add built-in dtb support | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Binbin Zhou Aug. 15, 2023, 8:50 a.m. UTC
Add the available CPUs in LoongArch binding with DT schema format using
json-schema.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
 .../devicetree/bindings/loongarch/cpus.yaml   | 60 +++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/loongarch/cpus.yaml

Comments

Conor Dooley Aug. 15, 2023, 2:07 p.m. UTC | #1
On Tue, Aug 15, 2023 at 04:50:46PM +0800, Binbin Zhou wrote:
> Add the available CPUs in LoongArch binding with DT schema format using
> json-schema.
> 
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
>  .../devicetree/bindings/loongarch/cpus.yaml   | 60 +++++++++++++++++++
>  1 file changed, 60 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/loongarch/cpus.yaml
> 
> diff --git a/Documentation/devicetree/bindings/loongarch/cpus.yaml b/Documentation/devicetree/bindings/loongarch/cpus.yaml
> new file mode 100644
> index 000000000000..ee3fe09e53dc
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/loongarch/cpus.yaml
> @@ -0,0 +1,60 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/loongarch/cpus.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: LoongArch CPUs
> +
> +maintainers:
> +  - Binbin Zhou <zhoubinbin@loongson.cn>
> +
> +description:
> +  This document describes the list of LoongArch CPU cores that support FDT,
> +  it describe the layout of CPUs in a system through the "cpus" node.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - loongson,la264
> +      - loongson,la364
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  device_type: true
> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +
> +additionalProperties: false

How come you didn't add the reference to the common cpu schema?

Thanks,
Conor.

> +
> +examples:
> +  - |
> +    #include <dt-bindings/clock/loongson,ls2k-clk.h>
> +
> +    cpus {
> +        #size-cells = <0>;
> +        #address-cells = <1>;
> +
> +        cpu@0 {
> +            compatible = "loongson,la264";
> +            device_type = "cpu";
> +            reg = <0>;
> +            clocks = <&clk LOONGSON2_NODE_CLK>;
> +        };
> +
> +        cpu@1 {
> +            compatible = "loongson,la264";
> +            device_type = "cpu";
> +            reg = <1>;
> +            clocks = <&clk LOONGSON2_NODE_CLK>;
> +        };
> +    };
> +
> +...
> -- 
> 2.39.3
>
Binbin Zhou Aug. 16, 2023, 6:37 a.m. UTC | #2
Hi Conor:

Thanks for the reply.

On Tue, Aug 15, 2023 at 10:07 PM Conor Dooley <conor@kernel.org> wrote:
>
> On Tue, Aug 15, 2023 at 04:50:46PM +0800, Binbin Zhou wrote:
> > Add the available CPUs in LoongArch binding with DT schema format using
> > json-schema.
> >
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > ---
> >  .../devicetree/bindings/loongarch/cpus.yaml   | 60 +++++++++++++++++++
> >  1 file changed, 60 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/loongarch/cpus.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/loongarch/cpus.yaml b/Documentation/devicetree/bindings/loongarch/cpus.yaml
> > new file mode 100644
> > index 000000000000..ee3fe09e53dc
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/loongarch/cpus.yaml
> > @@ -0,0 +1,60 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/loongarch/cpus.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: LoongArch CPUs
> > +
> > +maintainers:
> > +  - Binbin Zhou <zhoubinbin@loongson.cn>
> > +
> > +description:
> > +  This document describes the list of LoongArch CPU cores that support FDT,
> > +  it describe the layout of CPUs in a system through the "cpus" node.
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - loongson,la264
> > +      - loongson,la364
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    maxItems: 1
> > +
> > +  device_type: true
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - clocks
> > +
> > +additionalProperties: false
>
> How come you didn't add the reference to the common cpu schema?

Do you mean:
allOf:
  - $ref: /schemas/cpu.yaml#

Sorry, the file started out as a copy of mips/arm and then the related
content, really didn't notice that part.
I will check again.

Also, shouldn't "additionalProperties: false" be changed to
"unevaluatedProperties: false" synchronously?

Thanks.
Binbin
>
> Thanks,
> Conor.
>
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/clock/loongson,ls2k-clk.h>
> > +
> > +    cpus {
> > +        #size-cells = <0>;
> > +        #address-cells = <1>;
> > +
> > +        cpu@0 {
> > +            compatible = "loongson,la264";
> > +            device_type = "cpu";
> > +            reg = <0>;
> > +            clocks = <&clk LOONGSON2_NODE_CLK>;
> > +        };
> > +
> > +        cpu@1 {
> > +            compatible = "loongson,la264";
> > +            device_type = "cpu";
> > +            reg = <1>;
> > +            clocks = <&clk LOONGSON2_NODE_CLK>;
> > +        };
> > +    };
> > +
> > +...
> > --
> > 2.39.3
> >
Conor Dooley Aug. 16, 2023, 6:50 a.m. UTC | #3
On Wed, Aug 16, 2023 at 02:37:43PM +0800, Binbin Zhou wrote:
> Hi Conor:
> 
> Thanks for the reply.
> 
> On Tue, Aug 15, 2023 at 10:07 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > On Tue, Aug 15, 2023 at 04:50:46PM +0800, Binbin Zhou wrote:
> > > Add the available CPUs in LoongArch binding with DT schema format using
> > > json-schema.
> > >
> > > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > > ---
> > >  .../devicetree/bindings/loongarch/cpus.yaml   | 60 +++++++++++++++++++
> > >  1 file changed, 60 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/loongarch/cpus.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/loongarch/cpus.yaml b/Documentation/devicetree/bindings/loongarch/cpus.yaml
> > > new file mode 100644
> > > index 000000000000..ee3fe09e53dc
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/loongarch/cpus.yaml
> > > @@ -0,0 +1,60 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/loongarch/cpus.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: LoongArch CPUs
> > > +
> > > +maintainers:
> > > +  - Binbin Zhou <zhoubinbin@loongson.cn>
> > > +
> > > +description:
> > > +  This document describes the list of LoongArch CPU cores that support FDT,
> > > +  it describe the layout of CPUs in a system through the "cpus" node.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - loongson,la264
> > > +      - loongson,la364
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  clocks:
> > > +    maxItems: 1
> > > +
> > > +  device_type: true
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - clocks
> > > +
> > > +additionalProperties: false
> >
> > How come you didn't add the reference to the common cpu schema?
> 
> Do you mean:
> allOf:
>   - $ref: /schemas/cpu.yaml#

Yes.

> Sorry, the file started out as a copy of mips/arm and then the related
> content, really didn't notice that part.
> I will check again.
> 
> Also, shouldn't "additionalProperties: false" be changed to
> "unevaluatedProperties: false" synchronously?

To actually make use of the properties from there, yeah.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/loongarch/cpus.yaml b/Documentation/devicetree/bindings/loongarch/cpus.yaml
new file mode 100644
index 000000000000..ee3fe09e53dc
--- /dev/null
+++ b/Documentation/devicetree/bindings/loongarch/cpus.yaml
@@ -0,0 +1,60 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/loongarch/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LoongArch CPUs
+
+maintainers:
+  - Binbin Zhou <zhoubinbin@loongson.cn>
+
+description:
+  This document describes the list of LoongArch CPU cores that support FDT,
+  it describe the layout of CPUs in a system through the "cpus" node.
+
+properties:
+  compatible:
+    enum:
+      - loongson,la264
+      - loongson,la364
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  device_type: true
+
+required:
+  - compatible
+  - reg
+  - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/loongson,ls2k-clk.h>
+
+    cpus {
+        #size-cells = <0>;
+        #address-cells = <1>;
+
+        cpu@0 {
+            compatible = "loongson,la264";
+            device_type = "cpu";
+            reg = <0>;
+            clocks = <&clk LOONGSON2_NODE_CLK>;
+        };
+
+        cpu@1 {
+            compatible = "loongson,la264";
+            device_type = "cpu";
+            reg = <1>;
+            clocks = <&clk LOONGSON2_NODE_CLK>;
+        };
+    };
+
+...