U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniele Briguglio <hello@superkali.me>
To: Heiko Stuebner <heiko@sntech.de>, u-boot@lists.denx.de
Cc: Tom Rini <trini@konsulko.com>, Lukasz Majewski <lukma@denx.de>,
	David Lechner <dlechner@baylibre.com>,
	Julien Stephan <jstephan@baylibre.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Peng Fan <peng.fan@nxp.com>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	Philip Molloy <philip.molloy@analog.com>,
	Sean Anderson <sean.anderson@linux.dev>,
	Richard Genoud <richard.genoud@bootlin.com>,
	Simon Glass <sjg@chromium.org>,
	Peter Korsgaard <peter@korsgaard.com>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Kever Yang <kever.yang@rock-chips.com>,
	Jonas Karlman <jonas@kwiboo.se>
Subject: Re: [PATCH v3 3/4] pci: pcie_dw_rockchip: drop clk_release_bulk calls
Date: Tue,  9 Jun 2026 22:06:25 +0200	[thread overview]
Message-ID: <20260609200625.3260932-1-hello@superkali.me> (raw)
In-Reply-To: <1963052.CQOukoFCf9@diego>

> Though the whole clk handling is quite strange.
> I would assume that it's always a
>   - clk-request
>       - clk-enable
>           something
>       - clk-disable
>   - clk-release
>
> That a clk-disable also hides in the clk-release is really surprising,
> and I guess a lot of places in u-boot will encounter the same
> imbalance - just mitigated by the fact that the double-disable
> won't matter.
>
> Directly in clk_get_bulk the problem is apparent ...
> The function tries to get all the clocks, and on error calls
> clk_release_all on the already gotten clocks.
>
> All of these clocks never got enabled, but are getting double-disabled
> by the clk_release_all() call.
>
> Very very strange ;-)

Right. clk_release_bulk() hides a clk_disable(), and clk_get_bulk() does
the same in its own error path: it calls clk_release_all() on clocks it
only ever requested, never enabled. Everywhere else that double-disable
is a no-op, so nobody notices. The gated-fixed-clock driver is what makes
it bite, since there the disable actually toggles the regulator.

Thanks for the review, and for testing on the rock-5-itx.

Daniele

  reply	other threads:[~2026-06-09 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-20  6:05 [PATCH v3 0/4] rockchip: PCIe gated reference clock support Daniele Briguglio
2026-05-20  6:05 ` [PATCH v3 1/4] clk: add gated-fixed-clock driver Daniele Briguglio
2026-06-09 18:49   ` Heiko Stübner
2026-05-20  6:05 ` [PATCH v3 2/4] pci: pcie_dw_rockchip: enable clocks before PHY init Daniele Briguglio
2026-06-09 18:50   ` Heiko Stübner
2026-05-20  6:05 ` [PATCH v3 3/4] pci: pcie_dw_rockchip: drop clk_release_bulk calls Daniele Briguglio
2026-06-09 19:04   ` Heiko Stübner
2026-06-09 20:06     ` Daniele Briguglio [this message]
2026-05-20  6:05 ` [PATCH v3 4/4] pci: pcie_dw_rockchip: imply CLK_GATED_FIXED and switch PHY to imply Daniele Briguglio
2026-06-09 19:04   ` Heiko Stübner

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=20260609200625.3260932-1-hello@superkali.me \
    --to=hello@superkali.me \
    --cc=dlechner@baylibre.com \
    --cc=heiko@sntech.de \
    --cc=jonas@kwiboo.se \
    --cc=jstephan@baylibre.com \
    --cc=kever.yang@rock-chips.com \
    --cc=lukma@denx.de \
    --cc=peng.fan@nxp.com \
    --cc=peter@korsgaard.com \
    --cc=philip.molloy@analog.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=quentin.schulz@cherry.de \
    --cc=richard.genoud@bootlin.com \
    --cc=sean.anderson@linux.dev \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /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