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

Commit 00e31157 authored by Ivaylo Georgiev's avatar Ivaylo Georgiev
Browse files

Revert "usb: dwc3: gadget: combine unaligned and zero flags"



This reverts commit 420b1237.

This is a preparation change for merging android-4.19.57 into
msm-4.19 branch.

Reverted due to BootTimeRunner regression.

Change-Id: I412da53e0813d9964bdf42a2facd271d7cafd746
Signed-off-by: default avatarIvaylo Georgiev <irgeorgiev@codeaurora.org>
parent 569916e7
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -847,11 +847,11 @@ struct dwc3_hwparams {
 * @epnum: endpoint number to which this request refers
 * @epnum: endpoint number to which this request refers
 * @trb: pointer to struct dwc3_trb
 * @trb: pointer to struct dwc3_trb
 * @trb_dma: DMA address of @trb
 * @trb_dma: DMA address of @trb
 * @needs_extra_trb: true when request needs one extra TRB (either due to ZLP
 * @unaligned: true for OUT endpoints with length not divisible by maxp
 *	or unaligned OUT)
 * @direction: IN or OUT direction flag
 * @direction: IN or OUT direction flag
 * @mapped: true when request has been dma-mapped
 * @mapped: true when request has been dma-mapped
 * @started: request is started
 * @started: request is started
 * @zero: wants a ZLP
 */
 */
struct dwc3_request {
struct dwc3_request {
	struct usb_request	request;
	struct usb_request	request;
@@ -867,10 +867,11 @@ struct dwc3_request {
	struct dwc3_trb		*trb;
	struct dwc3_trb		*trb;
	dma_addr_t		trb_dma;
	dma_addr_t		trb_dma;


	unsigned		needs_extra_trb:1;
	unsigned		unaligned:1;
	unsigned		direction:1;
	unsigned		direction:1;
	unsigned		mapped:1;
	unsigned		mapped:1;
	unsigned		started:1;
	unsigned		started:1;
	unsigned		zero:1;
};
};


/*
/*
+9 −9
Original line number Original line Diff line number Diff line
@@ -1068,7 +1068,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
			struct dwc3	*dwc = dep->dwc;
			struct dwc3	*dwc = dep->dwc;
			struct dwc3_trb	*trb;
			struct dwc3_trb	*trb;


			req->needs_extra_trb = true;
			req->unaligned = true;


			/* prepare normal TRB */
			/* prepare normal TRB */
			dwc3_prepare_one_trb(dep, req, true, i);
			dwc3_prepare_one_trb(dep, req, true, i);
@@ -1112,7 +1112,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
		struct dwc3	*dwc = dep->dwc;
		struct dwc3	*dwc = dep->dwc;
		struct dwc3_trb	*trb;
		struct dwc3_trb	*trb;


		req->needs_extra_trb = true;
		req->unaligned = true;


		/* prepare normal TRB */
		/* prepare normal TRB */
		dwc3_prepare_one_trb(dep, req, true, 0);
		dwc3_prepare_one_trb(dep, req, true, 0);
@@ -1128,7 +1128,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
		struct dwc3	*dwc = dep->dwc;
		struct dwc3	*dwc = dep->dwc;
		struct dwc3_trb	*trb;
		struct dwc3_trb	*trb;


		req->needs_extra_trb = true;
		req->zero = true;


		/* prepare normal TRB */
		/* prepare normal TRB */
		dwc3_prepare_one_trb(dep, req, true, 0);
		dwc3_prepare_one_trb(dep, req, true, 0);
@@ -1410,7 +1410,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
					dwc3_ep_inc_deq(dep);
					dwc3_ep_inc_deq(dep);
				}
				}


				if (r->needs_extra_trb) {
				if (r->unaligned || r->zero) {
					trb = r->trb + r->num_pending_sgs + 1;
					trb = r->trb + r->num_pending_sgs + 1;
					trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
					trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
					dwc3_ep_inc_deq(dep);
					dwc3_ep_inc_deq(dep);
@@ -1421,7 +1421,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
				trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
				trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
				dwc3_ep_inc_deq(dep);
				dwc3_ep_inc_deq(dep);


				if (r->needs_extra_trb) {
				if (r->unaligned || r->zero) {
					trb = r->trb + 1;
					trb = r->trb + 1;
					trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
					trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
					dwc3_ep_inc_deq(dep);
					dwc3_ep_inc_deq(dep);
@@ -2250,8 +2250,7 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
	 * with one TRB pending in the ring. We need to manually clear HWO bit
	 * with one TRB pending in the ring. We need to manually clear HWO bit
	 * from that TRB.
	 * from that TRB.
	 */
	 */

	if ((req->zero || req->unaligned) && !(trb->ctrl & DWC3_TRB_CTRL_CHN)) {
	if (req->needs_extra_trb && !(trb->ctrl & DWC3_TRB_CTRL_CHN)) {
		trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
		trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
		return 1;
		return 1;
	}
	}
@@ -2328,10 +2327,11 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
		ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event,
		ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event,
				status);
				status);


	if (req->needs_extra_trb) {
	if (req->unaligned || req->zero) {
		ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event,
		ret = dwc3_gadget_ep_reclaim_trb_linear(dep, req, event,
				status);
				status);
		req->needs_extra_trb = false;
		req->unaligned = false;
		req->zero = false;
	}
	}


	req->request.actual = req->request.length - req->remaining;
	req->request.actual = req->request.length - req->remaining;