[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2e129f26-62a7-cb13-2d6c-ba9aac325a5e@synopsys.com>
Date: Fri, 15 Oct 2021 10:53:49 +0000
From: Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>
To: Amelie Delaunay <amelie.delaunay@...s.st.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC: "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
Fabrice Gasnier <fabrice.gasnier@...s.st.com>
Subject: Re: [PATCH 1/3] usb: dwc2: drd: fix dwc2_force_mode call in
dwc2_ovr_init
On 10/5/2021 1:53 PM, Amelie Delaunay wrote:
> Instead of forcing the role to Device, check the dr_mode configuration.
> If the core is Host only, force the mode to Host, this to avoid the
> dwc2_force_mode warning:
> WARNING: CPU: 1 PID: 21 at drivers/usb/dwc2/core.c:615 dwc2_drd_init+0x104/0x17c
>
> When forcing mode to Host, dwc2_force_mode may sleep the time the host
> role is applied. To avoid sleeping while atomic context, move the call
> to dwc2_force_mode after spin_unlock_irqrestore. It is safe, as
> interrupts are not yet unmasked here.
>
> Fixes: 17f934024e84 ("usb: dwc2: override PHY input signals with usb role switch support")
> Signed-off-by: Amelie Delaunay <amelie.delaunay@...s.st.com>
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@...opsys.com>
> ---
> drivers/usb/dwc2/drd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc2/drd.c b/drivers/usb/dwc2/drd.c
> index 2d4176f5788e..80eae88d76dd 100644
> --- a/drivers/usb/dwc2/drd.c
> +++ b/drivers/usb/dwc2/drd.c
> @@ -25,9 +25,9 @@ static void dwc2_ovr_init(struct dwc2_hsotg *hsotg)
> gotgctl &= ~(GOTGCTL_BVALOVAL | GOTGCTL_AVALOVAL | GOTGCTL_VBVALOVAL);
> dwc2_writel(hsotg, gotgctl, GOTGCTL);
>
> - dwc2_force_mode(hsotg, false);
> -
> spin_unlock_irqrestore(&hsotg->lock, flags);
> +
> + dwc2_force_mode(hsotg, (hsotg->dr_mode == USB_DR_MODE_HOST));
> }
>
> static int dwc2_ovr_avalid(struct dwc2_hsotg *hsotg, bool valid)
>
Powered by blists - more mailing lists