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

Commit 07e7f47b authored by Felipe Balbi's avatar Felipe Balbi
Browse files

usb: dwc3: workaround: metastability state on Run/Stop bit



All revisions prior to 2.20a have a known issue which
causes metastability state on Run/Stop bit if we
configure the core to work on any of the USB2-only
speeds.

The suggested workaround is just to never configure the
core to anything other than SuperSpeed.

Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 1522d703
Loading
Loading
Loading
Loading
+18 −1
Original line number Original line Diff line number Diff line
@@ -1356,6 +1356,23 @@ static int dwc3_gadget_start(struct usb_gadget *g,


	reg = dwc3_readl(dwc->regs, DWC3_DCFG);
	reg = dwc3_readl(dwc->regs, DWC3_DCFG);
	reg &= ~(DWC3_DCFG_SPEED_MASK);
	reg &= ~(DWC3_DCFG_SPEED_MASK);

	/**
	 * WORKAROUND: DWC3 revision < 2.20a have an issue
	 * which would cause metastability state on Run/Stop
	 * bit if we try to force the IP to USB2-only mode.
	 *
	 * Because of that, we cannot configure the IP to any
	 * speed other than the SuperSpeed
	 *
	 * Refers to:
	 *
	 * STAR#9000525659: Clock Domain Crossing on DCTL in
	 * USB 2.0 Mode
	 */
	if (dwc->revision < DWC3_REVISION_220A)
		reg |= DWC3_DCFG_SUPERSPEED;
	else
		reg |= dwc->maximum_speed;
		reg |= dwc->maximum_speed;
	dwc3_writel(dwc->regs, DWC3_DCFG, reg);
	dwc3_writel(dwc->regs, DWC3_DCFG, reg);