Skip to contentSkip to conversation

dt-bindings: sram: convert rockchip-pmu-sram bindings to yaml

RFC PATCH Superseded Johan Jonker 3 participants 4 messages Mar 17, 2020 – Mar 18, 2020

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 dt-bindings: sram: convert rockchip-pmu-sram bindings to yaml

Current dts files with 'rockchip-pmu-sram' compatible nodes are manually verified. In order to automate this process rockchip-pmu-sram.txt has to be converted to yaml.

A check with the command below gives for example this error:

arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff700000:
compatible:0:
'rockchip,rk3288-pmu-sram' was expected arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff700000:
compatible:
['mmio-sram'] is too short

Fix this error by adding an extra 'mmio-sram' compatible and 'if then' structure to filter yaml warnings.

make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sram/ rockchip-pmu-sram.yaml

---
 .../devicetree/bindings/sram/rockchip-pmu-sram.txt | 16 --------
 .../bindings/sram/rockchip-pmu-sram.yaml           | 46 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 16 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt
 create mode 100644 Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml
Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt deleted +0 -16
deleted file mode 100644
index 6b42fda30..000000000
@@ -1,16 +0,0 @@
-Rockchip SRAM for pmu:
-------------------------------
-
-The sram of pmu is used to store the function of resume from maskrom(the 1st
-level loader). This is a common use of the "pmu-sram" because it keeps power
-even in low power states in the system.
-
-Required node properties:
-- compatible : should be "rockchip,rk3288-pmu-sram"
-- reg : physical base address and the size of the registers window
-
-Example:
-	sram@ff720000 {
-		compatible = "rockchip,rk3288-pmu-sram", "mmio-sram";
-		reg = <0xff720000 0x1000>;
-	};
Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

RFC PATCH 2/2 dt-bindings: sram: fix yaml warnings for rk3288-pmu-sram compatible nodes

A test with the command below gives for example these warnings:

arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff720000:
'#address-cells' is a required property arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff720000:
'#size-cells' is a required property arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff720000:
'ranges' is a required property

Fix this error by making '#address-cells', '#size-cells' and 'ranges' required for all compatible strings except for 'rockchip,rk3288-pmu-sram'.

make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sram/sram.yaml

---
 Documentation/devicetree/bindings/sram/sram.yaml | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/sram/sram.yaml +12 -3
index 7b83cc6c9..f06d254ba 100644
@@ -118,9 +118,18 @@ patternProperties:
 required:
   - compatible
   - reg
-  - "#address-cells"
-  - "#size-cells"
-  - ranges
+
+if:
+  properties:
+    compatible:
+      contains:
+        const: rockchip,rk3288-pmu-sram
+
+else:
+  required:
+    - "#address-cells"
+    - "#size-cells"
+    - ranges
 
 additionalProperties: false
 
Signature · 1 line
2.11.0
maintainer
#2 lore raw
In reply to Johan Jonker
Quoted 20 lines · Johan Jonker

Current dts files with 'rockchip-pmu-sram' compatible nodes are manually verified. In order to automate this process rockchip-pmu-sram.txt has to be converted to yaml.

A check with the command below gives for example this error:

arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff700000:
compatible:0:
'rockchip,rk3288-pmu-sram' was expected arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff700000:
compatible:
['mmio-sram'] is too short

Fix this error by adding an extra 'mmio-sram' compatible and 'if then' structure to filter yaml warnings.

make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sram/ rockchip-pmu-sram.yaml

Quoted 8 lines
---
 .../devicetree/bindings/sram/rockchip-pmu-sram.txt | 16 --------
 .../bindings/sram/rockchip-pmu-sram.yaml           | 46 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 16 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt
 create mode 100644 Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml

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

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sram/rockchip-pmu-sram.example.dt.yaml: sram@ff720000: '#address-cells' is a required property /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sram/rockchip-pmu-sram.example.dt.yaml: sram@ff720000: '#size-cells' is a required property /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sram/rockchip-pmu-sram.example.dt.yaml: sram@ff720000: 'ranges' is a required property

See https://patchwork.ozlabs.org/patch/1256661
Please check and re-submit.

#3 lore raw
In reply to Johan Jonker
Quoted 14 lines · Johan Jonker

Current dts files with 'rockchip-pmu-sram' compatible nodes are manually verified. In order to automate this process rockchip-pmu-sram.txt has to be converted to yaml.

A check with the command below gives for example this error:

arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff700000:
compatible:0:
'rockchip,rk3288-pmu-sram' was expected arch/arm/boot/dts/rk3288-evb-act8846.dt.yaml: sram@ff700000:
compatible:
['mmio-sram'] is too short

Quoted 2 lines

Fix this error by adding an extra 'mmio-sram' compatible and 'if then' structure to filter yaml warnings.

Seems to me you should fix the .dts file. If we adjust schemas to make dts files pass, then what is the point of the schemas?

Quoted 3 lines

make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sram/ rockchip-pmu-sram.yaml

Until recent changes in linux-next now, this is not sufficient as all examples are not checked against all schemas.

Quoted 50 lines
---
 .../devicetree/bindings/sram/rockchip-pmu-sram.txt | 16 --------
 .../bindings/sram/rockchip-pmu-sram.yaml           | 46 ++++++++++++++++++++++
 2 files changed, 46 insertions(+), 16 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt
 create mode 100644 Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml
Documentation/devicetree/bindings/sram/rockchip-pmu-sram.txt deleted +0 -16
deleted file mode 100644
index 6b42fda30..000000000
@@ -1,16 +0,0 @@
-Rockchip SRAM for pmu:
-------------------------------
-
-The sram of pmu is used to store the function of resume from maskrom(the 1st
-level loader). This is a common use of the "pmu-sram" because it keeps power
-even in low power states in the system.
-
-Required node properties:
-- compatible : should be "rockchip,rk3288-pmu-sram"
-- reg : physical base address and the size of the registers window
-
-Example:
-       sram@ff720000 {
-               compatible = "rockchip,rk3288-pmu-sram", "mmio-sram";
-               reg = <0xff720000 0x1000>;
-       };
Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml new file +14 -0
new file mode 100644
index 000000000..bb72e4f53
@@ -0,0 +1,46 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sram/rockchip-pmu-sram.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip SRAM for pmu
+
+description:
+  The sram of pmu is used to store the function of resume from maskrom(the 1st
+  level loader). This is a common use of the "pmu-sram" because it keeps power
+  even in low power states in the system.
+
+maintainers:

Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml new file +10 -0
+  - Heiko Stuebner <[email protected]>
+
+# The extra 'mmio-sram' compatible and 'if then' structure is needed
+# to filter yaml warnings.
+properties:
+  compatible:
+    oneOf:
+      - const: mmio-sram
+      - items:
+        - const: rockchip,rk3288-pmu-sram

We've been just adding the compatibles to the common sram.yaml for the simple cases like this.

Quoted 25 lines
Documentation/devicetree/bindings/sram/rockchip-pmu-sram.yaml new file +22 -1
+        - const: mmio-sram
+
+  reg:
+    maxItems: 1
+
+if:
+  properties:
+    compatible:
+      contains:
+        const: rockchip,rk3288-pmu-sram
+
+then:
+  required:
+    - compatible
+    - reg
+
+examples:
+  - |
+    pmu_sram: sram@ff720000 {
+      compatible = "rockchip,rk3288-pmu-sram", "mmio-sram";
+      reg = <0xff720000 0x1000>;
+    };
--

2.11.0