Skip to contentSkip to conversation

dt-bindings: net: can: atmel: Convert to json schema

PATCH Superseded Charan Pedumuru 4 participants 7 messages Sep 12, 2024 – Sep 30, 2024

Subsystems (5)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: net: can: atmel: Convert to json schema

Convert atmel-can documentation to yaml format

---
 .../bindings/net/can/atmel,at91sam9263-can.yaml    | 67 ++++++++++++++++++++++
 .../devicetree/bindings/net/can/atmel-can.txt      | 15 -----
 2 files changed, 67 insertions(+), 15 deletions(-)
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +67 -0
new file mode 100644
index 000000000000..269af4c993a7
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/atmel,at91sam9263-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel CAN Controller
+
+maintainers:
+  - Nicolas Ferre <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - atmel,at91sam9263-can
+          - atmel,at91sam9x5-can
+          - microchip,sam9x60-can
+      - items:
+          - enum:
+              - microchip,sam9x60-can
+          - const: atmel,at91sam9x5-can
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: can_clk
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - microchip,sam9x60-can
+    then:
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - clocks
+        - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    can0: can@f000c000 {
+          compatible = "atmel,at91sam9x5-can";
+          reg = <0xf000c000 0x300>;
+          interrupts = <30 IRQ_TYPE_LEVEL_HIGH 3>;
+    };
Documentation/devicetree/bindings/net/can/atmel-can.txt deleted +0 -15
deleted file mode 100644
index 218a3b3eb27e..000000000000
@@ -1,15 +0,0 @@
-* AT91 CAN *
-
-Required properties:
-  - compatible: Should be "atmel,at91sam9263-can", "atmel,at91sam9x5-can" or
-    "microchip,sam9x60-can"
-  - reg: Should contain CAN controller registers location and length
-  - interrupts: Should contain IRQ line for the CAN controller
-
-Example:
-
-	can0: can@f000c000 {
-		compatible = "atmel,at91sam9x5-can";
-		reg = <0xf000c000 0x300>;
-		interrupts = <40 4 5>
-	};

---
base-commit: 32ffa5373540a8d1c06619f52d019c6cdc948bb4
change-id: 20240912-can-8eb7f8e7566d

Best regards,

Signature · 1 line
Charan Pedumuru <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Charan Pedumuru

Convert atmel-can documentation to yaml format

Quoted 105 lines
---
  .../bindings/net/can/atmel,at91sam9263-can.yaml    | 67 ++++++++++++++++++++++
  .../devicetree/bindings/net/can/atmel-can.txt      | 15 -----
  2 files changed, 67 insertions(+), 15 deletions(-)
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +67 -0
new file mode 100644
index 000000000000..269af4c993a7
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/atmel,at91sam9263-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel CAN Controller
+
+maintainers:
+  - Nicolas Ferre <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - atmel,at91sam9263-can
+          - atmel,at91sam9x5-can
+          - microchip,sam9x60-can
+      - items:
+          - enum:
+              - microchip,sam9x60-can
+          - const: atmel,at91sam9x5-can
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: can_clk
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - microchip,sam9x60-can
+    then:
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - clocks
+        - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    can0: can@f000c000 {
+          compatible = "atmel,at91sam9x5-can";
+          reg = <0xf000c000 0x300>;
+          interrupts = <30 IRQ_TYPE_LEVEL_HIGH 3>;
+    };
Documentation/devicetree/bindings/net/can/atmel-can.txt deleted +0 -16
deleted file mode 100644
index 218a3b3eb27e..000000000000
@@ -1,15 +0,0 @@
-* AT91 CAN *
-
-Required properties:
-  - compatible: Should be "atmel,at91sam9263-can", "atmel,at91sam9x5-can" or
-    "microchip,sam9x60-can"
-  - reg: Should contain CAN controller registers location and length
-  - interrupts: Should contain IRQ line for the CAN controller
-
-Example:
-
-	can0: can@f000c000 {
-		compatible = "atmel,at91sam9x5-can";
-		reg = <0xf000c000 0x300>;
-		interrupts = <40 4 5>
-	};
 
---

base-commit: 32ffa5373540a8d1c06619f52d019c6cdc948bb4
change-id: 20240912-can-8eb7f8e7566d

Best regards,

Signature · 2 lines
With Best Regards,
Dharma B.
#2 lore raw
In reply to Charan Pedumuru
Quoted 3 lines · Charan Pedumuru

Convert atmel-can documentation to yaml format

Please see the comments I left on the internal v2 of this patch.

Thanks,
Conor.

Quoted 108 lines
---
 .../bindings/net/can/atmel,at91sam9263-can.yaml    | 67 ++++++++++++++++++++++
 .../devicetree/bindings/net/can/atmel-can.txt      | 15 -----
 2 files changed, 67 insertions(+), 15 deletions(-)
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +67 -0
new file mode 100644
index 000000000000..269af4c993a7
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/atmel,at91sam9263-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel CAN Controller
+
+maintainers:
+  - Nicolas Ferre <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - atmel,at91sam9263-can
+          - atmel,at91sam9x5-can
+          - microchip,sam9x60-can
+      - items:
+          - enum:
+              - microchip,sam9x60-can
+          - const: atmel,at91sam9x5-can
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: can_clk
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - microchip,sam9x60-can
+    then:
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - clocks
+        - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    can0: can@f000c000 {
+          compatible = "atmel,at91sam9x5-can";
+          reg = <0xf000c000 0x300>;
+          interrupts = <30 IRQ_TYPE_LEVEL_HIGH 3>;
+    };
Documentation/devicetree/bindings/net/can/atmel-can.txt deleted +0 -16
deleted file mode 100644
index 218a3b3eb27e..000000000000
@@ -1,15 +0,0 @@
-* AT91 CAN *
-
-Required properties:
-  - compatible: Should be "atmel,at91sam9263-can", "atmel,at91sam9x5-can" or
-    "microchip,sam9x60-can"
-  - reg: Should contain CAN controller registers location and length
-  - interrupts: Should contain IRQ line for the CAN controller
-
-Example:
-
-	can0: can@f000c000 {
-		compatible = "atmel,at91sam9x5-can";
-		reg = <0xf000c000 0x300>;
-		interrupts = <40 4 5>
-	};
 
---

base-commit: 32ffa5373540a8d1c06619f52d019c6cdc948bb4
change-id: 20240912-can-8eb7f8e7566d

Best regards,

Signature · 1 line
Charan Pedumuru <[email protected]>
#3 lore raw
In reply to Charan Pedumuru
Quoted 22 lines · Charan Pedumuru

Convert atmel-can documentation to yaml format

---
 .../bindings/net/can/atmel,at91sam9263-can.yaml    | 67 ++++++++++++++++++++++
 .../devicetree/bindings/net/can/atmel-can.txt      | 15 -----
 2 files changed, 67 insertions(+), 15 deletions(-)
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +8 -0
new file mode 100644
index 000000000000..269af4c993a7
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/atmel,at91sam9263-can.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel CAN Controller
+

Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +10 -0
+maintainers:
+  - Nicolas Ferre <[email protected]>
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - atmel,at91sam9263-can
+          - atmel,at91sam9x5-can
+          - microchip,sam9x60-can

The driver doesn't have a compatible for "microchip,sam9x60-can".

Quoted 28 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +28 -0
+      - items:
+          - enum:
+              - microchip,sam9x60-can
+          - const: atmel,at91sam9x5-can
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: can_clk
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:

Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml line 56

Quoted 10 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +10 -0
+          contains:
+            enum:
+              - microchip,sam9x60-can
+    then:
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - clocks
+        - clock-names

AFAICS clock-names is required for all compatibles.

Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml line 63

Quoted 7 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +7 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    can0: can@f000c000 {

I think unused labels should be removed.

Quoted 30 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +4 -0
+          compatible = "atmel,at91sam9x5-can";
+          reg = <0xf000c000 0x300>;
+          interrupts = <30 IRQ_TYPE_LEVEL_HIGH 3>;
+    };
Documentation/devicetree/bindings/net/can/atmel-can.txt deleted +0 -16
deleted file mode 100644
index 218a3b3eb27e..000000000000
@@ -1,15 +0,0 @@
-* AT91 CAN *
-
-Required properties:
-  - compatible: Should be "atmel,at91sam9263-can", "atmel,at91sam9x5-can" or
-    "microchip,sam9x60-can"
-  - reg: Should contain CAN controller registers location and length
-  - interrupts: Should contain IRQ line for the CAN controller
-
-Example:
-
-	can0: can@f000c000 {
-		compatible = "atmel,at91sam9x5-can";
-		reg = <0xf000c000 0x300>;
-		interrupts = <40 4 5>
-	};
 
---

base-commit: 32ffa5373540a8d1c06619f52d019c6cdc948bb4
change-id: 20240912-can-8eb7f8e7566d

Quoted 6 lines

Best regards,

Signature · 1 line
Charan Pedumuru <[email protected]>

Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
#4 lore raw
Quoted 26 lines · Marc Kleine-Budde
Quoted 25 lines · Charan Pedumuru

Convert atmel-can documentation to yaml format

---
  .../bindings/net/can/atmel,at91sam9263-can.yaml    | 67 ++++++++++++++++++++++
  .../devicetree/bindings/net/can/atmel-can.txt      | 15 -----
  2 files changed, 67 insertions(+), 15 deletions(-)
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +11 -0
new file mode 100644
index 000000000000..269af4c993a7
@@ -0,0 +1,67 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:http://devicetree.org/schemas/net/can/atmel,at91sam9263-can.yaml#
+$schema:http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel CAN Controller
+
+maintainers:
+  - Nicolas Ferre<[email protected]>
+
Quoted 8 lines

Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml line 18

Quoted 7 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +7 -0
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - atmel,at91sam9263-can
+          - atmel,at91sam9x5-can
+          - microchip,sam9x60-can

The driver doesn't have a compatible for "microchip,sam9x60-can".

Yes, I will remove it.

Quoted 32 lines
Quoted 32 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +31 -0
+      - items:
+          - enum:
+              - microchip,sam9x60-can
+          - const: atmel,at91sam9x5-can
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    items:
+      - const: can_clk
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - microchip,sam9x60-can
Quoted 8 lines

Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml line 56

Quoted 7 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +7 -0
+    then:
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - clocks
+        - clock-names

AFAICS clock-names is required for all compatibles.

In our case only sam9x60 is using clock-names property.

Quoted 9 lines

Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml line 63

Quoted 8 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +7 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    can0: can@f000c000 {

I think unused labels should be removed.

Ok, I will remove the labels in next revision. Thanks.

Quoted 38 lines
Quoted 31 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +4 -0
+          compatible = "atmel,at91sam9x5-can";
+          reg = <0xf000c000 0x300>;
+          interrupts = <30 IRQ_TYPE_LEVEL_HIGH 3>;
+    };
Documentation/devicetree/bindings/net/can/atmel-can.txt deleted +0 -16
deleted file mode 100644
index 218a3b3eb27e..000000000000
@@ -1,15 +0,0 @@
-* AT91 CAN *
-
-Required properties:
-  - compatible: Should be "atmel,at91sam9263-can", "atmel,at91sam9x5-can" or
-    "microchip,sam9x60-can"
-  - reg: Should contain CAN controller registers location and length
-  - interrupts: Should contain IRQ line for the CAN controller
-
-Example:
-
-	can0: can@f000c000 {
-		compatible = "atmel,at91sam9x5-can";
-		reg = <0xf000c000 0x300>;
-		interrupts = <40 4 5>
-	};
 
---

base-commit: 32ffa5373540a8d1c06619f52d019c6cdc948bb4
change-id: 20240912-can-8eb7f8e7566d

Quoted 6 lines

Best regards,

Signature · 1 line
Charan Pedumuru<[email protected]>

Marc

Signature · 2 lines
Best Regards,
Charan.
#5 lore raw
Quoted 15 lines · On 20.09.2024 04:51:57, [email protected] wrote:
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +15 -0
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - microchip,sam9x60-can
+    then:
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - clocks
+        - clock-names
Quoted 2 lines
Quoted 1 line

AFAICS clock-names is required for all compatibles.

In our case only sam9x60 is using clock-names property.

No, the driver uses "clk_get(&pdev->dev, "can_clk")", so this property is mandatory.

regards,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |
#6 lore raw
Quoted 16 lines · Marc Kleine-Budde
Quoted 15 lines · On 20.09.2024 04:51:57,[email protected] wrote:
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/net/can/atmel,at91sam9263-can.yaml new file +15 -0
+allOf:
+  - $ref: can-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - microchip,sam9x60-can
+    then:
+      required:
+        - compatible
+        - reg
+        - interrupts
+        - clocks
+        - clock-names
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

AFAICS clock-names is required for all compatibles.

In our case only sam9x60 is using clock-names property.

No, the driver uses "clk_get(&pdev->dev, "can_clk")", so this property is mandatory.

Yes, what you said was correct, it was our mistake. I will remove the if statements and make
clocks and clock-names as default required properties. I will fix this in next revision.

Quoted 8 lines

regards,
Marc

-- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux |
https://www.pengutronix.de | Vertretung Nürnberg | Phone:
+49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax:
+49-5121-206917-9 |

Signature · 2 lines
Best Regards,
Charan.