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

Commit 62ff8c0a authored by Thinh Nguyen's avatar Thinh Nguyen Committed by Gerrit - the friendly Code Review server
Browse files

usb: dwc3: gadget: Check for disabled LPM quirk



If the device doesn't support LPM, make sure to disable the LPM
capability and don't advertise to the host that it supports it.

Change-Id: I29ceac849220b06d2a01fa14f00483b10d7acfc0
Acked-by: default avatarFelipe Balbi <balbi@kernel.org>
Signed-off-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/9e68527ff932b1646f92a7593d4092a903754666.1618366071.git.Thinh.Nguyen@synopsys.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-Commit: 475e8be53d0496f9bc6159f4abb3ff5f9b90e8de
Git-Repo: https://android.googlesource.com/kernel/common/


Signed-off-by: default avatarUdipto Goswami <ugoswami@codeaurora.org>
parent 286f4af0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1437,6 +1437,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
				"snps,usb3_lpm_capable");
	dwc->usb2_lpm_disable = device_property_read_bool(dev,
				"snps,usb2-lpm-disable");
	dwc->usb2_gadget_lpm_disable = device_property_read_bool(dev,
				"snps,usb2-gadget-lpm-disable");
	device_property_read_u8(dev, "snps,rx-thr-num-pkt-prd",
				&rx_thr_num_pkt_prd);
	device_property_read_u8(dev, "snps,rx-max-burst-prd",
+1 −0
Original line number Diff line number Diff line
@@ -1339,6 +1339,7 @@ struct dwc3 {
	unsigned		dis_start_transfer_quirk:1;
	unsigned		usb3_lpm_capable:1;
	unsigned		usb2_lpm_disable:1;
	unsigned		usb2_gadget_lpm_disable:1;

	unsigned		disable_scramble_quirk:1;
	unsigned		u2exit_lfps_quirk:1;
+8 −1
Original line number Diff line number Diff line
@@ -3800,6 +3800,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
	/* Enable USB2 LPM Capability */

	if ((dwc->revision > DWC3_REVISION_194A) &&
	    !dwc->usb2_gadget_lpm_disable &&
	    (speed != DWC3_DSTS_SUPERSPEED) &&
	    (speed != DWC3_DSTS_SUPERSPEED_PLUS)) {
		reg = dwc3_readl(dwc->regs, DWC3_DCFG);
@@ -3827,6 +3828,12 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)

		dwc3_writel(dwc->regs, DWC3_DCTL, reg);
	} else {
		if (dwc->usb2_gadget_lpm_disable) {
			reg = dwc3_readl(dwc->regs, DWC3_DCFG);
			reg &= ~DWC3_DCFG_LPM_CAP;
			dwc3_writel(dwc->regs, DWC3_DCFG, reg);
		}

		reg = dwc3_readl(dwc->regs, DWC3_DCTL);
		reg &= ~DWC3_DCTL_HIRD_THRES_MASK;
		dwc3_writel(dwc->regs, DWC3_DCTL, reg);
@@ -4369,7 +4376,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)
	dwc->gadget.speed		= USB_SPEED_UNKNOWN;
	dwc->gadget.sg_supported	= true;
	dwc->gadget.name		= "dwc3-gadget";
	dwc->gadget.lpm_capable		= true;
	dwc->gadget.lpm_capable		= !dwc->usb2_gadget_lpm_disable;

	/*
	 * FIXME We might be setting max_speed to <SUPER, however versions