Re: [PATCH v2 2/3] clk: renesas: r9a06g032: Add reset controller
From: Wolfram Sang
Date: Fri Nov 20 2026 - 17:17:34 EST
> > +static const struct regbit r9a06g032_resets[] = {
> > + [R9A06G032_RST_TS] = RB(0x188, 3),
> > + [R9A06G032_RST_MIIC] = RB(0x188, 4),
> > +};
>
> [Severity: Medium]
> Since R9A06G032_RST_TS is 1 and R9A06G032_RST_MIIC is 2, can reset ID 0 be
> requested and accepted even though r9a06g032_resets[0] is unpopulated?
>
> ARRAY_SIZE(r9a06g032_resets) is 3, and without a custom xlate callback,
> fwnode_reset_simple_xlate() allows index 0. If a consumer requests reset
> 0, assert and deassert silently become no-ops in clk_rdesc_set(), while
> r9a06g032_reset_status() calls clk_rdesc_get() with { .bit = 0, .reg = 0 }
> and reads bit 0 of offset 0x00 (R9A06G032_SYSCTRL_USB).
>
> Either the reset IDs should be 0-based, or the driver should provide an
> xlate callback that rejects unpopulated entries where !reg && !bit.
Seems like starting from 0 is the better (and easier) option after all.
> [Severity: Medium]
> Should CLK_R9A06G032 select RESET_CONTROLLER in
> drivers/clk/renesas/Kconfig?
>
> When CONFIG_RESET_CONTROLLER is disabled, devm_reset_controller_register()
> compiles to a no-op stub returning 0, so the reset controller is never
> registered and consumers such as pcs-rzn1-miic fail probe with
> -EOPNOTSUPP.
I agree.
Attachment:
signature.asc
Description: PGP signature