Skip to content

Commit cbff3d0

Browse files
wuliangfengrkhuangtao
authored andcommitted
arm64: dts: rockchip: reconfig dwc2 device fifo size
According to the dwc2 programmer's guide v3.10a, in '2.1.3.2 Dedicated FIFO Mode with No Thresholding', it suggested that: Device RxFIFO = - Scatter/Gather DMA mode: (4 * number of control endpoints + 6) + ((largest USB packet used / 4) + 1 for status information) + (2 * number of OUT endpoints) + 1 for Global NAK on rockchip platforms: (4 * 1 + 6) + ((1024 / 4) + 1) + (2 * 6) + 1 = 280 - Slave or Buffer DMA mode: (5 * number of control endpoints + 8) + ((largest USB packet used / 4) + 1 for status information) + (2 * number of OUT endpoints) + 1 for Global NAK on rockchip platforms: (5 * 1 + 8) + ((1024 / 4) + 1) + (2 * 6) + 1 = 283 Device IN Endpoint TxFIFO = The TxFIFO must equal at least one MaxPacketSize (MPS). In addition to RxFIFO and TxFIFOs, refer to dwc2 databook v3.10a, 'Figure 2-13 Device Mode FIFO Address Mapping and AHB FIFO Access Mapping (Dedicated FIFO)', it required that when the device is operating in non Scatter Gather Internal DMA mode, the last locations of the SPRAM are used to store the DMAADDR values for each Endpoint (1 location per endpoint). When the device is operating in Scatter Gather mode, then the last locations of the SPRAM store the Base Descriptor address, Current Descriptor address, Current Buffer address, and status quadlet information for each endpoint direction (4 locations per Endpoint). If an Endpoint is bidirectional , then 4 locations will be used for IN, and another 4 for OUT). Considering that the total FIFO size of dwc2 otg is 0x3cc (972), and we must reserve (4 * 13) = 52 locations for all Endpoints. So reconfig dwc2 device fifo size as follows: Device RxFIFO = 280 Device IN Endpoint TxFIFO - FIFO #0 = (64 / 4) = 16 (Assuming this is used for EP0) - FIFO #1 = (1024/4) = 256 (Assuming this is used for Isochronous) - FIFO #2 = (512/4) = 128 - FIFO #3 = (512/4) = 128 - FIFO #4 = (256/4) = 64 - FIFO #5 = (128/4) = 32 - FIFO #6 = (64/4) = 16 After reconfig the dwc2 device fifo size, test mtp write on rockchip platform (PC -> rockchip platform) on rk312x/rk3326/px30/rk3288 evb, when mask the 'vfs_write' in f_mtp.c, the writing data rate can be increased from 16MBps ~ 20MBps to 30MBps ~ 36MBps on different kinds of rockchip evbs. Change-Id: I52c64a279523c811f706e69e427b0a6e8c45683b Signed-off-by: William Wu <[email protected]>
1 parent 8cfb4da commit cbff3d0

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

arch/arm64/boot/dts/rockchip/px30.dtsi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1017,8 +1017,8 @@
10171017
power-domains = <&power PX30_PD_USB>;
10181018
dr_mode = "otg";
10191019
g-np-tx-fifo-size = <16>;
1020-
g-rx-fifo-size = <275>;
1021-
g-tx-fifo-size = <256 128 128 64 64 32>;
1020+
g-rx-fifo-size = <280>;
1021+
g-tx-fifo-size = <256 128 128 64 32 16>;
10221022
g-use-dma;
10231023
phys = <&u2phy_otg>;
10241024
phy-names = "usb2-phy";

arch/arm64/boot/dts/rockchip/rk3308.dtsi

+2-2
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,8 @@
755755
clock-names = "otg";
756756
dr_mode = "otg";
757757
g-np-tx-fifo-size = <16>;
758-
g-rx-fifo-size = <275>;
759-
g-tx-fifo-size = <256 128 128 64 64 32>;
758+
g-rx-fifo-size = <280>;
759+
g-tx-fifo-size = <256 128 128 64 32 16>;
760760
g-use-dma;
761761
phys = <&u2phy_otg>;
762762
phy-names = "usb2-phy";

arch/arm64/boot/dts/rockchip/rk3328.dtsi

+2-2
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,8 @@
13171317
clock-names = "otg", "otg_pmu";
13181318
dr_mode = "otg";
13191319
g-np-tx-fifo-size = <16>;
1320-
g-rx-fifo-size = <275>;
1321-
g-tx-fifo-size = <256 128 128 64 64 32>;
1320+
g-rx-fifo-size = <280>;
1321+
g-tx-fifo-size = <256 128 128 64 32 16>;
13221322
g-use-dma;
13231323
phys = <&u2phy_otg>;
13241324
phy-names = "usb2-phy";

arch/arm64/boot/dts/rockchip/rk3366.dtsi

+2-2
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@
520520
clock-names = "otg";
521521
dr_mode = "otg";
522522
g-np-tx-fifo-size = <16>;
523-
g-rx-fifo-size = <275>;
524-
g-tx-fifo-size = <256 128 128 64 64 32>;
523+
g-rx-fifo-size = <280>;
524+
g-tx-fifo-size = <256 128 128 64 32 16>;
525525
g-use-dma;
526526
status = "disabled";
527527
};

arch/arm64/boot/dts/rockchip/rk3368.dtsi

+2-2
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,8 @@
834834
clock-names = "otg";
835835
dr_mode = "otg";
836836
g-np-tx-fifo-size = <16>;
837-
g-rx-fifo-size = <275>;
838-
g-tx-fifo-size = <256 128 128 64 64 32>;
837+
g-rx-fifo-size = <280>;
838+
g-tx-fifo-size = <256 128 128 64 32 16>;
839839
g-use-dma;
840840
status = "disabled";
841841
};

0 commit comments

Comments
 (0)