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

Commit b4f44000 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "dwc3: Preserve TxFIFO of IN/INT EP for UDC without tx-fifo-resize"

parents d041f957 b8f28689
Loading
Loading
Loading
Loading
+23 −15
Original line number Diff line number Diff line
@@ -598,23 +598,31 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl)
		break;

	case USB_STATE_ADDRESS:
		/*
		 * If tx-fifo-resize flag is not set for the controller, then
		 * do not clear existing allocated TXFIFO since we do not
		 * allocate it again in dwc3_gadget_resize_tx_fifos
		 */
		if (dwc->needs_fifo_resize) {
			/* Read ep0IN related TXFIFO size */
			dwc->last_fifo_depth = (dwc3_readl(dwc->regs,
						DWC3_GTXFIFOSIZ(0)) & 0xFFFF);
		/* Clear existing allocated TXFIFO for all IN eps except ep0 */
			/* Clear existing TXFIFO for all IN eps except ep0 */
			for (num = 0; num < dwc->num_in_eps; num++) {
				dep = dwc->eps[(num << 1) | 1];
				if (num) {
				dwc3_writel(dwc->regs, DWC3_GTXFIFOSIZ(num), 0);
					dwc3_writel(dwc->regs,
						DWC3_GTXFIFOSIZ(num), 0);
					dep->fifo_depth = 0;
				} else {
					dep->fifo_depth = dwc->last_fifo_depth;
				}

			dev_dbg(dwc->dev, "%s(): %s dep->fifo_depth:%x\n",
				dev_dbg(dwc->dev, "%s(): %s fifo_depth:%x\n",
					__func__, dep->name, dep->fifo_depth);
				dbg_event(0xFF, "fifo_reset", dep->number);
			}
		}

		ret = dwc3_ep0_delegate_req(dwc, ctrl);
		/* if the cfg matches and the cfg is non zero */
+2 −1
Original line number Diff line number Diff line
@@ -218,7 +218,8 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc, struct dwc3_ep *dep)
	tmp = ((max_packet + mdwidth) * mult) + mdwidth;
	fifo_size = DIV_ROUND_UP(tmp, mdwidth);
	dep->fifo_depth = fifo_size;
	fifo_size |= (dwc->last_fifo_depth << 16);
	fifo_size |= (dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(0)) & 0xffff0000)
						+ (dwc->last_fifo_depth << 16);
	dwc->last_fifo_depth += (fifo_size & 0xffff);

	dev_dbg(dwc->dev, "%s ep_num:%d last_fifo_depth:%04x fifo_depth:%d\n",