[PATCH v1 2/2] riscv: dts: add usb nodes for Canaan Kendryte K230 SoCs

Yangyu Chen cyy at cyyself.name
Sun Apr 21 05:53:30 PDT 2024


This patch adds USB nodes for Canaan Kendryte K230 SoCs. The fifo
parameters are taken from factory dts [1]. For the clock parameter, we use
a dummy node here as we don't know the actual clock this IP connected
inside the SoC chip, and it doesn't matter after reviewing the dwc2 driver
code, which will not read the clock frequency but only use the binding to
turn the clock on or off to save power.

[1] https://github.com/kendryte/k230_sdk/blob/v1.5/src/little/linux/arch/riscv/boot/dts/kendryte/k230.dtsi

Signed-off-by: Yangyu Chen <cyy at cyyself.name>
---
 arch/riscv/boot/dts/canaan/k230.dtsi | 29 ++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/arch/riscv/boot/dts/canaan/k230.dtsi b/arch/riscv/boot/dts/canaan/k230.dtsi
index 95c1a3d8fb11..2311fb7f7127 100644
--- a/arch/riscv/boot/dts/canaan/k230.dtsi
+++ b/arch/riscv/boot/dts/canaan/k230.dtsi
@@ -65,6 +65,13 @@ apb_clk: apb-clk-clock {
 		#clock-cells = <0>;
 	};
 
+	clk_dummy: clock-dummy {
+		compatible = "fixed-clock";
+		clock-frequency = <0>;
+		clock-output-names = "clk_dummy";
+		#clock-cells = <0>;
+	};
+
 	soc {
 		compatible = "simple-bus";
 		interrupt-parent = <&plic>;
@@ -138,5 +145,27 @@ uart4: serial at 91404000 {
 			reg-shift = <2>;
 			status = "disabled";
 		};
+
+		usb0: usb at 91500000 {
+			compatible = "canaan,k230-otg", "snps,dwc2";
+			reg = <0x0 0x91500000 0x0 0x40000>;
+			interrupts = <173 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk_dummy>;
+			clock-names = "otg";
+			g-rx-fifo-size = <512>;
+			g-np-tx-fifo-size = <64>;
+			g-tx-fifo-size = <512 1024 64 64 64 64>;
+		};
+
+		usb1: usb at 91540000 {
+			compatible = "canaan,k230-otg", "snps,dwc2";
+			reg = <0x0 0x91540000 0x0 0x40000>;
+			interrupts = <174 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&clk_dummy>;
+			clock-names = "otg";
+			g-rx-fifo-size = <512>;
+			g-np-tx-fifo-size = <64>;
+			g-tx-fifo-size = <512 1024 64 64 64 64>;
+		};
 	};
 };
-- 
2.43.0




More information about the linux-riscv mailing list