Skip to content

Commit 4664b73

Browse files
Junlisuzhougregkh
authored andcommitted
usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep
SS_CON and U3 wakeup need 'ref_clk' on. iMX8MP turn off it while system sleep, So disable these wakeup source and only enable DP/DM wakeup source for host mode. Reviewed-by: Xu Yang <[email protected]> Signed-off-by: Li Jun <[email protected]> Acked-by: Thinh Nguyen <[email protected]> Signed-off-by: Frank Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a9400f1 commit 4664b73

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/usb/dwc3/dwc3-imx8mp.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ static void imx8mp_configure_glue(struct dwc3_imx8mp *dwc3_imx)
9797
writel(value, dwc3_imx->glue_base + USB_CTRL1);
9898
}
9999

100-
static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx)
100+
static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx,
101+
pm_message_t msg)
101102
{
102103
struct dwc3 *dwc3 = platform_get_drvdata(dwc3_imx->dwc3);
103104
u32 val;
@@ -107,12 +108,14 @@ static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx)
107108

108109
val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
109110

110-
if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci)
111-
val |= USB_WAKEUP_EN | USB_WAKEUP_SS_CONN |
112-
USB_WAKEUP_U3_EN | USB_WAKEUP_DPDM_EN;
113-
else if (dwc3->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE)
111+
if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) {
112+
val |= USB_WAKEUP_EN | USB_WAKEUP_DPDM_EN;
113+
if (PMSG_IS_AUTO(msg))
114+
val |= USB_WAKEUP_SS_CONN | USB_WAKEUP_U3_EN;
115+
} else {
114116
val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN |
115117
USB_WAKEUP_VBUS_SRC_SESS_VAL;
118+
}
116119

117120
writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
118121
}
@@ -277,7 +280,7 @@ static int dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, pm_message_t msg)
277280

278281
/* Wakeup enable */
279282
if (PMSG_IS_AUTO(msg) || device_may_wakeup(dwc3_imx->dev))
280-
dwc3_imx8mp_wakeup_enable(dwc3_imx);
283+
dwc3_imx8mp_wakeup_enable(dwc3_imx, msg);
281284

282285
dwc3_imx->pm_suspended = true;
283286

0 commit comments

Comments
 (0)