Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: net: can: convert grcan to DT schema
@ 2026-09-28 11:26 Quchaosheng
  2026-09-28 11:26 ` [PATCH] net: can: grcan: update the binding file reference in the driver comment Quchaosheng
  0 siblings, 1 reply; 4+ messages in thread
From: Quchaosheng @ 2026-09-28 11:26 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: Quchaosheng, linux-can, devicetree, linux-kernel, Oliver Hartkopp

grcan.txt is the only CAN controller binding whose device does not have a
compatible string.  There are no device tree source files for LEON SPARC,
and the nodes are built by the PROM from the AMBA plug&play information,
which carries a core name and a register window but no compatible.  The
driver matches on the node name instead.

It is the last of the five CAN controller bindings that were still written
as free-form text; the other four are posted separately.

A binding without a compatible string is not selected by dtbs_check,
because nodes are matched through their compatible values.  The schema
therefore needs an explicit select on the node name.  This is the same
mechanism ethernet-phy.yaml uses for optional-compatible nodes, and
without it the schema would never be applied to anything.

Two further details are worth pointing out, because the text binding got
them wrong or left them implicit:

  - "systemid" is not a property of the controller node.  The driver and
    arch/sparc/kernel/leon_kernel.c both read it from the "/ambapp0" node,
    so it is described in the description rather than in properties.  The
    binding is stricter than the text file here, and dtbs_check now
    rejects a controller node that carries it.

  - The node name format is "<core name>@<irq>,<address>", as built by
    ambapp_path_component() in arch/sparc/kernel/prom_32.c from the "name"
    and "reg" properties of the AMBA plug&play core.  The select pattern
    and the example follow that format.

The "name" property of the text binding is not described: dtc enforces
that it equals the base node name and then deletes it from the output, so
it never reaches a compiled devicetree.

This binding does not reference can-controller.yaml, unlike the other CAN
controller schemas.  That common schema constrains the node name to
"^can(@.*)?$", which these nodes cannot satisfy -- they are named after
the AMBA plug&play core.  Referencing it makes every valid node fail.

No functional change.  The driver comment is updated by a separate patch.

Assisted-by: LLM
Signed-off-by: Quchaosheng <quchaosheng000406@163.com>

---
 .../bindings/net/can/aeroflexgaisler,grcan.yaml    | 65 ++++++++++++++++++++++
 .../devicetree/bindings/net/can/grcan.txt          | 28 ----------
 2 files changed, 65 insertions(+), 28 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/aeroflexgaisler,grcan.yaml b/Documentation/devicetree/bindings/net/can/aeroflexgaisler,grcan.yaml
new file mode 100644
index 000000000..d5cba5b1b
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/can/aeroflexgaisler,grcan.yaml
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/can/aeroflexgaisler,grcan.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Aeroflex Gaisler GRCAN and GRHCAN CAN controllers
+
+maintainers:
+  - Marc Kleine-Budde <mkl@pengutronix.de>
+
+description: |
+  The GRCAN and GRHCAN CAN controllers are available in the GRLIB VHDL IP
+  core library.
+
+  On a LEON SPARC system there are no device tree source files. The nodes
+  are built by the PROM from the AMBA plug&play information, which does not
+  provide a compatible string. The driver therefore matches on the node
+  name, which is built as "<core name>@<irq>,<address>" from the "name" and
+  "reg" properties of the AMBA plug&play core.
+
+  The GRLIB build ID is not a property of the controller node either. It is
+  read from the "systemid" property of the "/ambapp0" node, and the TX bug
+  workaround is enabled when that property is absent or when its least
+  significant 16 bits are smaller than 4100.
+
+select:
+  properties:
+    $nodename:
+      pattern: '^(01_034|01_03d|GAISLER_GRCAN|GAISLER_GRHCAN)@'
+  required:
+    - $nodename
+
+properties:
+  reg:
+    maxItems: 1
+
+  freq:
+    description:
+      Frequency of the external oscillator clock in Hz, which is the
+      frequency of the AMBA bus in the ordinary case.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  interrupts:
+    maxItems: 1
+    description:
+      Interrupt number of the controller, as built from the AMBA plug&play
+      information.
+
+required:
+  - reg
+  - freq
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    /* AMBA plug&play children are named "<core name>@<irq>,<address>" */
+    GAISLER_GRCAN@c,80000000 {
+        reg = <0x80000000 0x1000>;
+        freq = <40000000>;
+        interrupts = <12>;
+    };
+...
diff --git a/Documentation/devicetree/bindings/net/can/grcan.txt b/Documentation/devicetree/bindings/net/can/grcan.txt
deleted file mode 100644
index 34ef3498f..000000000
--- 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


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

* [PATCH] net: can: grcan: update the binding file reference in the driver comment
  2026-09-28 11:26 [PATCH] dt-bindings: net: can: convert grcan to DT schema Quchaosheng
@ 2026-09-28 11:26 ` Quchaosheng
  2026-09-28 11:31   ` sashiko-bot
  0 siblings, 1 reply; 4+ messages in thread
From: Quchaosheng @ 2026-09-28 11:26 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol; +Cc: Quchaosheng, linux-can, linux-kernel

grcan.txt is replaced by aeroflexgaisler,grcan.yaml.  Point the comment at
the new file.  No functional change.

Assisted-by: LLM
Signed-off-by: Quchaosheng <quchaosheng000406@163.com>

---
 drivers/net/can/grcan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index ce12fa6df..1b4944d1d 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -10,8 +10,8 @@
  * Full documentation of the GRCAN core can be found here:
  * http://www.gaisler.com/products/grlib/grip.pdf
  *
- * See "Documentation/devicetree/bindings/net/can/grcan.txt" for information on
- * open firmware properties.
+ * See "Documentation/devicetree/bindings/net/can/aeroflexgaisler,grcan.yaml"
+ * for information on open firmware properties.
  *
  * See "Documentation/ABI/testing/sysfs-class-net-grcan" for information on the
  * sysfs interface.


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

* Re: [PATCH] net: can: grcan: update the binding file reference in the driver comment
  2026-09-28 11:26 ` [PATCH] net: can: grcan: update the binding file reference in the driver comment Quchaosheng
@ 2026-09-28 11:31   ` sashiko-bot
  2026-09-28 18:18     ` Marc Kleine-Budde
  0 siblings, 1 reply; 4+ messages in thread
From: sashiko-bot @ 2026-09-28 11:31 UTC (permalink / raw)
  To: Quchaosheng
  Cc: linux-can, Marc Kleine-Budde, Oleksij Rempel, Oliver Hartkopp,
	Vincent Mailhol

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] doc: dangling reference to missing yaml binding file
--

commit f19b659d77f11a2ca8192b1defd0f0c8ae4f2108
Author: Quchaosheng <quchaosheng000406@163.com>

net: can: grcan: update the binding file reference in the driver comment

This commit updates the driver comments in grcan.c to point to a new
YAML binding file instead of the old text binding file.

> diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
> index ce12fa6df56d5..1b4944d1d06dd 100644
> --- a/drivers/net/can/grcan.c
> +++ b/drivers/net/can/grcan.c
> @@ -10,8 +10,8 @@
>   * Full documentation of the GRCAN core can be found here:
>   * http://www.gaisler.com/products/grlib/grip.pdf
>   *
> - * See "Documentation/devicetree/bindings/net/can/grcan.txt" for information on
> - * open firmware properties.
> + * See "Documentation/devicetree/bindings/net/can/aeroflexgaisler,grcan.yaml"
> + * for information on open firmware properties.

[Severity: Medium]
Is the actual devicetree binding conversion missing from this patch?

The commit message states that grcan.txt is replaced by
aeroflexgaisler,grcan.yaml, but this patch only updates the comment in
drivers/net/can/grcan.c without adding the new YAML file or removing the
old text file.

Does this leave a dangling reference to a documentation file that does
not actually exist?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260928112658.2119678-2-quchaosheng000406@163.com?part=1

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

* Re: [PATCH] net: can: grcan: update the binding file reference in the driver comment
  2026-09-28 11:31   ` sashiko-bot
@ 2026-09-28 18:18     ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2026-09-28 18:18 UTC (permalink / raw)
  To: sashiko-bot
  Cc: Quchaosheng, linux-can, Oleksij Rempel, Oliver Hartkopp,
	Vincent Mailhol

[-- Attachment #1: Type: text/plain, Size: 558 bytes --]

On 28.09.2026 11:31:06, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] doc: dangling reference to missing yaml binding file

I think you should send these 2 patches as a series.

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   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2026-09-28 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-28 11:26 [PATCH] dt-bindings: net: can: convert grcan to DT schema Quchaosheng
2026-09-28 11:26 ` [PATCH] net: can: grcan: update the binding file reference in the driver comment Quchaosheng
2026-09-28 11:31   ` sashiko-bot
2026-09-28 18:18     ` Marc Kleine-Budde

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