diff mbox series

[v3,2/2] usb: dwc3: gadget: Don't set IMI for no_interrupt

Message ID ced336c84434571340c07994e3667a0ee284fefe.1666735451.git.Thinh.Nguyen@synopsys.com (mailing list archive)
State Accepted
Commit 308c316d16cbad99bb834767382baa693ac42169
Headers show
Series usb: dwc3: gadget: Fix isoc interrupt check | expand

Commit Message

Thinh Nguyen Oct. 25, 2022, 10:10 p.m. UTC
The gadget driver may have a certain expectation of how the request
completion flow should be from to its configuration. Make sure the
controller driver respect that. That is, don't set IMI (Interrupt on
Missed Isoc) when usb_request->no_interrupt is set. Also, the driver
should only set IMI to the last TRB of a chain.

Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
---
 Changes in v3:
 - Set IMI to only the last TRB of a chain
 Changes in v2:
 - None

 drivers/usb/dwc3/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jeff Vanhoof Oct. 26, 2022, 8:23 a.m. UTC | #1
On Tue, Oct 25, 2022 at 03:10:20PM -0700, Thinh Nguyen wrote:
> The gadget driver may have a certain expectation of how the request
> completion flow should be from to its configuration. Make sure the
> controller driver respect that. That is, don't set IMI (Interrupt on
> Missed Isoc) when usb_request->no_interrupt is set. Also, the driver
> should only set IMI to the last TRB of a chain.
> 
> Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
> ---
>  Changes in v3:
>  - Set IMI to only the last TRB of a chain
>  Changes in v2:
>  - None
> 
>  drivers/usb/dwc3/gadget.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 230b3c660054..5fe2d136dff5 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1292,8 +1292,8 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
>  			trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS;
>  		}
>  
> -		/* always enable Interrupt on Missed ISOC */
> -		trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
> +		if (!no_interrupt && !chain)
> +			trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
>  		break;
>  
>  	case USB_ENDPOINT_XFER_BULK:
> -- 
> 2.28.0
>

No new issues seen with these changes. Changes look good to me.

Reviewed-by: Jeff Vanhoof <jdv1029@gmail.com>
Tested-by: Jeff Vanhoof <jdv1029@gmail.com> 

Regards,
Jeff
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 230b3c660054..5fe2d136dff5 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1292,8 +1292,8 @@  static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
 			trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS;
 		}
 
-		/* always enable Interrupt on Missed ISOC */
-		trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
+		if (!no_interrupt && !chain)
+			trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI;
 		break;
 
 	case USB_ENDPOINT_XFER_BULK: