@@ -1071,7 +1071,14 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
unsigned int rem = length % maxp;
unsigned chain = true;
- if (sg_is_last(s))
+ /*
+ * IOMMU driver is coalescing the list of sgs which shares a
+ * page boundary into one and giving it to USB driver. With
+ * this the number of sgs mapped it not equal to the the number
+ * of sgs passed. Mark the chain bit to false if it is the last
+ * mapped sg.
+ */
+ if ((i == remaining - 1))
chain = false;
if (rem && usb_endpoint_dir_out(dep->endpoint.desc) && !chain) {