public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: William Wu <william.wu@rock-chips.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"frank.wang@rock-chips.com" <frank.wang@rock-chips.com>,
	"jianwei.zheng@rock-chips.com" <jianwei.zheng@rock-chips.com>,
	"yangbin@rock-chips.com" <yangbin@rock-chips.com>
Subject: Re: [PATCH v2] usb: dwc3: core: Avoid resume dwc3 if already suspended in pm resume
Date: Tue, 12 Sep 2023 00:08:09 +0000	[thread overview]
Message-ID: <20230912000802.nb5mk4e5toojyqis@synopsys.com> (raw)
In-Reply-To: <20230911033112.3321-1-william.wu@rock-chips.com>

Hi,

On Mon, Sep 11, 2023, William Wu wrote:
> If we enable PM runtime auto suspend for dwc3 on rockchip
> platforms (e.g. RK3562), it allows the dwc3 controller to
> enter runtime suspend if usb cable detached and power off
> the power domain of the controller. When system resume, if
> the dwc3 already in runtime suspended, it Shouldn't access
> the dwc3 registers in dwc3_resume() because its power domain
> maybe power off.
> 
> Test on RK3562 tablet, this patch can help to avoid kernel
> panic when accessing the dwc3 registers in dwc3_resume() if
> the dwc3 is in runtime suspended and it's power domain is
> power off.

The controller should be woken up before this step. Can you provide more
detail on what led to this?

e.g. some questions:
Who handles the waking up of the controller? Is it the phy driver? Is
the phy driver not detecting a resume? Or did the resume fail? Does this
occur consistently?

Thanks,
Thinh

> 
> Kernel panic - not syncing: Asynchronous SError Interrupt
> Hardware name: Rockchip RK3562 RK817 TABLET LP4 Board (DT)
> Call trace:
> dump_backtrace.cfi_jt+0x0/0x8
>   dump_stack_lvl+0xc0/0x13c
>   panic+0x174/0x468
>   arm64_serror_panic+0x1b0/0x200
>   do_serror+0x184/0x1e4
>   el1_error+0x94/0x118
>   el1_abort+0x40/0x68
>   el1_sync_handler+0x58/0x88
>   el1_sync+0x8c/0x140
>   dwc3_readl+0x30/0x1a0
>   dwc3_phy_setup+0x38/0x510
>   dwc3_core_init+0x68/0xcd4
>   dwc3_core_init_for_resume+0x10c/0x25c
>   dwc3_resume_common+0x44/0x3d0
>   dwc3_resume+0x5c/0xb8
>   dpm_run_callback+0x70/0x488
>   device_resume+0x250/0x2f8
>   dpm_resume+0x258/0x9dc
> 
> Signed-off-by: William Wu <william.wu@rock-chips.com>
> ---
> Changes in v2:
> - Remove Change-Id.
> 
>  drivers/usb/dwc3/core.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 9c6bf054f15d..8274a44f2d6a 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -2185,9 +2185,11 @@ static int dwc3_resume(struct device *dev)
>  
>  	pinctrl_pm_select_default_state(dev);
>  
> -	ret = dwc3_resume_common(dwc, PMSG_RESUME);
> -	if (ret)
> -		return ret;
> +	if (!pm_runtime_suspended(dwc->dev)) {
> +		ret = dwc3_resume_common(dwc, PMSG_RESUME);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	pm_runtime_disable(dev);
>  	pm_runtime_set_active(dev);
> -- 
> 2.17.1
> 

  reply	other threads:[~2023-09-12  1:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11  3:31 [PATCH v2] usb: dwc3: core: Avoid resume dwc3 if already suspended in pm resume William Wu
2023-09-12  0:08 ` Thinh Nguyen [this message]
2023-09-15 15:53   ` wuliangfeng
2023-10-02 18:18     ` Thinh Nguyen
2023-10-10  7:28       ` wuliangfeng
2023-10-12 17:38         ` Thinh Nguyen
2023-09-15 20:17 ` Wesley Cheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230912000802.nb5mk4e5toojyqis@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=frank.wang@rock-chips.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jianwei.zheng@rock-chips.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=william.wu@rock-chips.com \
    --cc=yangbin@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox