Re: [PATCH net-next 07/12] can: rcar_canfd: Use DT clock names in the probe message

From
Marc Kleine-Budde <mkl@pengutronix.de>
Date
2026-11-11 12:01:20
Also in
linux-can
Reply to
Marc Kleine-Budde, 2026-11-10
On 10.11.2026 12:41:30, Marc Kleine-Budde wrote:
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Print the DT binding clock names when reporting the selected clock at the
end of probe. These names are part of the DT ABI, so they are stable and
match what users see in the device tree.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://patch.msgid.link/20261019121356.2421761-3-claudiu.beznea@kernel.org (local)
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

The netdev sashiko/clashiko found a medium issue. Can you comment on it?

If you re-spin the series, take a look at the low issues, too:

https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110115112.3807247-1-mkl@pengutronix.de

regards,
Marc
--- Patch [7]: [PATCH net-next 07/12] can: rcar_canfd: Use DT clock names in the probe message ---
commit d7a69a85fec4c0746ff8cbfad2799f58cd2059c3
Author: Claudiu Beznea [off-list ref]

can: rcar_canfd: Use DT clock names in the probe message

This commit changes the clock name in the final dev_info() of
rcar_canfd_probe(). It now prints DT binding clock names ("can_clk",
"fck" or "canfd") instead of "ext" or "canfd".

Link: https://patch.msgid.link/20261019121356.2421761-3-claudiu.beznea@kernel.org (local)
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index bb2d03b75142a..4f5cdfa8211da 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -2312,7 +2312,7 @@ static int rcar_canfd_probe(struct platform_device *pdev)

 	platform_set_drvdata(pdev, gpriv);
 	dev_info(dev, "global operational state (%s clk, %s mode)\n",
-		 gpriv->extclk ? "ext" : "canfd",
+		 gpriv->extclk ? "can_clk" : (info->fcan_pclk ? "fck" : "canfd"),
Is the right name printed when can_clk is in use on hardware where
external_clk is 0?

gpriv->extclk does not record which DT clock was picked. In the branch
that uses "can_clk", it is copied from the hw_info flag that controls
the GCFG DCS bit:

drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_probe() {
    ...
	} else {
		fcan_freq = clk_get_rate(gpriv->can_clk);
		gpriv->extclk = gpriv->info->external_clk;
	}
    ...
}

r9a09g047_hw_info has:

	.external_clk = 0,
	.fcan_pclk = 0,

RZ/G3E uses this hw_info, and so do RZ/V2N and RZ/V2H through the
r9a09g047 fallback compatible. Their device trees (r9a09g047.dtsi,
r9a09g056.dtsi and r9a09g057.dtsi) only list:

	clock-names = "fck", "ram_clk", "can_clk";

On these SoCs, devm_clk_get_optional(dev, "can_clk") returns a clock
with a non-zero rate, so the else branch runs. extclk then ends up
false, and the message prints "canfd clk".

None of those device trees has a "canfd" clock, so a successful probe on
these SoCs can only have used "can_clk".

The commit message says the names "match what users see in the device
tree". That does not seem to hold on these platforms. The same ternary
is also still there at the end of the series.

Could each branch that gets the clock set a const char * clock name
instead, rather than working it out from extclk and fcan_pclk?
 		 gpriv->fdmode ? (gpriv->fd_only_mode ? "fd-only" : "fd") : "classical");
 	return 0;
--
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   |

Attachments

Thread (27 messages) 27 messages, 6 authors, last reply 5d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help