mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
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: Felipe Balbi <balbi@kernel.org> Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/9e68527ff932b1646f92a7593d4092a903754666.1618366071.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Git-Commit: 475e8be53d0496f9bc6159f4abb3ff5f9b90e8de Git-Repo: https://android.googlesource.com/kernel/common/ Signed-off-by: Udipto Goswami <ugoswami@codeaurora.org>
This commit is contained in:
parent
286f4af0df
commit
62ff8c0acd
3 changed files with 11 additions and 1 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue