mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: liucj1228@outlook.com
Cc: dlan@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, troy.mitchell@linux.spacemit.com,
	pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu,
	alex@ghiti.fr, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-can@vger.kernel.org,
	kuba@kernel.org
Subject: Re: [PATCH v1] riscv: dts: spacemit: k1: describe the CAN0 controller
Date: Tue, 01 Dec 2026 03:22:08 +0000	[thread overview]
Message-ID: <179609532835.3142.17955646471377248461@kernel.org> (raw)
In-Reply-To: <CH5PR19MB9971565990F421482921CF595DAC4F2@CH5PR19MB997156.namprd19.prod.outlook.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The `can0` node in arch/riscv/boot/dts/spacemit/k1.dtsi
  selects CTRL[CLK_SRC]=0 with `fsl,clk-source = /bits/ 8 <0>`.
- [Low] In arch/riscv/boot/dts/spacemit/k1.dtsi, the new node `can0:
  can@d4028000` (lines 1081-1093) uses `compatible =…

--

riscv: dts: spacemit: k1: describe the CAN0 controller

This commit adds a disabled CAN0 FlexCAN node to the SpacemiT K1 dtsi,
along with a pinctrl group for GPIO75/GPIO76. It selects protocol clock
source 0 and sets the per clock to 80 MHz for CAN FD.

> diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
> index 5d5f7f8a393d3..64f554aa9aab5 100644
> --- a/arch/riscv/boot/dts/spacemit/k1.dtsi
> +++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
> @@ -1078,6 +1078,20 @@ uart9: serial@d4017800 {
>  				status = "disabled";
>  			};
>  
> +			can0: can@d4028000 {
> +				compatible = "spacemit,k1-flexcan";

[Severity: Low]
Does anything in the tree handle this compatible yet? It only appears in
this dtsi. It is missing from the compatible list in
Documentation/devicetree/bindings/net/can/fsl,flexcan.yaml, and the OF
match table in drivers/net/can/flexcan/flexcan-core.c does not have it
either.

That binding also sets additionalProperties: false and does not define a
resets property. Would make dtbs_check then reject both the compatible and
this line further down?

    resets = <&syscon_apbc RESET_CAN0>;

flexcan_probe() also has no reset_control handling. It reads only
clock-frequency, fsl,clk-source, the ipg/per clocks, the regulator and the
phy. RESET_CAN0 is a real reset line in
drivers/reset/spacemit/reset-spacemit-k1.c:

    [RESET_CAN0]	= RESET_DATA(APBC_CAN0_CLK_RST,		BIT(2), 0),

so nothing in the in-tree driver would deassert it.

The notes after the commit message say the binding is patch 1/3 of a
separate CAN driver series that has not been merged. Does that series also
add resets to the binding and a reset deassert to flexcan_probe()?

If it does not, this node would still fail validation once the binding is
merged, and a board that enables it would leave the controller in reset.
In either case, this patch has to be applied after that series.

> +				reg = <0x0 0xd4028000 0x0 0x4000>;
> +				interrupts = <16>;
> +				clocks = <&syscon_apbc CLK_CAN0_BUS>,
> +					 <&syscon_apbc CLK_CAN0>;
> +				clock-names = "ipg", "per";
> +				assigned-clocks = <&syscon_apbc CLK_CAN0>;
> +				assigned-clock-rates = <80000000>;
> +				resets = <&syscon_apbc RESET_CAN0>;
> +				fsl,clk-source = /bits/ 8 <0>;

[Severity: Medium]
With this setting, does the protocol engine clock end up faster than the
bus clock?

With fsl,clk-source = 0, flexcan_chip_start() clears CTRL[CLK_SRC]:

	if (priv->clk_src)
		reg |= FLEXCAN_CTRL_CLK_SRC;
	else
		reg &= ~FLEXCAN_CTRL_CLK_SRC;

flexcan_probe() then takes the CAN clock from clk_get_rate(clk_per), and
assigned-clock-rates above sets that clock to 80 MHz.

The ipg clock, CLK_CAN0_BUS, is modelled as the 24 MHz crystal in
drivers/clk/spacemit/ccu-k1.c:

CCU_GATE_DEFINE(can0_bus_clk, CCU_PARENT_NAME(vctcxo_24m), APBC_CAN0_CLK_RST, BIT(0), 0);

The other APBC bus gates nearby use apb_clk as their parent, and so do the
K3 CAN bus gates in ccu-k3.c.

The NXP FlexCAN reference manuals say that with CLKSRC=0 the oscillator
(protocol engine) clock must be slower than the bus clock. Every in-tree
user of fsl,clk-source = 0 (imx8mp, imx8qm, imx93, imx94, imx95, imx952)
pairs a 40/80 MHz per clock with a much faster ipg clock.

Suppose the SpacemiT IP keeps that rule and the bus clock really is 24 MHz.
Could register and message buffer access, and bit timing, then be
unreliable on any board that enables can0? Of the 20/40/80 MHz rates on
offer, only 20 MHz would meet that rule.

Is the vctcxo_24m parent in ccu-k1.c only an approximation that should be
fixed, or does the SpacemiT IP not have this restriction? Could the commit
message say which one applies?

> +				status = "disabled";
> +			};
> +

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/CH5PR19MB9971565990F421482921CF595DAC4F2%40CH5PR19MB997156.namprd19.prod.outlook.com

      reply	other threads:[~2026-12-01  3:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 13:31 Liu Changjie
2026-12-01  3:22 ` netdev-bot+sashiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179609532835.3142.17955646471377248461@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=liucj1228@outlook.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=troy.mitchell@linux.spacemit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®