Skip to content

Commit

Permalink
usb: cdns3: skip set TRB_IOC when usb_request: no_interrupt is true
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Peter Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
nxpfrankli authored and gregkh committed Nov 22, 2023
1 parent a776452 commit 7836be3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/usb/cdns3/cdns3-gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,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;
Expand Down Expand Up @@ -1235,11 +1236,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)
Expand Down Expand Up @@ -1270,7 +1271,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)) {
Expand Down

0 comments on commit 7836be3

Please sign in to comment.