mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] riscv: dts: spacemit: k1: describe the CAN0 controller
@ 2026-11-29 13:31 Liu Changjie
  2026-12-01  3:22 ` netdev-bot+sashiko
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Changjie @ 2026-11-29 13:31 UTC (permalink / raw)
  To: Yixun Lan
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Troy Mitchell,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti,
	devicetree, linux-riscv, spacemit, linux-kernel, linux-can

The K1 APB clock controller offers three protocol clock rates for CAN0: 20,
40 and 80 MHz. The FlexCAN driver defaults to protocol clock source 1 when
the device tree omits fsl,clk-source.

Select protocol clock source 0 and an 80 MHz clock rate for CAN FD. Leave
CAN0 disabled so boards can opt in when GPIO75 and GPIO76 connect to a CAN
transceiver.

Signed-off-by: Liu Changjie <liucj1228@outlook.com>
---
Based on v7.4-rc4. The binding is patch 1/3 of the CAN driver series:
https://lore.kernel.org/r/CH5PR19MB99715661A6B795896AA15DFBD8AC4F2@CH5PR19MB997156.namprd19.prod.outlook.com

Codex assisted with preparing and validating this patch.

 arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 11 +++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi         | 14 ++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
index 8c57ca05d..084e4765c 100644
--- a/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi
@@ -11,6 +11,17 @@
 #define K1_GPIO(x)	(x / 32) (x % 32)
 
 &pinctrl {
+	/omit-if-no-ref/
+	can0_cfg: can0-cfg {
+		can0-pins {
+			pinmux = <K1_PADCONF(75, 3)>,	/* can_tx0 */
+				 <K1_PADCONF(76, 3)>;	/* can_rx0 */
+			power-source = <3300>;
+			bias-pull-up = <0>;
+			drive-strength = <19>;
+		};
+	};
+
 	gmac0_cfg: gmac0-cfg {
 		gmac0-pins {
 			pinmux = <K1_PADCONF(0, 1)>,	/* gmac0_rxdv */
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 5d5f7f8a3..64f554aa9 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";
+				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>;
+				status = "disabled";
+			};
+
 			qspi: spi@d420c000 {
 				compatible = "spacemit,k1-qspi";
 				#address-cells = <1>;

base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f

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

end of thread, other threads:[~2026-12-01  3:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 13:31 [PATCH v1] riscv: dts: spacemit: k1: describe the CAN0 controller Liu Changjie
2026-12-01  3:22 ` netdev-bot+sashiko

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®