Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Junzhong Pan" <panjunzhong@linux.spacemit.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 4/9] usb: chipidea: usb2: add optional reset support
Date: Tue, 08 Sep 2026 10:00:35 +0000	[thread overview]
Message-ID: <20260908100035.EBF431F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908-b4-spacemit-k1-usb2-v2-4-f07342ffa051@linux.spacemit.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Double clock disable and hardware reset ordering issue in driver teardown.
--

commit 13027fbf78c576199d06490bac312974df846e8a
Author: Junzhong Pan <panjunzhong@linux.spacemit.com>

usb: chipidea: usb2: add optional reset support

This commit adds optional reset support for the USB2 controller on the 
SpacemiT K1 SoC to maintain hardware compatibility.

> diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> index 6fae2d4a053a1..f81673edca3c1 100644
> --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
> +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c

[ ... ]

> @@ -75,6 +77,11 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
>  		return dev_err_probe(dev, PTR_ERR(priv->clk),
>  				     "failed to get or enable the clock\n");
>  
> +	priv->reset = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);

[Severity: High]
Could adding this devm-managed reset trigger a hardware hang during driver
unbind?

Since ci_hdrc_usb2_remove() manually disables the clock:

ci_hdrc_usb2_remove() {
        ...
        clk_disable_unprepare(priv->clk);
}

Devres actions execute in reverse order (LIFO) after remove() completes, so
the hardware reset will be asserted automatically by devres after the clock
is already manually disabled. Asserting a reset synchronously without an
active clock can hang the bus or lock up the SoC on many platforms.

Additionally, since the clock was previously updated to be acquired using
devm_clk_get_optional_enabled(), the manual clk_disable_unprepare() in
remove() results in a double-disable of the clock when the device is unbound,
triggering clock framework warnings.

Does this require cleaning up the manual teardown in ci_hdrc_usb2_remove()
to ensure proper ordering?

> +	if (IS_ERR(priv->reset))
> +		return dev_err_probe(dev, PTR_ERR(priv->reset),
> +				     "failed to get or deassert the reset control\n");
> +
>  	ci_pdata->name = dev_name(dev);
>  
>  	priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908-b4-spacemit-k1-usb2-v2-0-f07342ffa051@linux.spacemit.com?part=4

  reply	other threads:[~2026-09-08 10:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  9:48 [PATCH v2 0/9] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
2026-09-08  9:48 ` [PATCH v2 1/9] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible Junzhong Pan
2026-09-08  9:48 ` [PATCH v2 2/9] dt-bindings: usb: ci-hdrc-usb2: require clocks and resets for spacemit,k1-usb2 Junzhong Pan
2026-09-08 17:50   ` Conor Dooley
2026-09-09 12:29     ` Junzhong Pan
2026-09-08  9:48 ` [PATCH v2 3/9] usb: chipidea: usb2: use devm_clk_get_optional_enabled() Junzhong Pan
2026-09-08  9:55   ` sashiko-bot
2026-09-08 10:01   ` Junzhong Pan
2026-09-08  9:48 ` [PATCH v2 4/9] usb: chipidea: usb2: add optional reset support Junzhong Pan
2026-09-08 10:00   ` sashiko-bot [this message]
2026-09-08  9:48 ` [PATCH v2 5/9] usb: chipidea: usb2: add SpacemiT K1 support Junzhong Pan
2026-09-08 10:05   ` sashiko-bot
2026-09-08 13:11   ` Troy Mitchell
2026-09-08  9:48 ` [PATCH v2 6/9] riscv: dts: spacemit: add USB2.0 controller nodes for K1 Junzhong Pan
2026-09-08 10:10   ` sashiko-bot
2026-09-08  9:48 ` [PATCH v2 7/9] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3 Junzhong Pan
2026-09-08 13:11   ` Troy Mitchell
2026-09-08  9:48 ` [PATCH v2 8/9] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2 Junzhong Pan
2026-09-13  8:33   ` Ze Huang
2026-09-08  9:48 ` [PATCH v2 9/9] riscv: defconfig: enable ChipIdea USB controller support Junzhong Pan
2026-09-08 22:07   ` Yixun Lan
2026-09-09 12:31     ` Junzhong Pan

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=20260908100035.EBF431F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=panjunzhong@linux.spacemit.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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