Skip to content

Commit 5724ff1

Browse files
Minas Harutyunyangregkh
authored andcommitted
usb: dwc2: gadget: Fix enter to hibernation for UTMI+ PHY
For UTMI+ PHY, according to programming guide, first should be set PMUACTV bit then STOPPCLK bit. Otherwise, when the device issues Remote Wakeup, then host notices disconnect instead. For ULPI PHY, above mentioned bits must be set in reversed order: STOPPCLK then PMUACTV. Fixes: 4483ef3 ("usb: dwc2: Add hibernation updates for ULPI PHY") Cc: stable <[email protected]> Signed-off-by: Minas Harutyunyan <[email protected]> Link: https://lore.kernel.org/r/692110d3c3d9bb2a91cedf24528a7710adc55452.1751881374.git.Minas.Harutyunyan@synopsys.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ef8abc0 commit 5724ff1

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

drivers/usb/dwc2/gadget.c

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5389,20 +5389,34 @@ int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg)
53895389
if (gusbcfg & GUSBCFG_ULPI_UTMI_SEL) {
53905390
/* ULPI interface */
53915391
gpwrdn |= GPWRDN_ULPI_LATCH_EN_DURING_HIB_ENTRY;
5392-
}
5393-
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5394-
udelay(10);
5392+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5393+
udelay(10);
53955394

5396-
/* Suspend the Phy Clock */
5397-
pcgcctl = dwc2_readl(hsotg, PCGCTL);
5398-
pcgcctl |= PCGCTL_STOPPCLK;
5399-
dwc2_writel(hsotg, pcgcctl, PCGCTL);
5400-
udelay(10);
5395+
/* Suspend the Phy Clock */
5396+
pcgcctl = dwc2_readl(hsotg, PCGCTL);
5397+
pcgcctl |= PCGCTL_STOPPCLK;
5398+
dwc2_writel(hsotg, pcgcctl, PCGCTL);
5399+
udelay(10);
54015400

5402-
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5403-
gpwrdn |= GPWRDN_PMUACTV;
5404-
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5405-
udelay(10);
5401+
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5402+
gpwrdn |= GPWRDN_PMUACTV;
5403+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5404+
udelay(10);
5405+
} else {
5406+
/* UTMI+ Interface */
5407+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5408+
udelay(10);
5409+
5410+
gpwrdn = dwc2_readl(hsotg, GPWRDN);
5411+
gpwrdn |= GPWRDN_PMUACTV;
5412+
dwc2_writel(hsotg, gpwrdn, GPWRDN);
5413+
udelay(10);
5414+
5415+
pcgcctl = dwc2_readl(hsotg, PCGCTL);
5416+
pcgcctl |= PCGCTL_STOPPCLK;
5417+
dwc2_writel(hsotg, pcgcctl, PCGCTL);
5418+
udelay(10);
5419+
}
54065420

54075421
/* Set flag to indicate that we are in hibernation */
54085422
hsotg->hibernated = 1;

0 commit comments

Comments
 (0)