diff mbox series

[U-Boot,05/14] usb: xhci: Add interrupt transfer support

Message ID 1505742050-5697-6-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Marek Vasut
Headers show
Series usb: xhci: Add interrupt transfer support and full speed device support | expand

Commit Message

Bin Meng Sept. 18, 2017, 1:40 p.m. UTC
xHCI uses normal TRBs for both bulk and interrupt. This adds the
missing interrupt transfer support to xHCI so that devices like
USB keyboard that uses interrupt transfer can work.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/usb/host/xhci.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Stefan Roese Sept. 22, 2017, 5 a.m. UTC | #1
On 18.09.2017 15:40, Bin Meng wrote:
> xHCI uses normal TRBs for both bulk and interrupt. This adds the
> missing interrupt transfer support to xHCI so that devices like
> USB keyboard that uses interrupt transfer can work.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>   drivers/usb/host/xhci.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 04eb1eb..4b3d58d 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -890,11 +890,18 @@ unknown:
>   static int _xhci_submit_int_msg(struct usb_device *udev, unsigned long pipe,
>   				void *buffer, int length, int interval)
>   {
> +	if (usb_pipetype(pipe) != PIPE_INTERRUPT) {
> +		printf("non-interrupt pipe (type=%lu)", usb_pipetype(pipe));
> +		return -EINVAL;
> +	}
> +
>   	/*
> -	 * TODO: Not addressing any interrupt type transfer requests
> -	 * Add support for it later.
> +	 * xHCI uses normal TRBs for both bulk and interrupt. When the
> +	 * interrupt endpoint is to be serviced, the xHC will consume
> +	 * (at most) one TD. A TD (comprised of sg list entries) can
> +	 * take several service intervals to transmit.
>   	 */
> -	return -EINVAL;
> +	return xhci_bulk_tx(udev, pipe, length, buffer);
>   }
>   
>   /**
> 

Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 04eb1eb..4b3d58d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -890,11 +890,18 @@  unknown:
 static int _xhci_submit_int_msg(struct usb_device *udev, unsigned long pipe,
 				void *buffer, int length, int interval)
 {
+	if (usb_pipetype(pipe) != PIPE_INTERRUPT) {
+		printf("non-interrupt pipe (type=%lu)", usb_pipetype(pipe));
+		return -EINVAL;
+	}
+
 	/*
-	 * TODO: Not addressing any interrupt type transfer requests
-	 * Add support for it later.
+	 * xHCI uses normal TRBs for both bulk and interrupt. When the
+	 * interrupt endpoint is to be serviced, the xHC will consume
+	 * (at most) one TD. A TD (comprised of sg list entries) can
+	 * take several service intervals to transmit.
 	 */
-	return -EINVAL;
+	return xhci_bulk_tx(udev, pipe, length, buffer);
 }
 
 /**