u-boot-brain/drivers/usb
Pali Rohár ff77bb301e usb: musb: Fix receiving of bigger buffers
If musb_peri_rx_ep() was called to process received HW buffer but U-Boot
cannot read it yet (e.g. because U-Boot SW buffer is full) then interrupt
was marked as processed also when HW buffer stayed unprocessed.

U-Boot tried to process this buffer again when it received interrupt again,
but it can receive it only when sender (host) sends a new data. As sender
(host) is not going to send a new data until U-Boot process current data
this issue caused a deadlock in case sender (host) is emitting data faster
than U-Boot can process it.

Reading musb intrrx register automatically clears this register and marks
interrupt as processed. So to prevent marking interrupt in U-Boot as
processed, adds a new variable pending_intrrx which would contain
unprocessed bits of intrrx register.

For a second step, every time when musb_peri_rx_ep() is called and there
are waiting data to be processed (signaled by MUSB_RXCSR_RXPKTRDY) either
acknowledge sender (via musb_peri_rx_ack()) that whole HW buffer was
processed or set corresponding bit in pending_intrrx that HW buffer was not
fully processed yet and next iteration is required after U-Boot allocates
space for reading HW buffer.

This patch fixes receiving large usb buffers, e.g. file transfer via Kermit
protocol implemented by 'loadb' U-Boot command over usbtty serial console.

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
..
cdns3 dm: core: Access device ofnode through functions 2021-01-05 12:24:41 -07:00
common common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
dwc3 Driver model: make some udevice fields private 2021-01-05 22:34:43 -05:00
emul dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
eth Prepare v2021.01-rc5 2021-01-05 16:20:26 -05:00
gadget usb: gadget: dwc2_udc_otg: Fix dwc2_gadget_start() and usb_gadget_register_driver() 2021-02-26 15:30:55 +01:00
host dm: i2c: use CONFIG_IS_ENABLED macro for DM_I2C/DM_I2C_GPIO 2021-02-21 06:08:00 +01:00
mtu3 dm: core: Access device ofnode through functions 2021-01-05 12:24:41 -07:00
musb usb: musb: Fix receiving of bigger buffers 2021-03-03 04:12:46 +01:00
musb-new common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
phy common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
ulpi common: Drop linux/delay.h from common header 2020-05-18 21:19:23 -04:00
Kconfig cosmetic: fix typo in drivers/usb/Kconfig 2021-01-04 09:10:17 -05:00