Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 794eda45 authored by Felipe Balbi's avatar Felipe Balbi Committed by Hemant Kumar
Browse files

usb: dwc3: gadget: always use frame number from XferNotReady



The core requires the extra two bits of information for properly
scheduling Isochronous transfers. This means that we can't rely on
__dwc3_gadget_get_frame(). Let's always cache uFrame number from
XferNotReady instead.

Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Git-commit: 5828cada99086c41cf23c4d4b63090b23c473008
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


[hemantk@codeaurora.org: resolved merge conflict]
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
Change-Id: I4417a8201689902bd55e4f98e6b02f66bf571fbb
parent 74c32cc6
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -1416,8 +1416,7 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
	return DWC3_DSTS_SOFFN(reg);
}

static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
		struct dwc3_ep *dep, u32 cur_uf)
static void __dwc3_gadget_start_isoc(struct dwc3 *dwc, struct dwc3_ep *dep)
{
	if (list_empty(&dep->pending_list)) {
		dev_info(dwc->dev, "%s: ran out of requests\n",
@@ -1430,7 +1429,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
	 * Schedule the first trb for one interval in the future or at
	 * least 4 microframes.
	 */
	dep->frame_number = cur_uf + max_t(u32, 4, dep->interval);
	dep->frame_number += max_t(u32, 4, dep->interval);
	__dwc3_gadget_kick_transfer(dep, dep->frame_number);
}

@@ -1441,8 +1440,9 @@ static void dwc3_gadget_start_isoc(struct dwc3 *dwc,

	mask = ~(dep->interval - 1);
	cur_uf = event->parameters & mask;
	dep->frame_number = cur_uf;

	__dwc3_gadget_start_isoc(dwc, dep, cur_uf);
	__dwc3_gadget_start_isoc(dwc, dep);
}

static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
@@ -1483,10 +1483,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
				dwc3_stop_active_transfer(dwc, dep->number, true);
				dep->flags = DWC3_EP_ENABLED;
			} else {
				u32 cur_uf;

				cur_uf = __dwc3_gadget_get_frame(dwc);
				__dwc3_gadget_start_isoc(dwc, dep, cur_uf);
				__dwc3_gadget_start_isoc(dwc, dep);
				dep->flags &= ~DWC3_EP_PENDING_REQUEST;
			}
			return 0;