[PATCH 02/10] dt-bindings: net: can: grcan: Convert GRCAN CAN controllers binding from txt to YAML

Arun Muthusamy posted 10 patches 1 week, 6 days ago
[PATCH 02/10] dt-bindings: net: can: grcan: Convert GRCAN CAN controllers binding from txt to YAML
Posted by Arun Muthusamy 1 week, 6 days ago
Migrate device tree bindings for Gaisler GRCAN, GRHCAN
and GRCANFD CAN controllers from a text format to YAML format.
    - Add properties such as `compatible`, `reg`, `interrupts`
    and `clocks` for the CAN controllers.
    - Removal of the old `grcan.txt` file as its contents have
    been fully migrated to the YAML file.
    - YAML file includes examples of device tree bindings for
    the CAN controllers

Signed-off-by: Arun Muthusamy <arun.muthusamy@gaisler.com>
---
 .../bindings/net/can/gaisler,grcan.yaml       | 85 +++++++++++++++++++
 .../devicetree/bindings/net/can/grcan.txt     | 28 ------
 2 files changed, 85 insertions(+), 28 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/can/grcan.txt

diff --git a/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml b/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
new file mode 100644
index 000000000000..521bdd89f130
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/gaisler,grcan.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title:
+  Aeroflex Gaisler GRCAN, GRHCAN and GRCANFD CAN controllers.
+
+description: |
+  GRCAN, GRCANFD, GRHCAN controllers are available in the GRLIB VHDL IP core
+  library.
+
+  For further information look in the documentation for the GRLIB IP library:
+  https://download.gaisler.com/products/GRLIB/doc/grip.pdf
+
+maintainers:
+  - Arun Muthusamy <arun.muthusamy@gaisler.com>
+  - Andreas Larsson <andreas@gaisler.com>
+
+allOf:
+  - $ref: can-controller.yaml#
+
+properties:
+  compatible:
+    enum:
+      - gaisler,grcan
+      - gaisler,grcanfd
+  name:
+    description: |
+      Fallback on node name matching for systems that don't provide compatible.
+    enum:
+      - GAISLER_GRCAN
+      - 01_03d
+      - GAISLER_GRHCAN
+      - "01_034"
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  freq:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Frequency of the external oscillator clock in Hz (the frequency of the
+      amba bus in the ordinary case).
+      This property should be used by systems that utilize the common clock
+      framework is not supported.
+
+unevaluatedProperties: false
+
+required:
+  - reg
+  - interrupts
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    can@ff400000 {
+        compatible = "gaisler,grcanfd";
+        clocks = <&sysclock>;
+        reg = <0xff400000 0x400>;
+        interrupt-parent = <&plic0>;
+        interrupts = <6>;
+    };
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    can@ff400000 {
+        compatible = "gaisler,grcan";
+        clocks = <&sysclock>;
+        reg = <0xff400000 0x400>;
+        interrupt-parent = <&plic0>;
+        interrupts = <6>;
+    };
+  - |
+    GAISLER_GRCAN@ff840000 {
+        reg = <0xff840000 0x400>;
+        freq = <50000000>;
+        interrupts = <16>;
+    };
diff --git a/Documentation/devicetree/bindings/net/can/grcan.txt b/Documentation/devicetree/bindings/net/can/grcan.txt
deleted file mode 100644
index 34ef3498f887..000000000000
--- a/Documentation/devicetree/bindings/net/can/grcan.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-Aeroflex Gaisler GRCAN and GRHCAN CAN controllers.
-
-The GRCAN and CRHCAN CAN controllers are available in the GRLIB VHDL IP core
-library.
-
-Note: These properties are built from the AMBA plug&play in a Leon SPARC system
-(the ordinary environment for GRCAN and GRHCAN). There are no dts files for
-sparc.
-
-Required properties:
-
-- name : Should be "GAISLER_GRCAN", "01_03d", "GAISLER_GRHCAN" or "01_034"
-
-- reg : Address and length of the register set for the device
-
-- freq : Frequency of the external oscillator clock in Hz (the frequency of
-	the amba bus in the ordinary case)
-
-- interrupts : Interrupt number for this device
-
-Optional properties:
-
-- systemid : If not present or if the value of the least significant 16 bits
-	of this 32-bit property is smaller than GRCAN_TXBUG_SAFE_GRLIB_VERSION
-	a bug workaround is activated.
-
-For further information look in the documentation for the GLIB IP core library:
-http://www.gaisler.com/products/grlib/grip.pdf
-- 
2.51.0
Re: [PATCH 02/10] dt-bindings: net: can: grcan: Convert GRCAN CAN controllers binding from txt to YAML
Posted by Krzysztof Kozlowski 1 week, 6 days ago
On 18/11/2025 10:21, Arun Muthusamy wrote:
> Migrate device tree bindings for Gaisler GRCAN, GRHCAN
> and GRCANFD CAN controllers from a text format to YAML format.
>     - Add properties such as `compatible`, `reg`, `interrupts`

Odd indentation. Please write readable commit msgs.

Also:
1. Why? You need to explain why you are changing binding during conversion.
2. Reg was already there, so I don't understand why you need to add it.


>     and `clocks` for the CAN controllers.
>     - Removal of the old `grcan.txt` file as its contents have
>     been fully migrated to the YAML file.

Drop, that's not relevant.

>     - YAML file includes examples of device tree bindings for
>     the CAN controllers

Drop, not relevant. Please look at git history how commits are written.

> 
> Signed-off-by: Arun Muthusamy <arun.muthusamy@gaisler.com>
> ---
>  .../bindings/net/can/gaisler,grcan.yaml       | 85 +++++++++++++++++++
>  .../devicetree/bindings/net/can/grcan.txt     | 28 ------
>  2 files changed, 85 insertions(+), 28 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
>  delete mode 100644 Documentation/devicetree/bindings/net/can/grcan.txt
> 
> diff --git a/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml b/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
> new file mode 100644
> index 000000000000..521bdd89f130
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
> @@ -0,0 +1,85 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/can/gaisler,grcan.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title:
> +  Aeroflex Gaisler GRCAN, GRHCAN and GRCANFD CAN controllers.
> +
> +description: |
> +  GRCAN, GRCANFD, GRHCAN controllers are available in the GRLIB VHDL IP core
> +  library.
> +
> +  For further information look in the documentation for the GRLIB IP library:
> +  https://download.gaisler.com/products/GRLIB/doc/grip.pdf
> +
> +maintainers:
> +  - Arun Muthusamy <arun.muthusamy@gaisler.com>
> +  - Andreas Larsson <andreas@gaisler.com>
> +
> +allOf:
> +  - $ref: can-controller.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - gaisler,grcan
> +      - gaisler,grcanfd

Blank line

> +  name:
> +    description: |

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

> +      Fallback on node name matching for systems that don't provide compatible.
> +    enum:
> +      - GAISLER_GRCAN
> +      - 01_03d
> +      - GAISLER_GRHCAN
> +      - "01_034"

This does not really work. Are you really defining here "name" property?

> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +  freq:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: |
> +      Frequency of the external oscillator clock in Hz (the frequency of the
> +      amba bus in the ordinary case).
> +      This property should be used by systems that utilize the common clock
> +      framework is not supported.

Missing systemid. Your commit msg must explain any changes done to the
binding during conversion.

> +
> +unevaluatedProperties: false

This goes after required block.

> +
> +required:

compatible as well

> +  - reg
> +  - interrupts

Where is freq? It was required in the old binding. Again, you need to
explain the changes.

> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    can@ff400000 {
> +        compatible = "gaisler,grcanfd";
> +        clocks = <&sysclock>;
> +        reg = <0xff400000 0x400>;
> +        interrupt-parent = <&plic0>;
> +        interrupts = <6>;
> +    };

One example is enough

> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +    can@ff400000 {
> +        compatible = "gaisler,grcan";
> +        clocks = <&sysclock>;
> +        reg = <0xff400000 0x400>;
> +        interrupt-parent = <&plic0>;
> +        interrupts = <6>;
> +    };
> +  - |
> +    GAISLER_GRCAN@ff840000 {

Especially no such examples. Please read DTS coding style.

> +        reg = <0xff840000 0x400>;
> +        freq = <50000000>;
> +        interrupts = <16>;
> +    };
> diff --git a/Documentation/devicetree/bindings/net/can/grcan.txt b/Documentation/devicetree/bindings/net/can/grcan.txt
> deleted file mode 100644
> index 34ef3498f887..000000000000
> --- a/Documentation/devicetree/bindings/net/can/grcan.txt
> +++ /dev/null
> @@ -1,28 +0,0 @@
Best regards,
Krzysztof
Re: [PATCH 02/10] dt-bindings: net: can: grcan: Convert GRCAN CAN controllers binding from txt to YAML
Posted by Arun Muthusamy 1 week ago
Hi Krzysztof,

Thank you for your thorough review and insightful questions. I’d like to 
clarify a few points regarding the DT binding and get your guidance.

Node name vs. compatible matching:
SPARC systems do not use DTS files; the device tree is generated by the 
PROM. On LEON (SPARC32), AMBA Plug & Play information creates the DT 
properties, and drivers historically match devices based on node names.
For DTS-based systems such as NOEL, this patch series adds 
compatible-string matching. To reflect this, I updated the $nodename 
pattern to support LEON-style node names:
properties:
   $nodename:
     pattern: "^(GAISLER_GRCAN|01_03d|GAISLER_GRHCAN|01_034)$"
I’d appreciate any suggestions on the preferred way to describe this 
dual matching approach: node name for PROM-based LEON, compatible string 
for DTS-based NOEL.


Freq and Clocks:
The driver needs to support both LEON and NOEL platforms:
LEON: relies on the freq property
NOEL: uses a standard clocks binding
Because of this dual approach, the freq property is no longer required 
in the DTS binding itself.
It is only relevant for LEON/PROM-based systems and is handled 
internally by the driver


Systemid:
The driver now reads systemid directly from /ambapp0, so the property no 
longer needs to be defined in the DTS. The previous documentation was 
outdated and should have been updated after commit:
1e93ed26acf0 ("can: grcan: grcan_probe(): fix broken system id check for 
errata workaround needs")


Thanks,

-- 
BR,

Arun Muthusamy
Software Engineer
Frontgrade Gaisler
T : +46 (0) 700 558 528
arun.muthusamy@gaisler.com

Frontgrade Gaisler AB, Kungsgatan 12, SE-411 19 GÖTEBORG, Sweden.
+46 (0) 31 775 8650, www.gaisler.com

On 18.11.2025 12:01, Krzysztof Kozlowski wrote:
> On 18/11/2025 10:21, Arun Muthusamy wrote:
>> Migrate device tree bindings for Gaisler GRCAN, GRHCAN
>> and GRCANFD CAN controllers from a text format to YAML format.
>>     - Add properties such as `compatible`, `reg`, `interrupts`
> 
> Odd indentation. Please write readable commit msgs.
> 
> Also:
> 1. Why? You need to explain why you are changing binding during 
> conversion.
> 2. Reg was already there, so I don't understand why you need to add it.
> 
> 
>>     and `clocks` for the CAN controllers.
>>     - Removal of the old `grcan.txt` file as its contents have
>>     been fully migrated to the YAML file.
> 
> Drop, that's not relevant.
> 
>>     - YAML file includes examples of device tree bindings for
>>     the CAN controllers
> 
> Drop, not relevant. Please look at git history how commits are written.
> 
>> 
>> Signed-off-by: Arun Muthusamy <arun.muthusamy@gaisler.com>
>> ---
>>  .../bindings/net/can/gaisler,grcan.yaml       | 85 
>> +++++++++++++++++++
>>  .../devicetree/bindings/net/can/grcan.txt     | 28 ------
>>  2 files changed, 85 insertions(+), 28 deletions(-)
>>  create mode 100644 
>> Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
>>  delete mode 100644 
>> Documentation/devicetree/bindings/net/can/grcan.txt
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml 
>> b/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
>> new file mode 100644
>> index 000000000000..521bdd89f130
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/can/gaisler,grcan.yaml
>> @@ -0,0 +1,85 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/net/can/gaisler,grcan.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title:
>> +  Aeroflex Gaisler GRCAN, GRHCAN and GRCANFD CAN controllers.
>> +
>> +description: |
>> +  GRCAN, GRCANFD, GRHCAN controllers are available in the GRLIB VHDL 
>> IP core
>> +  library.
>> +
>> +  For further information look in the documentation for the GRLIB IP 
>> library:
>> +  https://download.gaisler.com/products/GRLIB/doc/grip.pdf
>> +
>> +maintainers:
>> +  - Arun Muthusamy <arun.muthusamy@gaisler.com>
>> +  - Andreas Larsson <andreas@gaisler.com>
>> +
>> +allOf:
>> +  - $ref: can-controller.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - gaisler,grcan
>> +      - gaisler,grcanfd
> 
> Blank line
> 
>> +  name:
>> +    description: |
> 
> Do not need '|' unless you need to preserve formatting.
> 
>> +      Fallback on node name matching for systems that don't provide 
>> compatible.
>> +    enum:
>> +      - GAISLER_GRCAN
>> +      - 01_03d
>> +      - GAISLER_GRHCAN
>> +      - "01_034"
> 
> This does not really work. Are you really defining here "name" 
> property?
> 
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  clocks:
>> +    maxItems: 1
>> +
>> +  freq:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description: |
>> +      Frequency of the external oscillator clock in Hz (the frequency 
>> of the
>> +      amba bus in the ordinary case).
>> +      This property should be used by systems that utilize the common 
>> clock
>> +      framework is not supported.
> 
> Missing systemid. Your commit msg must explain any changes done to the
> binding during conversion.
> 
>> +
>> +unevaluatedProperties: false
> 
> This goes after required block.
> 
>> +
>> +required:
> 
> compatible as well
> 
>> +  - reg
>> +  - interrupts
> 
> Where is freq? It was required in the old binding. Again, you need to
> explain the changes.
> 
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    can@ff400000 {
>> +        compatible = "gaisler,grcanfd";
>> +        clocks = <&sysclock>;
>> +        reg = <0xff400000 0x400>;
>> +        interrupt-parent = <&plic0>;
>> +        interrupts = <6>;
>> +    };
> 
> One example is enough
> 
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    can@ff400000 {
>> +        compatible = "gaisler,grcan";
>> +        clocks = <&sysclock>;
>> +        reg = <0xff400000 0x400>;
>> +        interrupt-parent = <&plic0>;
>> +        interrupts = <6>;
>> +    };
>> +  - |
>> +    GAISLER_GRCAN@ff840000 {
> 
> Especially no such examples. Please read DTS coding style.
> 
>> +        reg = <0xff840000 0x400>;
>> +        freq = <50000000>;
>> +        interrupts = <16>;
>> +    };
>> diff --git a/Documentation/devicetree/bindings/net/can/grcan.txt 
>> b/Documentation/devicetree/bindings/net/can/grcan.txt
>> deleted file mode 100644
>> index 34ef3498f887..000000000000
>> --- a/Documentation/devicetree/bindings/net/can/grcan.txt
>> +++ /dev/null
>> @@ -1,28 +0,0 @@
> Best regards,
> Krzysztof
Re: [PATCH 02/10] dt-bindings: net: can: grcan: Convert GRCAN CAN controllers binding from txt to YAML
Posted by Krzysztof Kozlowski 1 week ago
On 24/11/2025 10:37, Arun Muthusamy wrote:
> Hi Krzysztof,
> 
> Thank you for your thorough review and insightful questions. I’d like to 
> clarify a few points regarding the DT binding and get your guidance.
> 
> Node name vs. compatible matching:

I don't understand what you are referring to. You cut everything and
pasted something, which I have no clue what is that. I read many patches
per day, so you are not helping here to understand the context.

Please do not top-post.

Best regards,
Krzysztof