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

Commit 42750d4a authored by Manu Gautam's avatar Manu Gautam Committed by Gerrit - the friendly Code Review server
Browse files

usb: dwc3: gadget: Fix TXFIFO resize logic for non-zero EPs



Commit 93940d36 ("dwc3: gadget: Use TXFIFO register based
on used dwc3 version") incorrectly used EP-0's TXFIFO 'size'
as start address of TXFIFOs instead of using TXFSTADDR_N of
EP-0. This results in incorrect programming of TXFIFOs.
Fix this by using TXFIFOSIZ0s' TXFSTADDR_N (Bits 31:16) which
is same for both usb3 and usb31 version cores.

Change-Id: Iccc6b0b5560d6c460923f5ca62f6b1647d30c652
Signed-off-by: default avatarManu Gautam <mgautam@codeaurora.org>
parent d79aa3e4
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ void dwc3_ep_inc_deq(struct dwc3_ep *dep)
int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc, struct dwc3_ep *dep)
{
	int		fifo_size, mdwidth, max_packet = 1024;
	int		tmp, mult = 1, size;
	int		tmp, mult = 1, fifo_0_start;

	if (!dwc->needs_fifo_resize || !dwc->tx_fifo_size)
		return 0;
@@ -239,13 +239,11 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc, struct dwc3_ep *dep)
	fifo_size = DIV_ROUND_UP(tmp, mdwidth);
	dep->fifo_depth = fifo_size;

	size = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(0));
	if (dwc3_is_usb31(dwc))
		size = DWC31_GTXFIFOSIZ_TXFDEF(size);
	else
		size = DWC3_GTXFIFOSIZ_TXFDEF(size);
	/* Check if TXFIFOs start at non-zero addr */
	tmp = dwc3_readl(dwc->regs, DWC3_GTXFIFOSIZ(0));
	fifo_0_start = DWC3_GTXFIFOSIZ_TXFSTADDR(tmp);

	fifo_size |= (size + (dwc->last_fifo_depth << 16));
	fifo_size |= (fifo_0_start + (dwc->last_fifo_depth << 16));
	if (dwc3_is_usb31(dwc))
		dwc->last_fifo_depth += DWC31_GTXFIFOSIZ_TXFDEF(fifo_size);
	else