Skip to content

Commit

Permalink
[nrf fromtree] drivers: clock_control: nrf: Add workaround for XO sta…
Browse files Browse the repository at this point in the history
…rt anomaly

Add workaround to HFCLK start and stop in nrf54l. In future workaround
will be in nrfx driver.

Signed-off-by: Krzysztof Chruściński <[email protected]>
(cherry picked from commit 2cb2cf226c0254d662794b8158dd05688eb8e57b)
  • Loading branch information
nordic-krch committed Feb 20, 2025
1 parent eb14c8d commit 225dc3a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/clock_control/clock_control_nrf.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ LOG_MODULE_REGISTER(clock_control, CONFIG_CLOCK_CONTROL_LOG_LEVEL);
#define INF(dev, subsys, ...) CLOCK_LOG(INF, dev, subsys, __VA_ARGS__)
#define DBG(dev, subsys, ...) CLOCK_LOG(DBG, dev, subsys, __VA_ARGS__)

#if defined(NRF54L05_XXAA) || defined(NRF54L10_XXAA) || defined(NRF54L15_XXAA)
#if NRFX_RELEASE_VER_AT_LEAST(3, 11, 0)
#error "Remove workaround for XOSTART as it is already done in the nrfx clock"
#endif

#define USE_WORKAROUND_FOR_CLOCK_XOSTART_ANOMALY 1
#endif

/* Clock subsys structure */
struct nrf_clock_control_sub_data {
clock_control_cb_t cb;
Expand Down Expand Up @@ -235,6 +243,9 @@ static void hfclk_start(void)
hf_start_tstamp = k_uptime_get();
}

#ifdef USE_WORKAROUND_FOR_CLOCK_XOSTART_ANOMALY
nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_PLLSTART);
#endif
nrfx_clock_hfclk_start();
}

Expand All @@ -245,6 +256,9 @@ static void hfclk_stop(void)
}

nrfx_clock_hfclk_stop();
#ifdef USE_WORKAROUND_FOR_CLOCK_XOSTART_ANOMALY
nrf_clock_task_trigger(NRF_CLOCK, NRF_CLOCK_TASK_PLLSTOP);
#endif
}

#if NRF_CLOCK_HAS_HFCLK192M
Expand Down

0 comments on commit 225dc3a

Please sign in to comment.