u-boot/drivers/usb/musb
Pali Rohár 10bc132510 usb: musb: Fix configuring FIFO for endpoints
This patch fixes configuring FIFOs for one-directional endpoints which have
only one queue (either RX or TX, but noth both).

Size of FIFO buffer is 2^(idx+3) bytes and starting address is 2^(addr+3).
Moreover first 64 bytes are reserved for EP0.

Without this patch if FIFO size specified by caller was zero then idx was
incorrectly calculated (expr. ffs(0)-1) and size overflowed in fifosz
register. This register uses has only 4 bits for FIFO size. Moreover
specifying zero buffer size is not possible (with idx=0 is minimal buffer
size 8 bytes).

So even for one-directional endpoints we need to correctly specify both
(RX and TX) FIFO buffer sizes and its addresses.

This patch is fixing calculation of start address and buffer size to
minimal value and ensures that it would not overlap with buffer reserved
for EP0.

This issue caused loose of packets on USB bus in both directions and
basically usbtty was unusable.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
2021-03-03 04:12:46 +01:00
..
am35x.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
am35x.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Kconfig usb: musb: Remove legacy CONFIG_USB_DA8XX 2018-12-14 17:59:09 +01:00
Makefile usb: musb: Remove legacy CONFIG_USB_DA8XX 2018-12-14 17:59:09 +01:00
musb_core.c usb: musb: Fix configuring FIFO for endpoints 2021-03-03 04:12:46 +01:00
musb_core.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
musb_debug.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
musb_hcd.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
musb_hcd.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
musb_udc.c common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
omap3.c common: Move serial_printf() to the serial header 2019-12-02 18:23:10 -05:00
omap3.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00