diff mbox series

[RESEND,07/16] usb: musb: Fix transmission of bigger buffers

Message ID 20210205191212.7644-8-pali@kernel.org
State Superseded
Delegated to: Marek Vasut
Headers show
Series Nokia RX-51: Fix USB TTY console and enable it | expand

Commit Message

Pali Rohár Feb. 5, 2021, 7:12 p.m. UTC
If udc_endpoint_write() was called with bigger payload which does not fit
into one USB packet it needs to be transmitted 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 transmit checks when endpoints are
ready and continue transmitting of waiting queue.

This patch fixes sending e.g. output of printenv command over usbtty serial
console.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/usb/musb/musb_udc.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

Comments

Lukasz Majewski Feb. 6, 2021, 2:07 p.m. UTC | #1
On Fri,  5 Feb 2021 20:12:03 +0100
Pali Rohár <pali@kernel.org> wrote:

> If udc_endpoint_write() was called with bigger payload which does not
> fit into one USB packet it needs to be transmitted 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 transmit checks when
> endpoints are ready and continue transmitting of waiting queue.
> 
> This patch fixes sending e.g. output of printenv command over usbtty
> serial console.

Reviewed-by: Lukasz Majewski <lukma@denx.de>

> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  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 67d1c56f9a..28719cc3f6 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)




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff mbox series

Patch

diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c
index 67d1c56f9a..28719cc3f6 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)