[12/13] dt-bindings: arm: Add Calxeda system registers json-schema binding
diff mbox series

Message ID 20200226180901.89940-13-andre.przywara@arm.com
State New
Headers show
Series
  • arm: calxeda: update DTS, bindings and MAINTAINERS
Related show

Commit Message

Andre Przywara Feb. 26, 2020, 6:09 p.m. UTC
The Calxeda system registers are a collection of MMIO register
controlling several more general aspects of the SoC.
Beside for some power management tasks this node is also somewhat
abused as the container for the clock nodes.

Add a binding in DT schema format using json-schema.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 .../bindings/arm/calxeda/hb-sregs.yaml        | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml

Comments

Rob Herring Feb. 26, 2020, 9:57 p.m. UTC | #1
On Wed, 26 Feb 2020 18:09:00 +0000, Andre Przywara wrote:
> The Calxeda system registers are a collection of MMIO register
> controlling several more general aspects of the SoC.
> Beside for some power management tasks this node is also somewhat
> abused as the container for the clock nodes.
> 
> Add a binding in DT schema format using json-schema.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  .../bindings/arm/calxeda/hb-sregs.yaml        | 47 +++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

warning: no schema found in file: Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: ignoring, error in schema: properties: clocks
Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: properties:clocks: {'type': 'object'} is not valid under any of the given schemas (Possible causes of the failure):
	/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: properties:clocks: 'maxItems' is a required property

Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/arm/calxeda/hb-sregs.example.dts' failed
make[1]: *** [Documentation/devicetree/bindings/arm/calxeda/hb-sregs.example.dts] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1245261
Please check and re-submit.
Andre Przywara Feb. 27, 2020, 12:12 a.m. UTC | #2
On 26/02/2020 21:57, Rob Herring wrote:

Hi Rob,

thanks for giving it a try!

> On Wed, 26 Feb 2020 18:09:00 +0000, Andre Przywara wrote:
>> The Calxeda system registers are a collection of MMIO register
>> controlling several more general aspects of the SoC.
>> Beside for some power management tasks this node is also somewhat
>> abused as the container for the clock nodes.
>>
>> Add a binding in DT schema format using json-schema.
>>
>> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>> ---
>>  .../bindings/arm/calxeda/hb-sregs.yaml        | 47 +++++++++++++++++++
>>  1 file changed, 47 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
>>
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> warning: no schema found in file: Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: ignoring, error in schema: properties: clocks
> Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: properties:clocks: {'type': 'object'} is not valid under any of the given schemas (Possible causes of the failure):
> 	/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: properties:clocks: 'maxItems' is a required property
> 
> Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/arm/calxeda/hb-sregs.example.dts' failed
> make[1]: *** [Documentation/devicetree/bindings/arm/calxeda/hb-sregs.example.dts] Error 1
> Makefile:1263: recipe for target 'dt_binding_check' failed
> make: *** [dt_binding_check] Error 2
> 
> See https://patchwork.ozlabs.org/patch/1245261
> Please check and re-submit.

Ah, right, I forgot that I actually fixed dt-schema:

It seems like we can cope with "clocks" being just a node name in
schema/clock/clock.yaml [1], but not in meta-schemas/clocks.yaml [2].

I added a similar anyOf ... to the meta-schemas entry, which seems to
fix it for me.

Can you confirm that this is a bug in dt-schema and this is the proper
fix or am I doing something wrong (I have only a smattering in
dt-schema/json)?

Cheers,
Andre

[1]
https://github.com/robherring/dt-schema/blob/master/schemas/clock/clock.yaml#L63-L67
[2]
https://github.com/robherring/dt-schema/blob/master/meta-schemas/clocks.yaml#L10-L11
Rob Herring Feb. 27, 2020, 2:44 p.m. UTC | #3
On Wed, Feb 26, 2020 at 6:12 PM André Przywara <andre.przywara@arm.com> wrote:
>
> On 26/02/2020 21:57, Rob Herring wrote:
>
> Hi Rob,
>
> thanks for giving it a try!
>
> > On Wed, 26 Feb 2020 18:09:00 +0000, Andre Przywara wrote:
> >> The Calxeda system registers are a collection of MMIO register
> >> controlling several more general aspects of the SoC.
> >> Beside for some power management tasks this node is also somewhat
> >> abused as the container for the clock nodes.
> >>
> >> Add a binding in DT schema format using json-schema.
> >>
> >> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> >> ---
> >>  .../bindings/arm/calxeda/hb-sregs.yaml        | 47 +++++++++++++++++++
> >>  1 file changed, 47 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
> >>
> >
> > My bot found errors running 'make dt_binding_check' on your patch:
> >
> > warning: no schema found in file: Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: ignoring, error in schema: properties: clocks
> > Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: properties:clocks: {'type': 'object'} is not valid under any of the given schemas (Possible causes of the failure):
> >       /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml: properties:clocks: 'maxItems' is a required property
> >
> > Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/arm/calxeda/hb-sregs.example.dts' failed
> > make[1]: *** [Documentation/devicetree/bindings/arm/calxeda/hb-sregs.example.dts] Error 1
> > Makefile:1263: recipe for target 'dt_binding_check' failed
> > make: *** [dt_binding_check] Error 2
> >
> > See https://patchwork.ozlabs.org/patch/1245261
> > Please check and re-submit.
>
> Ah, right, I forgot that I actually fixed dt-schema:
>
> It seems like we can cope with "clocks" being just a node name in
> schema/clock/clock.yaml [1], but not in meta-schemas/clocks.yaml [2].
>
> I added a similar anyOf ... to the meta-schemas entry, which seems to
> fix it for me.
>
> Can you confirm that this is a bug in dt-schema and this is the proper
> fix or am I doing something wrong (I have only a smattering in
> dt-schema/json)?

Yeah, that's right. Though ideally we'd avoid names that are used as
both properties and nodes, but this one is kind of widely used.

Can you submit a GH pull req with the fix (use the devicetree-org one,
not my tree).

Rob

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml b/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
new file mode 100644
index 000000000000..541c47955a3d
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/calxeda/hb-sregs.yaml
@@ -0,0 +1,47 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/calxeda/hb-sregs.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Calxeda Highbank system registers
+
+description: |
+  The Calxeda Highbank system has a block of MMIO registers controlling
+  several generic system aspects. Those can be used to control some power
+  management, they also contain some gate and PLL clocks.
+
+maintainers:
+  - Andre Przywara <andre.przywara@arm.com>
+
+properties:
+  compatible:
+    const: calxeda,hb-sregs
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    type: object
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    sregs@fff3c000 {
+        compatible = "calxeda,hb-sregs";
+        reg = <0xfff3c000 0x1000>;
+
+        clocks {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            osc: oscillator {
+                #clock-cells = <0>;
+                compatible = "fixed-clock";
+                clock-frequency = <33333000>;
+            };
+        };
+    };