From ea7125c4c6d25bbaf7927efc753357e64612bffb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sun, 7 Feb 2021 14:50:07 +0100 Subject: [PATCH] usb: musb: Fix transmission of bigger buffers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If udc_endpoint_write() was called with bigger payload which does not fit into one USB packet it is needed to transmit payload in more USB packets. First packet is transmitted by udc_endpoint_write() call itself and other packets are put into waiting queue. Implement function musb_peri_tx() which checks if endpoints are ready for transmit and continue transmission of waiting queue. This patch fixes sending big output from printenv command over usbtty serial console. Signed-off-by: Pali Rohár Reviewed-by: Lukasz Majewski Acked-by: Pavel Machek > --- drivers/usb/musb/musb_udc.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c index 67d1c56..28719cc 100644 --- a/drivers/usb/musb/musb_udc.c +++ b/drivers/usb/musb/musb_udc.c @@ -708,21 +708,16 @@ static void musb_peri_rx(u16 intr) static void musb_peri_tx(u16 intr) { + unsigned int ep; + /* Check for EP0 */ if (0x01 & intr) musb_peri_ep0_tx(); - /* - * Use this in the future when handling epN tx - * - * u8 ep; - * - * for (ep = 1; ep < 16; ep++) { - * if ((1 << ep) & intr) { - * / * handle tx for this endpoint * / - * } - * } - */ + for (ep = 1; ep < 16; ep++) { + if ((1 << ep) & intr) + udc_endpoint_write(GET_ENDPOINT(udc_device, ep)); + } } void udc_irq(void) -- 2.7.4