Skip to content

Commit 8fd1279

Browse files
committed
[nrf fromlist] tests: driver: nrf_clock_control: Verify that clocks are ready
Ensure that a given clock controller is ready before making requests to it. Otherwise, if for some reason the clock controller fails to initialize (for example, when BICR turns out to be not populated with required values), the test may end up with an enigmatic bus fault. Upstream PR #: 89952 Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent b1c7699 commit 8fd1279

File tree

1 file changed

+9
-1
lines changed
  • tests/drivers/clock_control/nrf_clock_control/src

1 file changed

+9
-1
lines changed

tests/drivers/clock_control/nrf_clock_control/src/main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ static void test_clock_control_request(const struct test_clk_context *clk_contex
194194
clk_dev = clk_context->clk_dev;
195195
clk_spec = &clk_context->clk_specs[u];
196196

197+
zassert_true(device_is_ready(clk_dev),
198+
"%s is not ready", clk_dev->name);
199+
197200
TC_PRINT("Applying clock (%s) spec: frequency %d, accuracy %d, precision "
198201
"%d\n",
199202
clk_dev->name, clk_spec->frequency, clk_spec->accuracy,
@@ -206,7 +209,6 @@ static void test_clock_control_request(const struct test_clk_context *clk_contex
206209
#if CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP
207210
ZTEST(nrf2_clock_control, test_cpuapp_hsfll_control)
208211
{
209-
210212
TC_PRINT("APPLICATION DOMAIN HSFLL test\n");
211213
/* Wait for the DVFS init to complete */
212214
k_msleep(3000);
@@ -240,6 +242,9 @@ ZTEST(nrf2_clock_control, test_invalid_fll16m_clock_spec_response)
240242
clk_dev = clk_context->clk_dev;
241243
clk_spec = &clk_context->clk_specs[u];
242244

245+
zassert_true(device_is_ready(clk_dev),
246+
"%s is not ready", clk_dev->name);
247+
243248
TC_PRINT("Applying clock (%s) spec: frequency %d, accuracy %d, precision "
244249
"%d\n",
245250
clk_dev->name, clk_spec->frequency, clk_spec->accuracy,
@@ -285,6 +290,9 @@ ZTEST(nrf2_clock_control, test_safe_request_cancellation)
285290
const struct device *clk_dev = clk_context->clk_dev;
286291
const struct nrf_clock_spec *clk_spec = &test_clk_specs_lfclk[0];
287292

293+
zassert_true(device_is_ready(clk_dev),
294+
"%s is not ready", clk_dev->name);
295+
288296
TC_PRINT("Safe clock request cancellation\n");
289297
TC_PRINT("Clock under test: %s\n", clk_dev->name);
290298
sys_notify_init_spinwait(&cli.notify);

0 commit comments

Comments
 (0)