[PATCH 1/2] riscv: dts: k1: add pinctrl property in dts.

Huan Zhou me at per1cycle.org
Sat Mar 29 13:47:59 CET 2025


Add pinctrl node in device tree and update
in bananapi f3 dts.

Signed-off-by: Huan Zhou <me at per1cycle.org>
---
 arch/riscv/dts/k1-bananapi-f3.dts |  3 +++
 arch/riscv/dts/k1-pinctrl.dtsi    | 19 +++++++++++++++++++
 arch/riscv/dts/k1.dtsi            |  8 +++++++-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/arch/riscv/dts/k1-bananapi-f3.dts b/arch/riscv/dts/k1-bananapi-f3.dts
index d2486f70906143ad1f2bde753f12dea5bab2e5ab..6b5b83bcdb9ae4553c5fb63a7a9684f5d47a456e 100644
--- a/arch/riscv/dts/k1-bananapi-f3.dts
+++ b/arch/riscv/dts/k1-bananapi-f3.dts
@@ -5,6 +5,7 @@
 
 #include "k1.dtsi"
 #include "binman.dtsi"
+#include "k1-pinctrl.dtsi"
 
 / {
 	model = "Banana Pi BPI-F3";
@@ -21,5 +22,7 @@
 };
 
 &uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_2_cfg>;
 	status = "okay";
 };
diff --git a/arch/riscv/dts/k1-pinctrl.dtsi b/arch/riscv/dts/k1-pinctrl.dtsi
new file mode 100644
index 0000000000000000000000000000000000000000..14e7096fbcfdc88a9f9989993fdd2aca6de7462e
--- /dev/null
+++ b/arch/riscv/dts/k1-pinctrl.dtsi
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2022 Spacemit Inc.
+ * Copyright (C) 2025 Yixun Lan <dlan at gentoo.org>
+ */
+
+#define K1_PADCONF(pin, func) (((pin) << 16) | (func))
+
+&pinctrl {
+	uart0_2_cfg: uart0-2-cfg {
+		uart0-2-pins {
+			pinmux = <K1_PADCONF(68, 2)>,
+				 <K1_PADCONF(69, 2)>;
+
+			bias-pull-up = <0>;
+			drive-strength = <32>;
+		};
+	};
+};
diff --git a/arch/riscv/dts/k1.dtsi b/arch/riscv/dts/k1.dtsi
index 514be453dbaf6713cdf4ad5a5d653488297ebb83..4626bdd48b2a5dfc3a29ffcdbcec608b4a2573ac 100644
--- a/arch/riscv/dts/k1.dtsi
+++ b/arch/riscv/dts/k1.dtsi
@@ -455,5 +455,11 @@
 			reg-io-width = <4>;
 			status = "reserved"; /* for TEE usage */
 		};
+
+		pinctrl: pinctrl at d401e000 {
+			compatible = "spacemit,k1-pinctrl", "pinctrl-single";
+			reg = <0x0 0xd401e000 0x0 0x400>;
+			pinctrl-single,register-width = <32>;
+		};
 	};
-};
\ No newline at end of file
+};

-- 
2.39.5



More information about the U-Boot mailing list