linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] usb: dwc3: core: fix a issue about clear connect state
@ 2020-10-18 13:47 Dejin Zheng
  2020-10-18 17:40 ` Sergei Shtylyov
  2020-10-27  9:12 ` Felipe Balbi
  0 siblings, 2 replies; 3+ messages in thread
From: Dejin Zheng @ 2020-10-18 13:47 UTC (permalink / raw)
  To: balbi, gregkh, linux-usb; +Cc: linux-kernel, Dejin Zheng

According to Synopsys Programming Guide chapter 2.2 Register Resets,
it cannot reset the DCTL register by set DCTL.CSFTRST for Core Soft Reset,
if DWC3 controller as a slave device and stay connected with a usb host,
then, reboot linux, it will fail to reinitialize dwc3 as a slave device
when the DWC3 controller did not power off. because the connection status
is incorrect, so we also need clear DCTL.RUN_STOP bit for disable connect
when do core soft reset.

Fixes: f59dcab176293b6 ("usb: dwc3: core: improve reset sequence")
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
---
 drivers/usb/dwc3/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 2eb34c8b4065..239636c454c2 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -256,6 +256,7 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
 
 	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
 	reg |= DWC3_DCTL_CSFTRST;
+	reg &= ~DWC3_DCTL_RUN_STOP;
 	dwc3_writel(dwc->regs, DWC3_DCTL, reg);
 
 	/*
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] usb: dwc3: core: fix a issue about clear connect state
  2020-10-18 13:47 [PATCH v1] usb: dwc3: core: fix a issue about clear connect state Dejin Zheng
@ 2020-10-18 17:40 ` Sergei Shtylyov
  2020-10-27  9:12 ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2020-10-18 17:40 UTC (permalink / raw)
  To: Dejin Zheng, balbi, gregkh, linux-usb; +Cc: linux-kernel

Hello!

On 10/18/20 4:47 PM, Dejin Zheng wrote:

> According to Synopsys Programming Guide chapter 2.2 Register Resets,
> it cannot reset the DCTL register by set DCTL.CSFTRST for Core Soft Reset,

   s/set/setting/.

> if DWC3 controller as a slave device and stay connected with a usb host,
> then, reboot linux, it will fail to reinitialize dwc3 as a slave device

   s/reboot/while rebooting/.

> when the DWC3 controller did not power off. because the connection status
> is incorrect, so we also need clear DCTL.RUN_STOP bit for disable connect
                               ^ to                               ^ ing

> when do core soft reset.
         ^ ing

> Fixes: f59dcab176293b6 ("usb: dwc3: core: improve reset sequence")
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] usb: dwc3: core: fix a issue about clear connect state
  2020-10-18 13:47 [PATCH v1] usb: dwc3: core: fix a issue about clear connect state Dejin Zheng
  2020-10-18 17:40 ` Sergei Shtylyov
@ 2020-10-27  9:12 ` Felipe Balbi
  1 sibling, 0 replies; 3+ messages in thread
From: Felipe Balbi @ 2020-10-27  9:12 UTC (permalink / raw)
  To: Dejin Zheng, gregkh, linux-usb; +Cc: linux-kernel, Dejin Zheng

Hi,

Dejin Zheng <zhengdejin5@gmail.com> writes:
> According to Synopsys Programming Guide chapter 2.2 Register Resets,
> it cannot reset the DCTL register by set DCTL.CSFTRST for Core Soft Reset,
> if DWC3 controller as a slave device and stay connected with a usb host,
> then, reboot linux, it will fail to reinitialize dwc3 as a slave device
> when the DWC3 controller did not power off. because the connection status
> is incorrect, so we also need clear DCTL.RUN_STOP bit for disable connect
> when do core soft reset.
>
> Fixes: f59dcab176293b6 ("usb: dwc3: core: improve reset sequence")
> Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
> ---
>  drivers/usb/dwc3/core.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 2eb34c8b4065..239636c454c2 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -256,6 +256,7 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
>  
>  	reg = dwc3_readl(dwc->regs, DWC3_DCTL);
>  	reg |= DWC3_DCTL_CSFTRST;
> +	reg &= ~DWC3_DCTL_RUN_STOP;

as I mentioned in the other thread, I would rather figure out why we're
getting to probe() with RUN_STOP already set.

-- 
balbi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-27  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-18 13:47 [PATCH v1] usb: dwc3: core: fix a issue about clear connect state Dejin Zheng
2020-10-18 17:40 ` Sergei Shtylyov
2020-10-27  9:12 ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).