Re: [PATCH v2] clk: tenstorrent: Use prepare/unprepare ops for Atlantis PLL

From: Brian Masney

Date: Sun Nov 29 2026 - 16:44:24 EST


Hey Drew,

On Sat, Nov 28, 2026 at 09:52:45PM -0800, Drew Fustini wrote:
> On Fri, Nov 27, 2026 at 01:29:36PM +0000, Lee Jones wrote:
> > The Common Clock Framework invokes .enable callbacks in atomic context
> > with interrupts disabled and enable_lock held. In atlantis_clk_pll_ops,
> > atlantis_clk_pll_enable() is registered as the .enable callback yet
> > waits for PLL lock using regmap_read_poll_timeout() with a 500 us sleep
> > interval, triggering a sleep-in-atomic bug via usleep_range().
> >
> > Convert atlantis_clk_pll_ops to use .prepare, .unprepare, and
> > .is_prepared instead of .enable, .disable, and .is_enabled so that the
> > PLL lock wait executes under the sleeping prepare_lock rather than
> > atomic enable_lock.
> >
> > Fixes: 23c8ebc95284 ("clk: tenstorrent: Add Atlantis clock controller driver")
> > Closes: https://sashiko.dev/#/bug/linux-980395a6-f282-478a-bf18-b5695a725735
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> > ---
> > v1 => v2:
> > - Switch from .enable/.disable/.is_enabled to .prepare/.unprepare/.is_prepared so PLL lock polling runs under the sleeping prepare_lock instead of enable_lock, per Brian Masney's review.
> > - Keep regmap_read_poll_timeout() rather than switching to the atomic variant.
> > - Drop Anirudh Srinivasan's v1 Reviewed-by tag due to the implementation change.
> > - Drop the other patches from v1 that were already applied or superseded.
>
> Reviewed-by: Drew Fustini <fustini@xxxxxxxxxx>
>
> Brian - should I take this through tenstorrent-clk-for-next, or are you
> planning to apply it?

I'm fine either way. Let me know what you prefer.

Brian