Skip to contentSkip to conversation

usb: cdns3: skip set TRB_IOC when usb_request: no_interrupt is true

PATCH In review Frank Li 3 participants 5 messages Oct 27, 2023 – Nov 27, 2023

Subsystems (3)
lore
Share & tools
lore

Frank Li

author maintainer
#0 lore raw

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

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().

---
 drivers/usb/cdns3/cdns3-gadget.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/cdns3/cdns3-gadget.c +4 -3
index 69a44bd7e5d02..cd08897f8da8b 100644
@@ -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)) {
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Frank Li

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().

Peter

Quoted 42 lines
---
 drivers/usb/cdns3/cdns3-gadget.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/cdns3/cdns3-gadget.c +4 -3
index 69a44bd7e5d02..cd08897f8da8b 100644
@@ -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)) {
Signature · 1 line
2.34.1
Signature · 2 lines
Thanks,
Peter Chen
author maintainer
#2 lore raw
Quoted 10 lines · Peter Chen
Quoted 7 lines · Frank Li

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().

@Greg:
ping

Frank

Quoted 49 lines

Peter

Quoted 42 lines
---
 drivers/usb/cdns3/cdns3-gadget.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/cdns3/cdns3-gadget.c +4 -3
index 69a44bd7e5d02..cd08897f8da8b 100644
@@ -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)) {
Signature · 1 line
2.34.1
Signature · 2 lines
Thanks,
Peter Chen
maintainer
#3 lore raw
Quoted 8 lines · Frank Li
Quoted 7 lines · Peter Chen
Quoted 6 lines · Frank Li

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().

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

@Greg:
ping

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

thanks,

greg k-h

author maintainer
#4 lore raw
Quoted 11 lines · Greg KH
Quoted 10 lines · Frank Li
Quoted 9 lines · Peter Chen
Quoted 7 lines · Frank Li

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().

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

@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

Quoted 4 lines

thanks,

greg k-h