diff mbox series

[1/1] usb: cdns3: skip set TRB_IOC when usb_request: no_interrupt is true

Message ID 20231027183919.664271-1-Frank.Li@nxp.com (mailing list archive)
State Accepted
Commit 7836be3b100cfc6db3db7ddeb985254bfe1775e4
Headers show
Series [1/1] usb: cdns3: skip set TRB_IOC when usb_request: no_interrupt is true | expand

Commit Message

Frank Li Oct. 27, 2023, 6:39 p.m. UTC
No completion irq is needed if no_interrupt is true. Needn't set TRB_IOC
at this case.

Check usb_request: no_interrupt and set/skip TRB_IOC in
cdns3_ep_run_transfer().

Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/usb/cdns3/cdns3-gadget.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Peter Chen Oct. 31, 2023, 8:45 a.m. UTC | #1
On 23-10-27 14:39:19, Frank Li wrote:
> No completion irq is needed if no_interrupt is true. Needn't set TRB_IOC
> at this case.
> 
> Check usb_request: no_interrupt and set/skip TRB_IOC in
> cdns3_ep_run_transfer().
> 
> Signed-off-by: Frank Li <Frank.Li@nxp.com>

Acked-by: Peter Chen <peter.chen@kernel.org>

Peter
> ---
>  drivers/usb/cdns3/cdns3-gadget.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index 69a44bd7e5d02..cd08897f8da8b 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -1124,6 +1124,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
>  	u16 total_tdl = 0;
>  	struct scatterlist *s = NULL;
>  	bool sg_supported = !!(request->num_mapped_sgs);
> +	u32 ioc = request->no_interrupt ? 0 : TRB_IOC;
>  
>  	if (priv_ep->type == USB_ENDPOINT_XFER_ISOC)
>  		num_trb = priv_ep->interval;
> @@ -1233,11 +1234,11 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
>  			control |= pcs;
>  
>  		if (priv_ep->type == USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir) {
> -			control |= TRB_IOC | TRB_ISP;
> +			control |= ioc | TRB_ISP;
>  		} else {
>  			/* for last element in TD or in SG list */
>  			if (sg_iter == (num_trb - 1) && sg_iter != 0)
> -				control |= pcs | TRB_IOC | TRB_ISP;
> +				control |= pcs | ioc | TRB_ISP;
>  		}
>  
>  		if (sg_iter)
> @@ -1268,7 +1269,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
>  	priv_req->num_of_trb = num_trb;
>  
>  	if (sg_iter == 1)
> -		trb->control |= cpu_to_le32(TRB_IOC | TRB_ISP);
> +		trb->control |= cpu_to_le32(ioc | TRB_ISP);
>  
>  	if (priv_dev->dev_ver < DEV_VER_V2 &&
>  	    (priv_ep->flags & EP_TDLCHK_EN)) {
> -- 
> 2.34.1
>
Frank Li Nov. 27, 2023, 3:28 p.m. UTC | #2
On Tue, Oct 31, 2023 at 04:45:21PM +0800, Peter Chen wrote:
> On 23-10-27 14:39:19, Frank Li wrote:
> > No completion irq is needed if no_interrupt is true. Needn't set TRB_IOC
> > at this case.
> > 
> > Check usb_request: no_interrupt and set/skip TRB_IOC in
> > cdns3_ep_run_transfer().
> > 
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> 
> Acked-by: Peter Chen <peter.chen@kernel.org>

@Greg:
	ping

Frank

> 
> Peter
> > ---
> >  drivers/usb/cdns3/cdns3-gadget.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> > index 69a44bd7e5d02..cd08897f8da8b 100644
> > --- a/drivers/usb/cdns3/cdns3-gadget.c
> > +++ b/drivers/usb/cdns3/cdns3-gadget.c
> > @@ -1124,6 +1124,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
> >  	u16 total_tdl = 0;
> >  	struct scatterlist *s = NULL;
> >  	bool sg_supported = !!(request->num_mapped_sgs);
> > +	u32 ioc = request->no_interrupt ? 0 : TRB_IOC;
> >  
> >  	if (priv_ep->type == USB_ENDPOINT_XFER_ISOC)
> >  		num_trb = priv_ep->interval;
> > @@ -1233,11 +1234,11 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
> >  			control |= pcs;
> >  
> >  		if (priv_ep->type == USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir) {
> > -			control |= TRB_IOC | TRB_ISP;
> > +			control |= ioc | TRB_ISP;
> >  		} else {
> >  			/* for last element in TD or in SG list */
> >  			if (sg_iter == (num_trb - 1) && sg_iter != 0)
> > -				control |= pcs | TRB_IOC | TRB_ISP;
> > +				control |= pcs | ioc | TRB_ISP;
> >  		}
> >  
> >  		if (sg_iter)
> > @@ -1268,7 +1269,7 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
> >  	priv_req->num_of_trb = num_trb;
> >  
> >  	if (sg_iter == 1)
> > -		trb->control |= cpu_to_le32(TRB_IOC | TRB_ISP);
> > +		trb->control |= cpu_to_le32(ioc | TRB_ISP);
> >  
> >  	if (priv_dev->dev_ver < DEV_VER_V2 &&
> >  	    (priv_ep->flags & EP_TDLCHK_EN)) {
> > -- 
> > 2.34.1
> > 
> 
> -- 
> 
> Thanks,
> Peter Chen
Greg Kroah-Hartman Nov. 27, 2023, 3:52 p.m. UTC | #3
On Mon, Nov 27, 2023 at 10:28:57AM -0500, Frank Li wrote:
> On Tue, Oct 31, 2023 at 04:45:21PM +0800, Peter Chen wrote:
> > On 23-10-27 14:39:19, Frank Li wrote:
> > > No completion irq is needed if no_interrupt is true. Needn't set TRB_IOC
> > > at this case.
> > > 
> > > Check usb_request: no_interrupt and set/skip TRB_IOC in
> > > cdns3_ep_run_transfer().
> > > 
> > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > 
> > Acked-by: Peter Chen <peter.chen@kernel.org>
> 
> @Greg:
> 	ping

What are you needing from me here?  Blind pings do not provide any
context :(

thanks,

greg k-h
Frank Li Nov. 27, 2023, 4:07 p.m. UTC | #4
On Mon, Nov 27, 2023 at 03:52:13PM +0000, Greg KH wrote:
> On Mon, Nov 27, 2023 at 10:28:57AM -0500, Frank Li wrote:
> > On Tue, Oct 31, 2023 at 04:45:21PM +0800, Peter Chen wrote:
> > > On 23-10-27 14:39:19, Frank Li wrote:
> > > > No completion irq is needed if no_interrupt is true. Needn't set TRB_IOC
> > > > at this case.
> > > > 
> > > > Check usb_request: no_interrupt and set/skip TRB_IOC in
> > > > cdns3_ep_run_transfer().
> > > > 
> > > > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > > 
> > > Acked-by: Peter Chen <peter.chen@kernel.org>
> > 
> > @Greg:
> > 	ping
> 
> What are you needing from me here?  Blind pings do not provide any
> context :(

Sorry, I just saw it is already in linux-next tree. Generally, I received a
"applied"'s email. So I have not check linux-next tree before send it.

Frank

> 
> thanks,
> 
> greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
index 69a44bd7e5d02..cd08897f8da8b 100644
--- a/drivers/usb/cdns3/cdns3-gadget.c
+++ b/drivers/usb/cdns3/cdns3-gadget.c
@@ -1124,6 +1124,7 @@  static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
 	u16 total_tdl = 0;
 	struct scatterlist *s = NULL;
 	bool sg_supported = !!(request->num_mapped_sgs);
+	u32 ioc = request->no_interrupt ? 0 : TRB_IOC;
 
 	if (priv_ep->type == USB_ENDPOINT_XFER_ISOC)
 		num_trb = priv_ep->interval;
@@ -1233,11 +1234,11 @@  static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
 			control |= pcs;
 
 		if (priv_ep->type == USB_ENDPOINT_XFER_ISOC  && !priv_ep->dir) {
-			control |= TRB_IOC | TRB_ISP;
+			control |= ioc | TRB_ISP;
 		} else {
 			/* for last element in TD or in SG list */
 			if (sg_iter == (num_trb - 1) && sg_iter != 0)
-				control |= pcs | TRB_IOC | TRB_ISP;
+				control |= pcs | ioc | TRB_ISP;
 		}
 
 		if (sg_iter)
@@ -1268,7 +1269,7 @@  static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
 	priv_req->num_of_trb = num_trb;
 
 	if (sg_iter == 1)
-		trb->control |= cpu_to_le32(TRB_IOC | TRB_ISP);
+		trb->control |= cpu_to_le32(ioc | TRB_ISP);
 
 	if (priv_dev->dev_ver < DEV_VER_V2 &&
 	    (priv_ep->flags & EP_TDLCHK_EN)) {