usb: cdns3: gadget: add CHAIN and ISP bit for sg list use case
authorPeter Chen <peter.chen@nxp.com>
Thu, 10 Sep 2020 09:11:26 +0000 (17:11 +0800)
committerFelipe Balbi <balbi@kernel.org>
Fri, 2 Oct 2020 06:57:45 +0000 (09:57 +0300)
For sg buffer list use case, we need to add ISP for each TRB, and
add CHAIN bit for each TRB except for the last TRB.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/cdns3/gadget.c

index d33947d215f93fc1dd9bf4ca7b37fd2b31864493..50aa993bff3ce420f95d9fcfedb5c40fd6a1ada6 100644 (file)
@@ -1220,8 +1220,14 @@ static int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
                else
                        priv_req->trb->control = cpu_to_le32(control);
 
-               if (sg_supported)
+               if (sg_supported) {
+                       trb->control |= TRB_ISP;
+                       /* Don't set chain bit for last TRB */
+                       if (sg_iter < num_trb - 1)
+                               trb->control |= TRB_CHAIN;
+
                        s = sg_next(s);
+               }
 
                control = 0;
                ++sg_iter;