From: Pavel Machek <pavel@nabladev.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: cip-dev@lists.cip-project.org,
Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>,
Biju Das <biju.das.jz@bp.renesas.com>
Subject: Re: [PATCH 6.12.y-cip 04/17] clk: renesas: cpg-mssr: Add module reset support for RZ/T2H
Date: Mon, 5 Jan 2026 12:39:45 +0100 [thread overview]
Message-ID: <aVujAQJSDn6WyORK@duo.ucw.cz> (raw)
In-Reply-To: <20251229223911.8663-5-prabhakar.mahadev-lad.rj@bp.renesas.com>
[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]
Hi!
There's a cleanup possible, see below.
> commit 3b37979dcbef0dc3fc1aaba75b21ff9a21799055 upstream.
>
> Add support for module reset handling on the RZ/T2H SoC. Unlike earlier
> CPG/MSSR variants, RZ/T2H uses a unified set of Module Reset Control
> Registers (MRCR) where both reset and deassert actions are done via
> read-modify-write (RMW) to the same register.
> diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
> index 9ea544d00634b..4d2d945b3f5e2 100644
> --- a/drivers/clk/renesas/renesas-cpg-mssr.c
> +++ b/drivers/clk/renesas/renesas-cpg-mssr.c
> + /*
> + * For secure processing after release from a module reset, one must
> + * perform multiple dummy reads of the same register.
> + */
> + for (i = 0; !set && i < RZT2H_RESET_REG_READ_COUNT; i++)
> + readl(reg_addr);
> +
> + /* Verify the operation */
> + val = readl(reg_addr);
> + if (set == !(bitmask & val)) {
> + dev_err(priv->dev, "Reset register %u%02u operation failed\n", reg, bit);
> + spin_unlock_irqrestore(&priv->pub.rmw_lock, flags);
> + return -EIO;
> + }
> +
> + spin_unlock_irqrestore(&priv->pub.rmw_lock, flags);
"(set == !(bitmask & val))" is only using local variables, so does not
need spinlock protection AFAICT.
And dev_err really should not be run under spinlock.
So I believe spin_unlock...() can be simply moved before the if() for
tiny bit faster and cleaner code.
Thanks and best regards,
Pavel
--
In cooperation with Nabla.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2026-01-05 11:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-29 22:38 [PATCH 6.12.y-cip 00/17] Add I2C support to RZ/T2H and RZ/N2H SoCs Lad Prabhakar
2025-12-29 22:38 ` [PATCH 6.12.y-cip 01/17] clk: renesas: r9a09g077: Propagate rate changes to parent clocks Lad Prabhakar
2025-12-29 22:38 ` [PATCH 6.12.y-cip 02/17] clk: renesas: r9a09g077: Remove stray blank line Lad Prabhakar
2025-12-29 22:38 ` [PATCH 6.12.y-cip 03/17] clk: renesas: r9a09g077: Use devm_ helpers for divider clock registration Lad Prabhakar
2025-12-29 22:38 ` [PATCH 6.12.y-cip 04/17] clk: renesas: cpg-mssr: Add module reset support for RZ/T2H Lad Prabhakar
2026-01-05 11:39 ` Pavel Machek [this message]
2026-01-05 14:10 ` Prabhakar Mahadev Lad
2025-12-29 22:38 ` [PATCH 6.12.y-cip 05/17] clk: renesas: r9a09g077: Add RIIC module clocks Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 06/17] dt-bindings: i2c: renesas,riic: Move ref for i2c-controller.yaml to the end Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 07/17] dt-bindings: i2c: renesas,riic: Document RZ/T2H and RZ/N2H support Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 08/17] i2c: riic: Make use of devres helper to request deasserted reset line Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 09/17] i2c: riic: Implement bus recovery Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 10/17] i2c: riic: Pass IRQ desc array as part of OF data Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 11/17] i2c: riic: Move generic compatible string to end of array Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 12/17] i2c: riic: Add support for RZ/T2H SoC Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 13/17] arm64: dts: renesas: r9a09g077: Add I2C controller nodes Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 14/17] arm64: dts: renesas: r9a09g087: " Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 15/17] arm64: dts: renesas: r9a09g077m44-rzt2h-evk: Enable I2C0 and I2C1 support Lad Prabhakar
2025-12-29 22:39 ` [PATCH 6.12.y-cip 16/17] arm64: dts: renesas: r9a09g087m44-rzt2h-evk: " Lad Prabhakar
2026-01-05 11:43 ` Pavel Machek
2026-01-05 14:12 ` Prabhakar Mahadev Lad
2025-12-29 22:39 ` [PATCH 6.12.y-cip 17/17] arm64: dts: renesas: rzt2h-n2h-evk-common: Enable EEPROM on I2C0 Lad Prabhakar
2026-01-05 11:45 ` [cip-dev] [PATCH 6.12.y-cip 00/17] Add I2C support to RZ/T2H and RZ/N2H SoCs Pavel Machek
2026-01-06 18:06 ` Pavel Machek
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=aVujAQJSDn6WyORK@duo.ucw.cz \
--to=pavel@nabladev.com \
--cc=biju.das.jz@bp.renesas.com \
--cc=cip-dev@lists.cip-project.org \
--cc=nobuhiro.iwamatsu.x90@mail.toshiba \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox