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

Commit f5099f43 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: dwc3: Set gadget max speed as per core's max speed of operation



On custom hardwares of 8974 platform, superspeed mode support is
disabled in hardware by having Highspeed port instead of superspeed
port. WHCK tests might fail if the tests are executed on this platform
due to wrong value of bcdUSB of device descriptor sent to host. This
is due to wrong value set for gadget's max speed. Hence set gadget
maximum speed based on maximum speed at which USB3 core is configured
to operate.

CRs-Fixed: 539890
Change-Id: Ic7d18aa889ebba508c556266dd7f815092b951f6
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 06300feb
Loading
Loading
Loading
Loading
+24 −5
Original line number Diff line number Diff line
@@ -1786,10 +1786,25 @@ void dwc3_gadget_restart(struct dwc3 *dwc)
	 * STAR#9000525659: Clock Domain Crossing on DCTL in
	 * USB 2.0 Mode
	 */
	if (dwc->revision < DWC3_REVISION_220A)
	if (dwc->revision < DWC3_REVISION_220A) {
		reg |= DWC3_DCFG_SUPERSPEED;
	else
		reg |= dwc->maximum_speed;
	} else {
		switch (dwc->maximum_speed) {
		case USB_SPEED_LOW:
			reg |= DWC3_DSTS_LOWSPEED;
			break;
		case USB_SPEED_FULL:
			reg |= DWC3_DSTS_FULLSPEED2;
			break;
		case USB_SPEED_HIGH:
			reg |= DWC3_DSTS_HIGHSPEED;
			break;
		case USB_SPEED_SUPER:	/* FALLTHROUGH */
		case USB_SPEED_UNKNOWN:	/* FALTHROUGH */
		default:
			reg |= DWC3_DSTS_SUPERSPEED;
		}
	}
	dwc3_writel(dwc->regs, DWC3_DCFG, reg);

	dwc->start_config_issued = false;
@@ -1876,7 +1891,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
			reg |= DWC3_DSTS_LOWSPEED;
			break;
		case USB_SPEED_FULL:
			reg |= DWC3_DSTS_FULLSPEED1;
			reg |= DWC3_DSTS_FULLSPEED2;
			break;
		case USB_SPEED_HIGH:
			reg |= DWC3_DSTS_HIGHSPEED;
@@ -3054,7 +3069,11 @@ int dwc3_gadget_init(struct dwc3 *dwc)
	}

	dwc->gadget.ops			= &dwc3_gadget_ops;
	if (dwc->maximum_speed == USB_SPEED_SUPER)
		dwc->gadget.max_speed		= USB_SPEED_SUPER;
	else
		dwc->gadget.max_speed		= USB_SPEED_HIGH;

	dwc->gadget.speed		= USB_SPEED_UNKNOWN;
	dwc->gadget.sg_supported	= true;
	dwc->gadget.name		= "dwc3-gadget";