mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: Srinivas Kandagatla <srini@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org,
	Stefan Kerkmann <s.kerkmann@pengutronix.de>,
	Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH] nvmem: rockchip-otp: convert to runtime PM
Date: Thu, 27 Aug 2026 15:54:06 +0200	[thread overview]
Message-ID: <2048906.PYKUYFuaPT@phil> (raw)
In-Reply-To: <20260819-rockchip-nvmem-pmruntime-v1-1-01f1acf80dba@pengutronix.de>

Am Mittwoch, 19. August 2026, 14:33:45 Mitteleuropäische Sommerzeit schrieb Sascha Hauer:
> From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
> 
> The driver enables the OTP clocks inside rockchip_otp_read() and drops
> them again before returning, so the controller is only alive for the
> duration of a nvmem read issued by Linux.
> 
> On RK3588 that is not sufficient. Part of the OTP array is readable only
> from the secure world, and OP-TEE reads it through this same controller.
> Its clocks are in the normal world's CRU and are plain gates, so an SMC
> into OP-TEE hits a clock-gated controller unless Linux turns them on
> first. OP-TEE cannot do that without a CRU driver of its own, which
> would put both worlds on the same gate registers.
> 
> Move the clock handling into runtime PM callbacks. A consumer can then
> take a DL_FLAG_PM_RUNTIME device link on the OTP and hold a reference
> for as long as it needs the controller, without knowing anything about
> its clock list. DEFINE_RUNTIME_DEV_PM_OPS() supplies the system sleep
> callbacks too, so holding one does not keep the clocks on over suspend.
> 
> Enabling the clocks is now the callbacks' job alone, hence the dependency
> on PM: with CONFIG_PM=n they never run and a read would go out to a gated
> controller. Reads are otherwise unchanged.
> 
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> ---
> The driver enables the OTP clocks inside rockchip_otp_read() and drops
> them again before returning, so the controller is only alive for the
> duration of a nvmem read issued by Linux.

your commit message got duplicated here.


Heiko



      reply	other threads:[~2026-08-27 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 12:33 Sascha Hauer
2026-08-27 13:54 ` Heiko Stuebner [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=2048906.PYKUYFuaPT@phil \
    --to=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.kerkmann@pengutronix.de \
    --cc=srini@kernel.org \
    /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

all inboxes | Powered by JetHome®