All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kyle Hendry" <khendry@reliablecontrols.com>
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 6/6] ARM: dts: renesas: r9a06g032: Add resets to mii converter
Date: Fri, 20 Nov 2026 17:58:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-225763@kernel.org> (raw)
In-Reply-To: <20261119-rzn1-miic-resets-v1-6-feee2bb28bb4@reliablecontrols.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] ARM: dts: renesas: r9a06g032: 1-based reset IDs mismatch
  0-based reset table
- [High] clk: renesas: r9a06g032: missing rcdev member in struct
  r9a06g032_priv
- [Medium] clk: renesas: r9a06g032: inverted polarity in
  r9a06g032_reset() and status
- [Medium] clk: renesas: r9a06g032: dangling sysctrl_priv on reset
  register error
--

commit 37a9aace6321173b9dddf5f8ccba42dd97dee222
Author: Kyle Hendry <khendry@reliablecontrols.com>

ARM: dts: renesas: r9a06g032: Add resets to mii converter

This commit adds the rst_ts and rst_miic reset references from the sysctrl
node to the eth_miic node in the r9a06g032 device tree.

> diff --git a/arch/arm/boot/dts/renesas/r9a06g032.dtsi b/arch/arm/boot/dts/renesas/r9a06g032.dtsi
> index f2bf087f7ad2e..0a538d9221254 100644
> --- a/arch/arm/boot/dts/renesas/r9a06g032.dtsi
> +++ b/arch/arm/boot/dts/renesas/r9a06g032.dtsi
> @@ -463,6 +463,9 @@ eth_miic: eth-miic@44030000 {
>  				 <&sysctrl R9A06G032_CLK_RMII_REF>,
>  				 <&sysctrl R9A06G032_HCLK_SWITCH_RG>;
>  			clock-names = "mii_ref", "rgmii_ref", "rmii_ref", "hclk";
> +			resets = <&sysctrl R9A06G032_RST_TS>,
> +				 <&sysctrl R9A06G032_RST_MIIC>;
> +			reset-names = "rst_ts", "rst_miic";
>  			power-domains = <&sysctrl>;
>  			status = "disabled";
>  

[Severity: High]
Are R9A06G032_RST_TS and R9A06G032_RST_MIIC off by one relative to
r9a06g032_resets[]?

Commit "dt-bindings: clock: r9a06g032-sysctrl: Document reset cells"
defines R9A06G032_RST_TS as 1 and R9A06G032_RST_MIIC as 2, while commit
"clk: renesas: r9a06g032: Add reset controller" registers a 2-element
r9a06g032_resets[] array (indices 0 and 1) using the default 0-based
fwnode_reset_simple_xlate():

drivers/clk/renesas/r9a06g032-clocks.c:
	static const struct regbit r9a06g032_resets[] = {
		RB(0x188, 3),
		RB(0x188, 4),
	};

When miic_probe() requests these resets, rst_ts (1) targets index 1
(RB(0x188, 4), the MII converter reset) instead of index 0 (RB(0x188, 3),
the timestamp reset), and rst_miic (2) fails translation with -EINVAL
because 2 >= nr_resets.

[Severity: High]
Does commit "clk: renesas: r9a06g032: Add reset controller" fail to
compile because struct r9a06g032_priv has no rcdev member?

Both rcdev_to_priv() and r9a06g032_clocks_probe() access clocks->rcdev to
register the sysctrl reset controller referenced here, but struct
r9a06g032_priv only defines data, lock, and reg.

[Severity: Medium]
In the sysctrl reset provider added by commit "clk: renesas: r9a06g032:
Add reset controller", are the reset polarity and status inverted in
r9a06g032_reset() and r9a06g032_reset_status()?

drivers/clk/renesas/r9a06g032-clocks.c:r9a06g032_reset() {
	r9a06g032_reset_set(rcdev, "reset", true, id);
	udelay(5);
	return r9a06g032_reset_set(rcdev, NULL, false, id);
}

The reset bits in PWRCTRL_SWITCHCTRL are active-low (r9a06g032_reset_assert()
passes false and r9a06g032_reset_deassert() passes true).  Calling
r9a06g032_reset() deasserts the line and then asserts it, leaving the
peripheral held in reset.  Likewise, r9a06g032_reset_status() returns
clk_rdesc_get() directly, which returns 1 when deasserted and 0 when
asserted, opposite to the reset_control_status() contract.

[Severity: Medium]
In commit "clk: renesas: r9a06g032: Add reset controller", what happens if
devm_reset_controller_register() fails at the end of
r9a06g032_clocks_probe()?

drivers/clk/renesas/r9a06g032-clocks.c:r9a06g032_clocks_probe() {
	...
	sysctrl_priv = clocks;

	error = of_platform_populate(np, NULL, NULL, dev);
	if (error)
		dev_err(dev, "Failed to populate children (%d)\n", error);

	clocks->rcdev.ops = &r9a06g032_reset_ops;
	clocks->rcdev.of_node = np;
	clocks->rcdev.of_reset_n_cells = 1;
	clocks->rcdev.nr_resets = ARRAY_SIZE(r9a06g032_resets);
	error =  devm_reset_controller_register(dev, &clocks->rcdev);
	if (error)
		return error;
	...
}

Returning an error after r9a06g032_add_clk_domain(), sysctrl_priv
assignment, and of_platform_populate() leaves global sysctrl_priv and the
registered OF genpd provider pointing to devm-freed memory, and leaves
populated child platform devices behind.  Also, calling
of_platform_populate() before devm_reset_controller_register() means child
devices probing during populate cannot look up the reset controller yet.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-rzn1-miic-resets-v1-0-feee2bb28bb4@reliablecontrols.com?part=6

  parent reply	other threads:[~2026-11-20 17:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:57 [PATCH 0/6] clk: renesas: r9a06g032: Add reset controller to clear resets for mii converter Kyle Hendry
2026-11-19 17:57 ` Kyle Hendry via B4 Relay
2026-11-19 17:57 ` [PATCH 1/6] dt-bindings: clock: r9a06g032-sysctrl: Document reset cells Kyle Hendry
2026-11-19 17:57   ` Kyle Hendry via B4 Relay
2026-11-20  9:23   ` Wolfram Sang
2026-11-20  9:51     ` Philipp Zabel
2026-11-20 11:11       ` Wolfram Sang
2026-11-19 17:57 ` [PATCH 2/6] clk: renesas: r9a06g032: Add reset controller Kyle Hendry
2026-11-19 17:57   ` Kyle Hendry via B4 Relay
2026-11-20  9:30   ` Wolfram Sang
2026-11-20 10:00   ` Philipp Zabel
2026-11-20 11:47   ` Wolfram Sang
2026-11-20 17:58   ` sashiko-bot
2026-11-19 17:57 ` [PATCH 3/6] ARM: dts: renesas: r9a06g032: Add #reset-cells to system controller node Kyle Hendry
2026-11-19 17:57   ` Kyle Hendry via B4 Relay
2026-11-20  9:32   ` Wolfram Sang
2026-11-19 17:57 ` [PATCH 4/6] dt-bindings: net: pcs: renesas,rzn1-miic: Document rzn1 resets Kyle Hendry
2026-11-19 17:57   ` Kyle Hendry via B4 Relay
2026-11-20 11:49   ` Wolfram Sang
2026-11-19 17:57 ` [PATCH 5/6] net: pcs: rzn1-miic: Add resets to rzn1 info structure Kyle Hendry
2026-11-19 17:57   ` Kyle Hendry via B4 Relay
2026-11-20 17:58   ` sashiko-bot
2026-11-19 17:57 ` [PATCH 6/6] ARM: dts: renesas: r9a06g032: Add resets to mii converter Kyle Hendry
2026-11-19 17:57   ` Kyle Hendry via B4 Relay
2026-11-20  9:34   ` Wolfram Sang
2026-11-20 17:58   ` sashiko-bot [this message]
2026-11-19 22:02 ` [PATCH 0/6] clk: renesas: r9a06g032: Add reset controller to clear resets for " Jakub Kicinski

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=sashiko-outbox-225763@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=khendry@reliablecontrols.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.