Devicetree
 help / color / mirror / Atom feed
* [PATCH v3 2/2] dt-bindings: net: can: fsl,mpc5xxx-mscan: Convert to DT schema
@ 2026-09-14  9:04 Quchaosheng
  2026-09-14  9:15 ` sashiko-bot
  2026-09-16  1:58 ` [PATCH v6] " Quchaosheng
  0 siblings, 2 replies; 4+ messages in thread
From: Quchaosheng @ 2026-09-14  9:04 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-can, devicetree, quchaosheng000406

Convert the Freescale MPC5xxx MSCAN binding from free-form text to DT
schema.

Describe fsl,mpc5200-mscan and fsl,mpc5121-mscan in separate sections, as
the original text does. fsl,mpc5200-mscan accepts "ip" and "ref" for
fsl,mscan-clock-source, fsl,mpc5121-mscan also accepts "sys". Enforce both
with an if/then block on the compatible string.

Add "fsl,mpc5200b-mscan" as a fallback of "fsl,mpc5200-mscan", as
mpc5200b.dtsi uses it.

Document clocks and clock-names. The MPC5121 driver looks up the "ipg",
"ips", "sys", "ref" and "mclk" clocks by name, and mpc5121.dtsi provides
all five. The original text did not describe them.

Keep the note about MPC5121 Rev. 1.

Signed-off-by: Quchaosheng <quchaosheng000406@163.com>
---
v2:
 - Add "fsl,mpc5200b-mscan" as a fallback compatible.

 - Document clocks and clock-names.

v3:
 - Split fsl,mscan-clock-source by compatible string, following the
   separate sections in the original text. "sys" applies to
   fsl,mpc5121-mscan only.

 - Rewrite the commit message in imperative mood.
---
---
 .../bindings/net/can/fsl,mpc5xxx-mscan.yaml   | 114 ++++++++++++++++++
 .../bindings/net/can/mpc5xxx-mscan.txt        |  53 --------
 2 files changed, 114 insertions(+), 53 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/fsl,mpc5xxx-mscan.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/can/mpc5xxx-mscan.txt

diff --git a/Documentation/devicetree/bindings/net/can/fsl,mpc5xxx-mscan.yaml b/Documentation/devicetree/bindings/net/can/fsl,mpc5xxx-mscan.yaml
new file mode 100644
index 000000000..277e78ca2
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/can/fsl,mpc5xxx-mscan.yaml
@@ -0,0 +1,114 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/fsl,mpc5xxx-mscan.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale MPC5xxx MSCAN controller
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+description:
+  The MSCAN controller found on the Freescale MPC5200 and MPC5121 SoCs. The
+  MPC5121 Rev. 1 processor is not supported.
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - fsl,mpc5200b-mscan
+          - const: fsl,mpc5200-mscan
+      - enum:
+          - fsl,mpc5200-mscan
+          - fsl,mpc5121-mscan
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    description:
+      Clocks feeding the controller. On MPC5121 the driver looks up the
+      "ipg", "ips", "sys", "ref" and "mclk" clocks by name.
+    maxItems: 5
+
+  clock-names:
+    items:
+      - const: ipg
+      - const: ips
+      - const: sys
+      - const: ref
+      - const: mclk
+
+  fsl,mscan-clock-source:
+    description:
+      Clock source used for the controller.
+    enum: [ip, ref, sys]
+
+  fsl,mscan-clock-divider:
+    description: Additional clock divider for the reference and system clocks.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    default: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+allOf:
+  - $ref: can-controller.yaml#
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: fsl,mpc5200-mscan
+    then:
+      properties:
+        fsl,mscan-clock-source:
+          description:
+            Clock source used for the controller. "ref" is the default when
+            the property is not present.
+          enum: [ip, ref]
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: fsl,mpc5121-mscan
+    then:
+      properties:
+        fsl,mscan-clock-source:
+          description:
+            Clock source used for the controller. When the property is not
+            present, an optimal clock source and frequency based on the
+            system clock is selected. If this is not possible, the reference
+            clock is used.
+          enum: [ip, ref, sys]
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    can@1300 {
+        compatible = "fsl,mpc5121-mscan";
+        reg = <0x1300 0x80>;
+        interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
+        interrupt-parent = <&ipic>;
+    };
+
+    can@1380 {
+        compatible = "fsl,mpc5121-mscan";
+        reg = <0x1380 0x80>;
+        interrupts = <13 IRQ_TYPE_LEVEL_LOW>;
+        interrupt-parent = <&ipic>;
+        fsl,mscan-clock-source = "ref";
+        fsl,mscan-clock-divider = <3>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/net/can/mpc5xxx-mscan.txt b/Documentation/devicetree/bindings/net/can/mpc5xxx-mscan.txt
deleted file mode 100644
index 2fa4fcd38..000000000
--- a/Documentation/devicetree/bindings/net/can/mpc5xxx-mscan.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-CAN Device Tree Bindings
-------------------------
-
-(c) 2006-2009 Secret Lab Technologies Ltd
-Grant Likely <grant.likely@secretlab.ca>
-
-fsl,mpc5200-mscan nodes
------------------------
-In addition to the required compatible-, reg- and interrupt-properties, you can
-also specify which clock source shall be used for the controller:
-
-- fsl,mscan-clock-source : a string describing the clock source. Valid values
-			   are:	"ip" for ip bus clock
-				 "ref" for reference clock (XTAL)
-			   "ref" is default in case this property is not
-			   present.
-
-fsl,mpc5121-mscan nodes
------------------------
-In addition to the required compatible-, reg- and interrupt-properties, you can
-also specify which clock source and divider shall be used for the controller:
-
-- fsl,mscan-clock-source : a string describing the clock source. Valid values
-			   are:	"ip" for ip bus clock
-				"ref" for reference clock
-				"sys" for system clock
-			   If this property is not present, an optimal CAN
-			   clock source and frequency based on the system
-			   clock will be selected. If this is not possible,
-			   the reference clock will be used.
-
-- fsl,mscan-clock-divider: for the reference and system clock, an additional
-			   clock divider can be specified. By default, a
-			   value of 1 is used.
-
-Note that the MPC5121 Rev. 1 processor is not supported.
-
-Examples:
-	can@1300 {
-		compatible = "fsl,mpc5121-mscan";
-		interrupts = <12 0x8>;
-		interrupt-parent = <&ipic>;
-		reg = <0x1300 0x80>;
-	};
-
-	can@1380 {
-		compatible = "fsl,mpc5121-mscan";
-		interrupts = <13 0x8>;
-		interrupt-parent = <&ipic>;
-		reg = <0x1380 0x80>;
-		fsl,mscan-clock-source = "ref";
-		fsl,mscan-clock-divider = <3>;
-	};
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-21 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14  9:04 [PATCH v3 2/2] dt-bindings: net: can: fsl,mpc5xxx-mscan: Convert to DT schema Quchaosheng
2026-09-14  9:15 ` sashiko-bot
2026-09-16  1:58 ` [PATCH v6] " Quchaosheng
2026-09-21 17:47   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox