Devicetree
 help / color / mirror / Atom feed
From: Alex Elder <elder@riscstar.com>
To: sashiko-reviews@lists.linux.dev
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] reset: toshiba: introduce a TC9564 SoC reset driver
Date: Mon, 12 Oct 2026 12:01:48 -0500	[thread overview]
Message-ID: <ecab492b-dfe6-4f45-8474-cc710cfe3dff@riscstar.com> (raw)
In-Reply-To: <sashiko-outbox-168439@kernel.org>

On 10/12/26 11:54 AM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [High] reset: tc9564: hardware state initialized after reset controller registration
> - [High] reset: tc9564: active consumers forcibly reset during driver removal
> --
> 
> commit 504236856b96e78b9064b4d58c3ef7ba166341e3
> Author: Alex Elder <elder@riscstar.com>
> 
> reset: toshiba: introduce a TC9564 SoC reset driver
> 
> Defines a new platform driver that manages reset signals implemented by the
> Toshiba TC9564 SoC. The state of the resets is controlled via MMIO to a
> region managed by a system controller.
> 
>> diff --git a/drivers/reset/reset-tc9564.c b/drivers/reset/reset-tc9564.c
>> new file mode 100644
>> index 0000000000000..0243c2e0efd54
>> --- /dev/null
>> +++ b/drivers/reset/reset-tc9564.c
> 
> [ ... ]
> 
>> +static int tc9564_reset_probe(struct platform_device *pdev)
>> +{
>> +	struct device *dev = &pdev->dev;
>> +	struct tc9564_resets *resets;
>> +
>> +	if (!dev_of_node(dev))
>> +		return dev_err_probe(dev, -EINVAL, "no devicetree node\n");
>> +
>> +	resets = tc9564_reset_init(dev);
>> +	if (IS_ERR(resets))
>> +		return dev_err_probe(dev, PTR_ERR(resets),
>> +				     "failed to initialize resets\n");
>> +
>> +	/* Force all resets to be initially asserted */
>> +	tc9564_reset_assert_all(resets);
> 
> [Severity: High]
> Does this cause a race condition with consumer drivers?

I hadn't thought of that, but yes, this is a good point.
We would like to ensure this is the initial state, but I will
rework this so that all defined resets will be asserted
initially by "directly" writing registers through the regmap,
rather than doing so using the reset API.

> 
> tc9564_reset_init() globally registers the reset controller via
> devm_reset_controller_register(). Once registered, consumers can
> immediately probe and deassert their reset lines.
> 
> If a consumer driver deasserts its reset right after registration,
> will this subsequent call to tc9564_reset_assert_all() overwrite the
> consumer's hardware state and unexpectedly yank running hardware back
> into reset?
> 
>> +
>> +	platform_set_drvdata(pdev, resets);
>> +
>> +	return 0;
>> +}
>> +
>> +static void tc9564_reset_remove(struct platform_device *pdev)
>> +{
>> +	struct tc9564_resets *resets = platform_get_drvdata(pdev);
>> +
>> +	/* Leave all resets asserted when done */
>> +	tc9564_reset_assert_all(resets);
> 
> [Severity: High]
> Does this unexpectedly assert resets for active consumers?

I suppose that's possible, and it's easy enough to simply
omit this remove callback (and the assert-all call).

I will adjust this for version 2.

					-Alex

> 
> Since the reset controller is registered using devm_reset_controller_register(),
> the devres subsystem will unregister the controller only after this remove
> callback completes.
> 
> This means the controller is still active and consumers might be actively
> using their deasserted reset lines when tc9564_reset_assert_all() is called
> here. Should the driver coordinate with consumers or unregister itself first
> before forcing all lines into reset?
> 
> [ ... ]
> 


      reply	other threads:[~2026-10-12 17:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-12 16:43 [PATCH 0/2] reset: introduce TC9564 reset support Alex Elder
2026-10-12 16:43 ` [PATCH 1/2] dt-bindings: reset: introduce toshiba,tc9564-reset.yaml Alex Elder
2026-10-12 16:48   ` sashiko-bot
2026-10-12 17:01     ` Alex Elder
2026-10-12 18:51   ` Conor Dooley
2026-10-12 19:10     ` Alex Elder
2026-10-12 21:22       ` Conor Dooley
2026-10-13  9:25     ` Krzysztof Kozlowski
2026-10-12 16:43 ` [PATCH 2/2] reset: toshiba: introduce a TC9564 SoC reset driver Alex Elder
2026-10-12 16:54   ` sashiko-bot
2026-10-12 17:01     ` Alex Elder [this message]

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=ecab492b-dfe6-4f45-8474-cc710cfe3dff@riscstar.com \
    --to=elder@riscstar.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --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