Skip to contentSkip to conversation

dt-bindings: spi: convert spi-jcore to dtschema

PATCH Superseded Kousik Sanagavarapu 2 participants 2 messages Mar 21, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: spi: convert spi-jcore to dtschema

Convert existing bindings of J-Core spi2 to dtschema. No new properties are added.

---
 .../devicetree/bindings/spi/jcore,spi.txt     | 34 -----------
 .../devicetree/bindings/spi/jcore,spi.yaml    | 60 +++++++++++++++++++
 2 files changed, 60 insertions(+), 34 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/spi/jcore,spi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/jcore,spi.yaml
Documentation/devicetree/bindings/spi/jcore,spi.txt deleted +0 -34
deleted file mode 100644
index 93936d16e139..000000000000
@@ -1,34 +0,0 @@
-J-Core SPI master
-
-Required properties:
-
-- compatible: Must be "jcore,spi2".
-
-- reg: Memory region for registers.
-
-- #address-cells: Must be 1.
-
-- #size-cells: Must be 0.
-
-Optional properties:
-
-- clocks: If a phandle named "ref_clk" is present, SPI clock speed
-  programming is relative to the frequency of the indicated clock.
-  Necessary only if the input clock rate is something other than a
-  fixed 50 MHz.
-
-- clock-names: Clock names, one for each phandle in clocks.
-
-See spi-bus.txt for additional properties not specific to this device.
-
-Example:
-
-spi@40 {
-	compatible = "jcore,spi2";
-	#address-cells = <1>;
-	#size-cells = <0>;
-	reg = <0x40 0x8>;
-	spi-max-frequency = <25000000>;
-	clocks = <&bus_clk>;
-	clock-names = "ref_clk";
-}
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.44.0.273.g4bc5b65358.dirty
#1 lore raw
Quoted 2 lines · Kousik Sanagavarapu

Convert existing bindings of J-Core spi2 to dtschema. No new properties are added.

Subject:
spi: dt-bindings: jcore,spi:

Quoted 17 lines
---
 .../devicetree/bindings/spi/jcore,spi.txt     | 34 -----------
 .../devicetree/bindings/spi/jcore,spi.yaml    | 60 +++++++++++++++++++
 2 files changed, 60 insertions(+), 34 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/spi/jcore,spi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/jcore,spi.yaml
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +0 -0
new file mode 100644
index 000000000000..e76775bb68d4

Documentation/devicetree/bindings/spi/jcore,spi.yaml line 10

Quoted 10 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +10 -0
@@ -0,0 +1,60 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/spi/jcore,spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: J-Core SPI controller
+
+description: |

Do not need '|' unless you need to preserve formatting.

Quoted 16 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +16 -0
+  The J-Core "spi2" device is a PIO-based SPI controller which used to
+  perform byte-at-a-time transfers between the CPU and itself.
+
+maintainers:
+  - Kousik Sanagavarapu <[email protected]>
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
+    const: jcore,spi2
+
+  reg:
+    maxItems: 1
+

Documentation/devicetree/bindings/spi/jcore,spi.yaml line 36

Quoted 10 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +10 -0
+  clocks:
+    description:
+      If a phandle named "ref_clk" is present, SPI clock speed
+      programming is relative to the frequency of the indicated clock.
+      Necessary only if the input clock rate is something other than a
+      fixed 50 MHz.
+
+  clock-names:
+    description:
+      Clock names, one for each phandle in clocks.

Drop description, but instead provide a name. See existing code.

Documentation/devicetree/bindings/spi/jcore,spi.yaml line 39

Quoted 3 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +3 -0
+
+  "#address-cells":
+    const: 1

Drop

Documentation/devicetree/bindings/spi/jcore,spi.yaml line 42

Quoted 3 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +3 -0
+
+  "#size-cells":
+    const: 0

Drop

Please do not write bindings in entirely different way than existing ones are written. Open existing recent bindings and look there.

Documentation/devicetree/bindings/spi/jcore,spi.yaml line 48

Quoted 6 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +6 -0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: true

This cannot be true. From which existing code did you take it? What you need here is unevaluatedProperties: false.

Documentation/devicetree/bindings/spi/jcore,spi.yaml line 56

Quoted 8 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +8 -0
+
+examples:
+  - |
+    spi@40 {
+      compatible = "jcore,spi2";
+      #address-cells = <1>;
+      #size-cells = <0>;
+      reg = <0x40 0x8>;

Keep reg the second property.

Documentation/devicetree/bindings/spi/jcore,spi.yaml line 60

Quoted 4 lines
Documentation/devicetree/bindings/spi/jcore,spi.yaml new file +4 -0
+      spi-max-frequency = <25000000>;
+      clocks = <&bus_clk>;
+      clock-names = "ref_clk";
+    };

Best regards,
Krzysztof