Thread (6 messages) flat view 6 messages, 3 authors, 4d ago
COOLING4d

[PATCH v2] dt-bindings: net: can: holt,hi3110: Convert to DT schema

From: Quchaosheng <hidden>
Date: 2026-09-14 05:56:35
Also in: linux-can
Subsystem: can network drivers, open firmware and flattened device tree bindings, the rest · Maintainers: Marc Kleine-Budde, Vincent Mailhol, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Linus Torvalds

Convert the Holt HI-311X stand-alone CAN controller binding from
free-form text to DT schema, and reference the common can-controller.yaml
schema.

The controller is connected over SPI, so reference
spi-peripheral-props.yaml as well, otherwise the standard SPI properties
such as spi-max-frequency would be rejected by unevaluatedProperties.

The old text listed clocks as required, but the driver obtains the clock
with devm_clk_get_optional() and falls back to the "clock-frequency"
property when no clock is provided, so either one of the two must be
present and neither is required on its own. This is expressed with an
anyOf block, and clock-frequency is documented, as it was previously
undocumented. The maximum supported clock frequency of 40000000 is
enforced, as that is the limit the driver applies.

unevaluatedProperties is used rather than additionalProperties so that
properties provided by can-controller.yaml remain usable.

Signed-off-by: Quchaosheng <redacted>
---
v2:
 - Reference spi-peripheral-props.yaml. Without it, unevaluatedProperties
   rejected the standard SPI properties, spi-max-frequency among them.
   Reported by Sashiko.

 - Add a maximum of 40000000 to clock-frequency. The description stated
   the limit but did not enforce it. Reported by Sashiko.
---
 .../bindings/net/can/holt,hi311x.yaml         | 81 +++++++++++++++++++
 .../bindings/net/can/holt_hi311x.txt          | 23 ------
 2 files changed, 81 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/holt,hi311x.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/can/holt_hi311x.txt
diff --git a/Documentation/devicetree/bindings/net/can/holt,hi311x.yaml b/Documentation/devicetree/bindings/net/can/holt,hi311x.yaml
new file mode 100644
index 000000000..36497b114
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/can/holt,hi311x.yaml
@@ -0,0 +1,81 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/holt,hi311x.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Holt HI-311X stand-alone CAN controller
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+description:
+  The Holt HI-3110 is a stand-alone CAN controller with an SPI interface.
+
+allOf:
+  - $ref: can-controller.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    const: holt,hi3110
+
+  reg:
+    description: SPI chip select.
+    maxItems: 1
+
+  clocks:
+    description:
+      The clock feeding the CAN controller. If this property is not present
+      clock-frequency must be specified instead.
+    maxItems: 1
+
+  clock-frequency:
+    description:
+      Frequency of the clock feeding the CAN controller, in Hz. Used when
+      no clocks property is provided.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 40000000
+
+  interrupts:
+    description: IRQ line for the CAN controller.
+    maxItems: 1
+
+  vdd-supply:
+    description: Regulator that powers the CAN controller.
+
+  xceiver-supply:
+    description: Regulator that powers the CAN transceiver.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+anyOf:
+  - required:
+      - clocks
+  - required:
+      - clock-frequency
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        can@1 {
+            compatible = "holt,hi3110";
+            reg = <1>;
+            clocks = <&clk32m>;
+            interrupt-parent = <&gpio4>;
+            interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
+            vdd-supply = <&reg5v0>;
+            xceiver-supply = <&reg5v0>;
+        };
+    };
+...
diff --git a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt b/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
deleted file mode 100644
index 3a9926f99..000000000
--- a/Documentation/devicetree/bindings/net/can/holt_hi311x.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-* Holt HI-311X stand-alone CAN controller device tree bindings
-
-Required properties:
- - compatible: Should be one of the following:
-   - "holt,hi3110" for HI-3110
- - reg: SPI chip select.
- - clocks: The clock feeding the CAN controller.
- - interrupts: Should contain IRQ line for the CAN controller.
-
-Optional properties:
- - vdd-supply: Regulator that powers the CAN controller.
- - xceiver-supply: Regulator that powers the CAN transceiver.
-
-Example:
-	can0: can@1 {
-		compatible = "holt,hi3110";
-		reg = <1>;
-		clocks = <&clk32m>;
-		interrupt-parent = <&gpio4>;
-		interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
-		vdd-supply = <&reg5v0>;
-		xceiver-supply = <&reg5v0>;
-	};
-- 
2.43.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help