Skip to content

Commit bae2bc7

Browse files
Minas Harutyunyangregkh
authored andcommitted
usb: dwc2: host: Fix remote wakeup from hibernation
Starting from core v4.30a changed order of programming GPWRDN_PMUACTV to 0 in case of exit from hibernation on remote wakeup signaling from device. Fixes: c5c403d ("usb: dwc2: Add host/device hibernation functions") CC: stable@vger.kernel.org Signed-off-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> Link: https://lore.kernel.org/r/99385ec55ce73445b6fbd0f471c9bd40eb1c9b9e.1708939799.git.Minas.Harutyunyan@synopsys.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3c7b985 commit bae2bc7

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

drivers/usb/dwc2/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,7 @@ struct dwc2_hsotg {
10981098
bool needs_byte_swap;
10991099

11001100
/* DWC OTG HW Release versions */
1101+
#define DWC2_CORE_REV_4_30a 0x4f54430a
11011102
#define DWC2_CORE_REV_2_71a 0x4f54271a
11021103
#define DWC2_CORE_REV_2_72a 0x4f54272a
11031104
#define DWC2_CORE_REV_2_80a 0x4f54280a

drivers/usb/dwc2/hcd.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5624,10 +5624,12 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup,
56245624
dwc2_writel(hsotg, hr->hcfg, HCFG);
56255625

56265626
/* De-assert Wakeup Logic */
5627-
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5628-
gpwrdn &= ~GPWRDN_PMUACTV;
5629-
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5630-
udelay(10);
5627+
if (!(rem_wakeup && hsotg->hw_params.snpsid >= DWC2_CORE_REV_4_30a)) {
5628+
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5629+
gpwrdn &= ~GPWRDN_PMUACTV;
5630+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5631+
udelay(10);
5632+
}
56315633

56325634
hprt0 = hr->hprt0;
56335635
hprt0 |= HPRT0_PWR;
@@ -5652,6 +5654,13 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup,
56525654
hprt0 |= HPRT0_RES;
56535655
dwc2_writel(hsotg, hprt0, HPRT0);
56545656

5657+
/* De-assert Wakeup Logic */
5658+
if ((rem_wakeup && hsotg->hw_params.snpsid >= DWC2_CORE_REV_4_30a)) {
5659+
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5660+
gpwrdn &= ~GPWRDN_PMUACTV;
5661+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5662+
udelay(10);
5663+
}
56555664
/* Wait for Resume time and then program HPRT again */
56565665
mdelay(100);
56575666
hprt0 &= ~HPRT0_RES;

0 commit comments

Comments
 (0)