dwc2: g-tx-fifo-size configuration on bcm2835
Stefan Wahren
stefan.wahren at i2se.com
Thu May 18 10:10:40 PDT 2017
Hi,
since the dwc2 should be able to properly setup its fifos, i want to enable otg mode for Raspberry Pi Zero (BCM2835). According to the BCM2835 datasheet [1] it has 7 device EPs with a max FIFO depth for EP1..5 = 512 and EP6,7 = 768. This makes in sum 4096, which also seems to be okay regarding to datasheet.
So i defined the following DTS part:
&usb {
dr_mode = "otg";
g-rx-fifo-size = <256>;
g-np-tx-fifo-size = <32>;
g-tx-fifo-size = <512 512 512 512 512 768 768>;
};
Unfortunately i get the following errors from dwc2:
[ 2.535879] dwc2 20980000.usb: dwc2_check_param_tx_fifo_sizes: Invalid parameter g-tx-fifo-size, setting to default average
[ 2.561611] dwc2 20980000.usb: dwc2_check_param_tx_fifo_sizes: Invalid parameter g_tx_fifo_size[1]=539
[ 2.586045] dwc2 20980000.usb: dwc2_check_param_tx_fifo_sizes: Invalid parameter g_tx_fifo_size[2]=539
[ 2.611045] dwc2 20980000.usb: dwc2_check_param_tx_fifo_sizes: Invalid parameter g_tx_fifo_size[3]=539
[ 2.636209] dwc2 20980000.usb: dwc2_check_param_tx_fifo_sizes: Invalid parameter g_tx_fifo_size[4]=539
[ 2.661952] dwc2 20980000.usb: dwc2_check_param_tx_fifo_sizes: Invalid parameter g_tx_fifo_size[5]=539
[ 2.688044] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[ 2.704753] g_serial gadget: Gadget Serial v2.4
[ 2.717962] g_serial gadget: g_serial ready
[ 2.730830] dwc2 20980000.usb: bound driver g_serial
[ 2.745485] dwc2 20980000.usb: DWC OTG Controller
[ 2.759763] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[ 2.776556] dwc2 20980000.usb: irq 33, io mem 0x20980000
Since these messages aren't really helpful, i added a info messages about fifo_count, sum of all fifo sizes and allowed total from hardware:
[ 2.512808] dwc2 20980000.usb: dwc2_check_param_tx_fifo_sizes: fifo_count = 7, sum = 4096, total = 3776
So i decided to use the following setting, which works without any issues:
g-tx-fifo-size = <512 512 512 512 512 512 512>;
Here are my questions:
Is the dwc2 still broken regarding to this error or is the datasheet wrong?
Is it save to use the working g-tx-fifo-size for peripheral and otg mode? Or do i need to reserve some space in fifo (for host mode)?
Is this the proper way to evaluate the right g-tx-fifo-size setting?
Regards
Stefan
[1] - https://www.raspberrypi.org/app/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
More information about the linux-rpi-kernel
mailing list