[PATCH] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes

Anton D. Stavinskii posted 1 patch 5 days, 4 hours ago
arch/riscv/boot/dts/sophgo/cv180x.dtsi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes
Posted by Anton D. Stavinskii 5 days, 4 hours ago
I've tested the current dwc2 FIFO configuration and found that USB
device mode breaks in ECM mode when transmitting frames larger than
128 bytes. For example, large ICMP packets or iperf3 traffic cause
the USB link to hang and eventually disconnect without any messages in
dmesg.

After switching to more conservative FIFO sizes, ECM becomes stable
and no longer drops the connection. iperf3 now shows ~130 Mbit/s RX
and ~100 Mbit/s TX on SG2002 (MilkV Duo 256M).

Fix the FIFO sizes accordingly.

Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
---
 arch/riscv/boot/dts/sophgo/cv180x.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/boot/dts/sophgo/cv180x.dtsi b/arch/riscv/boot/dts/sophgo/cv180x.dtsi
index 1b2b1969a648..06b0ce5a2db7 100644
--- a/arch/riscv/boot/dts/sophgo/cv180x.dtsi
+++ b/arch/riscv/boot/dts/sophgo/cv180x.dtsi
@@ -438,8 +438,8 @@ usb: usb@4340000 {
 			clocks = <&clk CLK_AXI4_USB>, <&clk CLK_APB_USB>;
 			clock-names = "otg", "utmi";
 			g-np-tx-fifo-size = <32>;
-			g-rx-fifo-size = <536>;
-			g-tx-fifo-size = <768 512 512 384 128 128>;
+			g-rx-fifo-size = <1536>;
+			g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
 			interrupts = <SOC_PERIPHERAL_IRQ(14) IRQ_TYPE_LEVEL_HIGH>;
 			phys = <&usbphy>;
 			phy-names = "usb2-phy";
-- 
2.43.0
Re: [PATCH] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes
Posted by Inochi Amaoto 4 days, 15 hours ago
On Wed, 26 Nov 2025 21:21:16 +0400, Anton D. Stavinskii wrote:
> I've tested the current dwc2 FIFO configuration and found that USB
> device mode breaks in ECM mode when transmitting frames larger than
> 128 bytes. For example, large ICMP packets or iperf3 traffic cause
> the USB link to hang and eventually disconnect without any messages in
> dmesg.
> 
> After switching to more conservative FIFO sizes, ECM becomes stable
> and no longer drops the connection. iperf3 now shows ~130 Mbit/s RX
> and ~100 Mbit/s TX on SG2002 (MilkV Duo 256M).
> 
> [...]

Applied to dt/riscv, thanks!

[1/1] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes
      https://github.com/sophgo/linux/commit/1d3ed9920a193e5d99d651d6ec1dbbe215ca172f

Thanks,
Inochi
Re: [PATCH] riscv: dts: sophgo: cv180x: fix USB dwc2 FIFO sizes
Posted by Inochi Amaoto 4 days, 23 hours ago
On Wed, Nov 26, 2025 at 09:21:16PM +0400, Anton D. Stavinskii wrote:
> I've tested the current dwc2 FIFO configuration and found that USB
> device mode breaks in ECM mode when transmitting frames larger than
> 128 bytes. For example, large ICMP packets or iperf3 traffic cause
> the USB link to hang and eventually disconnect without any messages in
> dmesg.
> 
> After switching to more conservative FIFO sizes, ECM becomes stable
> and no longer drops the connection. iperf3 now shows ~130 Mbit/s RX
> and ~100 Mbit/s TX on SG2002 (MilkV Duo 256M).
> 
> Fix the FIFO sizes accordingly.
> 
> Signed-off-by: Anton D. Stavinskii <stavinsky@gmail.com>
> ---
>  arch/riscv/boot/dts/sophgo/cv180x.dtsi | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/riscv/boot/dts/sophgo/cv180x.dtsi b/arch/riscv/boot/dts/sophgo/cv180x.dtsi
> index 1b2b1969a648..06b0ce5a2db7 100644
> --- a/arch/riscv/boot/dts/sophgo/cv180x.dtsi
> +++ b/arch/riscv/boot/dts/sophgo/cv180x.dtsi
> @@ -438,8 +438,8 @@ usb: usb@4340000 {
>  			clocks = <&clk CLK_AXI4_USB>, <&clk CLK_APB_USB>;
>  			clock-names = "otg", "utmi";
>  			g-np-tx-fifo-size = <32>;
> -			g-rx-fifo-size = <536>;
> -			g-tx-fifo-size = <768 512 512 384 128 128>;
> +			g-rx-fifo-size = <1536>;
> +			g-tx-fifo-size = <128 128 64 64 64 64 32 32>;
>  			interrupts = <SOC_PERIPHERAL_IRQ(14) IRQ_TYPE_LEVEL_HIGH>;
>  			phys = <&usbphy>;
>  			phy-names = "usb2-phy";
> -- 
> 2.43.0
> 

Please add a fix tag next time, I will add it by myself this time,
otherwise LGTM.

Reviewed-by: Inochi Amaoto <inochiama@gmail.com>
Fixes: e307248a3c2d ("riscv: dts: sophgo: Add USB support for cv18xx")

Regards,
Inochi