mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Biju <biju.das.au@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
	Fan Wu <fanwu01@zju.edu.cn>, Vinod Koul <vkoul@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH] usb: renesas_usbhs: Fix power-off ordering on unbind
Date: Tue, 16 Jun 2026 11:57:39 +0300	[thread overview]
Message-ID: <a6be40ce-975f-4c7f-a261-18a447e6aeca@tuxon.dev> (raw)
In-Reply-To: <20260615173912.336408-1-biju.das.jz@bp.renesas.com>

Hi, Biju,

On 6/15/26 20:39, Biju wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> Move the usbhsc_power_ctrl() call to before usbhs_*_hardware_exit(), so
> that usbhs_*_hardware_exit() sets priv->phy to NULL only after
> usbhsc_power_ctrl() has executed, which controls the PHY power.
> 
> Fixes: eb9ac779830b ("usb: renesas_usbhs: Fix synchronous external abort on unbind")
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>   drivers/usb/renesas_usbhs/common.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
> index 8c93bde4b816..614b724a0e52 100644
> --- a/drivers/usb/renesas_usbhs/common.c
> +++ b/drivers/usb/renesas_usbhs/common.c
> @@ -813,6 +813,10 @@ static void usbhs_remove(struct platform_device *pdev)
>   
>   	flush_delayed_work(&priv->notify_hotplug_work);
>   
> +	/* power off */
> +	if (!usbhs_get_dparam(priv, runtime_pwctrl))
> +		usbhsc_power_ctrl(priv, 0);
> +

Moving this back here will lead to the issue described in commit eb9ac779830b 
("usb: renesas_usbhs: Fix synchronous external abort on unbind") being 
reproducible again. I've checked it on RZ/G2L.

Instead, the below diff fixes both the USB PHY regulator WARN_ON() stack trace 
and still keeps away the crash fixed by eb9ac779830b ("usb: renesas_usbhs: Fix 
synchronous external abort on unbind").

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 8c93bde4b816..843468d42786 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -813,7 +813,6 @@ static void usbhs_remove(struct platform_device *pdev)

         flush_delayed_work(&priv->notify_hotplug_work);

-       usbhs_platform_call(priv, hardware_exit, pdev);
         reset_control_assert(priv->rsts);

         /*
@@ -832,6 +831,8 @@ static void usbhs_remove(struct platform_device *pdev)
         if (!usbhs_get_dparam(priv, runtime_pwctrl))
                 usbhsc_power_ctrl(priv, 0);

+       usbhs_platform_call(priv, hardware_exit, pdev);
+
         usbhsc_clk_put(priv);
         pm_runtime_disable(&pdev->dev);
  }

Along with it, the reset_control_assert() could also be moved as follows to 
avoid accessing registers IPs with the reset line asserted. The following was 
also tested on RZ/G2L:

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 8c93bde4b816..51d3035f82be 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -813,9 +813,6 @@ static void usbhs_remove(struct platform_device *pdev)

         flush_delayed_work(&priv->notify_hotplug_work);

-       usbhs_platform_call(priv, hardware_exit, pdev);
-       reset_control_assert(priv->rsts);
-
         /*
          * Explicitly free the IRQ to ensure the interrupt handler is
          * disabled and synchronized before freeing resources.
@@ -832,6 +829,9 @@ static void usbhs_remove(struct platform_device *pdev)
         if (!usbhs_get_dparam(priv, runtime_pwctrl))
                 usbhsc_power_ctrl(priv, 0);

+       usbhs_platform_call(priv, hardware_exit, pdev);
+       reset_control_assert(priv->rsts);
+
         usbhsc_clk_put(priv);
         pm_runtime_disable(&pdev->dev);
  }

Thank you,
Claudiu

  reply	other threads:[~2026-06-16  8:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-15 17:39 Biju
2026-06-16  8:57 ` Claudiu Beznea [this message]
2026-06-16  9:25   ` Biju Das

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=a6be40ce-975f-4c7f-a261-18a447e6aeca@tuxon.dev \
    --to=claudiu.beznea@tuxon.dev \
    --cc=biju.das.au@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=fanwu01@zju.edu.cn \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=vkoul@kernel.org \
    /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

all inboxes | Powered by JetHome®