Commit d37b939c authored by Artur Petrosyan's avatar Artur Petrosyan Committed by Greg Kroah-Hartman

usb: dwc2: Update enter clock gating when port is suspended

Updates the implementation of entering clock gating mode
when core receives port suspend.
Instead of setting the required bit fields of the registers
inline, called the "dwc2_host_enter_clock_gating()" function.
Signed-off-by: default avatarArtur Petrosyan <Arthur.Petrosyan@synopsys.com>
Link: https://lore.kernel.org/r/20210413073653.9F493A0094@mailhost.synopsys.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5f9e60c0
...@@ -3298,7 +3298,6 @@ static int dwc2_host_is_b_hnp_enabled(struct dwc2_hsotg *hsotg) ...@@ -3298,7 +3298,6 @@ static int dwc2_host_is_b_hnp_enabled(struct dwc2_hsotg *hsotg)
int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex)
{ {
unsigned long flags; unsigned long flags;
u32 hprt0;
u32 pcgctl; u32 pcgctl;
u32 gotgctl; u32 gotgctl;
int ret = 0; int ret = 0;
...@@ -3323,22 +3322,12 @@ int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex) ...@@ -3323,22 +3322,12 @@ int dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex)
break; break;
case DWC2_POWER_DOWN_PARAM_HIBERNATION: case DWC2_POWER_DOWN_PARAM_HIBERNATION:
case DWC2_POWER_DOWN_PARAM_NONE: case DWC2_POWER_DOWN_PARAM_NONE:
default:
hprt0 = dwc2_read_hprt0(hsotg);
hprt0 |= HPRT0_SUSP;
dwc2_writel(hsotg, hprt0, HPRT0);
hsotg->bus_suspended = true;
/* /*
* If power_down is supported, Phy clock will be suspended * If not hibernation nor partial power down are supported,
* after registers are backuped. * clock gating is used to save power.
*/ */
if (!hsotg->params.power_down) { dwc2_host_enter_clock_gating(hsotg);
/* Suspend the Phy Clock */ break;
pcgctl = dwc2_readl(hsotg, PCGCTL);
pcgctl |= PCGCTL_STOPPCLK;
dwc2_writel(hsotg, pcgctl, PCGCTL);
udelay(10);
}
} }
/* For HNP the bus must be suspended for at least 200ms */ /* For HNP the bus must be suspended for at least 200ms */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment