Skip to content

Commit 93baa35

Browse files
[nrf fromlist] tests: drivers: clock_control: nrf: add global hsfll clock
Extend test suite to test global HSFLL clock. Upstream PR #: 81735 Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 896fef6 commit 93baa35

File tree

1 file changed

+42
-2
lines changed
  • tests/drivers/clock_control/nrf_clock_control/src

1 file changed

+42
-2
lines changed

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

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,37 @@ static const struct test_clk_context cpurad_hsfll_test_clk_contexts[] = {
104104
};
105105
#endif
106106

107+
const struct nrf_clock_spec test_clk_specs_global_hsfll[] = {
108+
{
109+
.frequency = MHZ(320),
110+
.accuracy = 0,
111+
.precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,
112+
},
113+
{
114+
.frequency = MHZ(256),
115+
.accuracy = 0,
116+
.precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,
117+
},
118+
{
119+
.frequency = MHZ(128),
120+
.accuracy = 0,
121+
.precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,
122+
},
123+
{
124+
.frequency = MHZ(64),
125+
.accuracy = 0,
126+
.precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT,
127+
},
128+
};
129+
130+
static const struct test_clk_context global_hsfll_test_clk_contexts[] = {
131+
{
132+
.clk_dev = DEVICE_DT_GET(DT_NODELABEL(hsfll120)),
133+
.clk_specs = test_clk_specs_global_hsfll,
134+
.clk_specs_size = ARRAY_SIZE(test_clk_specs_global_hsfll),
135+
},
136+
};
137+
107138
const struct nrf_clock_spec test_clk_specs_lfclk[] = {
108139
{
109140
.frequency = 32768,
@@ -151,8 +182,10 @@ static void test_request_release_clock_spec(const struct device *clk_dev,
151182
zassert_ok(ret);
152183
zassert_ok(res);
153184
ret = clock_control_get_rate(clk_dev, NULL, &rate);
154-
zassert_ok(ret);
155-
zassert_equal(rate, clk_spec->frequency);
185+
if (ret != -ENOSYS) {
186+
zassert_ok(ret);
187+
zassert_equal(rate, clk_spec->frequency);
188+
}
156189
k_msleep(1000);
157190
ret = nrf_clock_control_release(clk_dev, clk_spec);
158191
zassert_equal(ret, ONOFF_STATE_ON);
@@ -249,6 +282,13 @@ ZTEST(nrf2_clock_control, test_lfclk_control)
249282
test_clock_control_request(lfclk_test_clk_contexts, ARRAY_SIZE(lfclk_test_clk_contexts));
250283
}
251284

285+
ZTEST(nrf2_clock_control, test_global_hsfll_control)
286+
{
287+
TC_PRINT("Global HSFLL test\n");
288+
test_clock_control_request(global_hsfll_test_clk_contexts,
289+
ARRAY_SIZE(global_hsfll_test_clk_contexts));
290+
}
291+
252292
ZTEST(nrf2_clock_control, test_safe_request_cancellation)
253293
{
254294
int ret = 0;

0 commit comments

Comments
 (0)