Message ID | 20240712-dwc-mp-v1-4-295e5c4e3ec9@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | usb: imx8mp: collect some improvement | expand |
On Fri, Jul 12, 2024, Frank Li wrote: > From: Li Jun <jun.li@nxp.com> > > 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 <xu.yang_2@nxp.com> > Signed-off-by: Li Jun <jun.li@nxp.com> > Signed-off-by: Frank Li <Frank.Li@nxp.com> > --- > drivers/usb/dwc3/dwc3-imx8mp.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c > index 5794bb75f7604..9f8c34d09a8e9 100644 > --- a/drivers/usb/dwc3/dwc3-imx8mp.c > +++ b/drivers/usb/dwc3/dwc3-imx8mp.c > @@ -96,7 +96,8 @@ static void imx8mp_configure_glue(struct dwc3_imx8mp *dwc3_imx) > writel(value, dwc3_imx->glue_base + USB_CTRL1); > } > > -static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) > +static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx, > + pm_message_t msg) > { > struct dwc3 *dwc3 = platform_get_drvdata(dwc3_imx->dwc3); > u32 val; > @@ -106,12 +107,14 @@ static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) > > val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); > > - if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) > - val |= USB_WAKEUP_EN | USB_WAKEUP_SS_CONN | > - USB_WAKEUP_U3_EN | USB_WAKEUP_DPDM_EN; > - else if (dwc3->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE) > + if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) { > + val |= USB_WAKEUP_EN | USB_WAKEUP_DPDM_EN; > + if (PMSG_IS_AUTO(msg)) > + val |= USB_WAKEUP_SS_CONN | USB_WAKEUP_U3_EN; > + } else { > val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN | > USB_WAKEUP_VBUS_SRC_SESS_VAL; > + } > > writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); > } > @@ -308,7 +311,7 @@ static int __maybe_unused dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, > > /* Wakeup enable */ > if (PMSG_IS_AUTO(msg) || device_may_wakeup(dwc3_imx->dev)) > - dwc3_imx8mp_wakeup_enable(dwc3_imx); > + dwc3_imx8mp_wakeup_enable(dwc3_imx, msg); > > dwc3_imx->pm_suspended = true; > > > -- > 2.34.1 > Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Thanks, Thinh
diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index 5794bb75f7604..9f8c34d09a8e9 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -96,7 +96,8 @@ static void imx8mp_configure_glue(struct dwc3_imx8mp *dwc3_imx) writel(value, dwc3_imx->glue_base + USB_CTRL1); } -static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) +static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx, + pm_message_t msg) { struct dwc3 *dwc3 = platform_get_drvdata(dwc3_imx->dwc3); u32 val; @@ -106,12 +107,14 @@ static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); - if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) - val |= USB_WAKEUP_EN | USB_WAKEUP_SS_CONN | - USB_WAKEUP_U3_EN | USB_WAKEUP_DPDM_EN; - else if (dwc3->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE) + if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) { + val |= USB_WAKEUP_EN | USB_WAKEUP_DPDM_EN; + if (PMSG_IS_AUTO(msg)) + val |= USB_WAKEUP_SS_CONN | USB_WAKEUP_U3_EN; + } else { val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN | USB_WAKEUP_VBUS_SRC_SESS_VAL; + } writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); } @@ -308,7 +311,7 @@ static int __maybe_unused dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, /* Wakeup enable */ if (PMSG_IS_AUTO(msg) || device_may_wakeup(dwc3_imx->dev)) - dwc3_imx8mp_wakeup_enable(dwc3_imx); + dwc3_imx8mp_wakeup_enable(dwc3_imx, msg); dwc3_imx->pm_suspended = true;