Commit graph

134 commits

Author SHA1 Message Date
Georgij Cernysiov
7f06af6b82 tests: drivers: clock_control: stm32: test H7 PLL2_P SPI1
Tests PLL2_P clock source for the SPI1 (SPI123SEL).

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-11-29 11:54:52 +01:00
Andrzej Głąbek
d361d8f7ec tests: drivers: nrf_lf_clock_control: Polish status messages a bit
Improve alignment in the source code and limit printed messages
(SYSTEM_CLOCK_NO_WAIT and SYSTEM_CLOCK_WAIT_FOR_* are choice options,
so it is enough to print only the enabled one).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-29 09:49:45 +01:00
Andrzej Głąbek
31767a0bce tests: drivers: nrf_lf_clock_control: Fix test initialization
This test needs an initialization step to be done soon after the system
clock is started. ZTEST setup function is too late for that, so use an
initialization function executed at the POST_KERNEL stage instead.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-29 09:49:45 +01:00
Arsen Eloglian
7c8264277a tests: adsp_clock: update tests
rename cavs_* to adsp_*

Signed-off-by: Arsen Eloglian <ArsenX.Eloglian@intel.com>
2022-11-28 17:45:20 -05:00
Georgij Cernysiov
376399ecb8 tests: drivers: clock_control: stm32: fix H7 zassert output
Fixes mixed up expected and actual values in zassert
output.

Signed-off-by: Georgij Cernysiov <geo.cgv@gmail.com>
2022-11-28 12:11:18 +01:00
Andrzej Głąbek
a4f063ec49 tests: clock_control: nrf_onoff_and_bt: Add clearing of test_end
This flag needs to be cleared at the beginning of each test. Otherwise,
when the flag remains set after the previous test, the timer handler is
not rescheduled so executing of the current test is actually pointless.

This was in fact the case with `test_bt_interrupted` before switching
the test suite to the new ZTEST API. When this test was executed as
the second one, the timer handler was called only once and the test
could pass (giving false confirmation that the related routines of
the clock_control_nrf driver work properly). After the API switching,
the order of test execution was changed and that test started failing.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-25 10:45:50 +01:00
Andrzej Głąbek
54e9594499 tests: clock_control: nrf_onoff_and_bt: Refactor code a bit
- most of initialization can be done once per the test suite
  (clearing of the iteration counter can be moved to particular
  tests where it fits better), so instead of the ZTEST before
  function use the setup one for doing the initialization
- make `clock_dev` and `cli` common variables for all tests
- use K_USEC() instead of Z_TIMEOUT_US(), as the latter is an
  internal Zephyr macro
- instead of `K_USEC(long_timeout ? 300 : 100)` use `K_USEC(300)`
  and `K_USEC(100)` so that their values can be calculated at the
  build time
- modify construction of main loops in tests so that it is more
  exposed when the `test_end` flag is set

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-25 10:45:50 +01:00
Andrzej Głąbek
fd3f22b24c tests: clock_control: nrf_onoff_and_bt: Remove needless GPIO toggling
Remove GPIO toggling, that seems to be remains from some debugging,
as it can potentially interfere with some hardware on specific boards.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-11-25 10:45:50 +01:00
Anas Nashif
67e8d03280 tests/samples: fix some missing tags
Many driver samples or tests only had 'drivers' as the tag, without a
tag indicating what driver that is exactly, so add some missing tags.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-14 07:08:04 -05:00
Erwan Gouriou
9b7d3657c9 tests: clock_control: stm32h7_devices: Test perck domain config
Add a test dedicated to verify the perck domain clock configuration.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-11-10 09:30:09 +01:00
Erwan Gouriou
cf84395f7b tests: clock_control: stm32h7_devices: Test perck configuration
When it needs to access perck clock speed, clock_control driver is using
LL API to read RCC registers and compute frequency.
We're using the exact same method to test the frequency and as a result
we were not able to detect that there was an issue when configuring this
clock.

Add a specific case to this test in order to verify perck domain clock if
perck is used in SPI clk configuration.

We're now able to detect issues (and test is failing).

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-11-10 09:30:09 +01:00
Erwan Gouriou
efd6fdb381 tests: clock_control: stm32: Enhance tests log messages
Perform some rework in messages displayed in case of failure to ease
readability:
- remove redundant information
- add missing information
- convert registers values to hex

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-11-10 09:30:09 +01:00
Erwan Gouriou
447c3df873 tests: clock_control: stm32h7_devices: Fix clock source check
Test was using "clock-names" property to query domain clock configuration.
This is not working since clock-names was removed in the last step of the
feature implementation and whole macro was always reporting DT_NO_CLOCK.

This issue went undetected because of an additional issue in the exception
case which was testing "zassert_true(1, .." instead of "zassert_true(0, .".

Fix both issues to make the test efficient again.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-11-10 09:30:09 +01:00
Kumar Gala
a1195ae39b smp: Move for loops to use arch_num_cpus instead of CONFIG_MP_NUM_CPUS
Change for loops of the form:

for (i = 0; i < CONFIG_MP_NUM_CPUS; i++)
   ...

to

unsigned int num_cpus = arch_num_cpus();
for (i = 0; i < num_cpus; i++)
   ...

We do the call outside of the for loop so that it only happens once,
rather than on every iteration.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2022-10-21 13:14:58 +02:00
Gerard Marull-Paretas
6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Lauren Murphy
85445474f2 boards, dts: fix filenames and dts refs for adsp clock
Changes filenames and DTS references from CAVS clock to
ADSP clock.

Signed-off-by: Lauren Murphy <lauren.murphy@intel.com>
2022-09-14 07:23:08 -04:00
Michał Barnaś
dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Meng xianglin
9882ae8ace tests: stm32u5_devices: move to new ztest API
test cases in
tests/drivers/clock_control/stm32_clock_configuration/stm32u5_devices
are move to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
f8f667e91c tests: stm32u5_core: move to new ztest API
test cases in
tests/drivers/clock_control/stm32_clock_configuration/stm32u5_core
are moved to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
0ef8aae92b tests: stm32h7_devices: move to new ztest API
test cases in
tests/drivers/clock_control/stm32_clock_configuration/stm32h7_devices
are moved to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
45c5c7ba91 tests: stm32h7_core: move to new ztest API
test cases in
tests/drivers/clock_control/stm32_clock_configuration/stm32h7_core
are moved to new zest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
4e2da2e58f tests: stm32_common_devices: move to new ztest API
test cases in
tests/drivers/clock_control/stm32_clock_configuration/stm32_common_devices
are moved to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
bfd5118f53 tests: stm32_common_core: move to new ztest API
test cases in
tests/dirvers/clock_control/stm32_clock_configuration/stm32_common_core
are moved to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
13d281b683 tests: onoff: move to new ztest API
test cases in tests/drivers/clock_control/onoff are moved to new
ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
22d62cf28d tests: nrf_onof_and_bt: move to new ztest API
test cases in tests/drivers/clock_control/nrf_onoff_and_bt are moved
to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
13d22e0937 tests: nrf_lf_clock_start: move to new ztest API
test cases in tests/drivers/clock_control/nrf_lf_clock_start are
move to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
dae9bb4705 tests: nrf_clock_calibration: move to new ztest API
test cases in tests/drivers/clock_control/nrf_clck_calibration
are moved to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
d22f52a306 tests: clock_control_api: move to new ztest API
test cases in tests/drivers/clock_control/clock_control_api are
moved to new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Meng xianglin
fc2e86011b tests: cavs_clock: move to new ztest API
test cases in tests/drivers/clock_control/cavs_clock are moved to
new ztest API

Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
2022-09-05 10:13:27 +00:00
Gerard Marull-Paretas
a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Gerard Marull-Paretas
e0125d04af devices: constify statically initialized device pointers
It is frequent to find variable definitions like this:

```c
static const struct device *dev = DEVICE_DT_GET(...)
```

That is, module level variables that are statically initialized with a
device reference. Such value is, in most cases, never changed meaning
the variable can also be declared as const (immutable). This patch
constifies all such cases.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Erwan Gouriou
7b8baf3c56 tests: clock_control: stm32_common: Add a comment when enabling adc node
On some tests adc node is enabled w/o setting any domain clock.
This is made on purpose but deserves a comment to avoid surprises
for the reader.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 16:35:41 +01:00
Erwan Gouriou
110ac02da1 tests: clock_control: stm32f3: Fix test overlay
A second, faulty, configuration was provided for rcc node, which made
the test failing.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-12 16:35:41 +01:00
Francois Ramu
8401644416 tests: drivers: clock_control rename stm32 ahb test configuration
rename to pll_msis_ahb_2_40

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-10 14:32:14 +02:00
Erwan Gouriou
1ef9e9eb9b include: drivers: stm32 clock_control: Replace OPT by DOMAIN
In the continuation of the previous commit, replace _OPT_ by _DOMAIN_
in macros relating to this feature.
hen, adapt drivers and tests to this new wording.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-08-08 14:17:07 +02:00
Fabio Baltieri
def230187b test: fix more legacy #include paths
Add a bunch of missing "zephyr/" prefixes to #include statements in
various test and test framework files.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Erwan Gouriou
97d75a6f59 tests: clock_control: stm32u5: Add tests to check HSE and HSI as sysclk src
This allows to complete test coverage on this driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Erwan Gouriou
5fe7b47e52 tests: clock_control: stm32u5 device: Fix clk_msik configuration
In tests/drivers/clock_control/stm32_clock_configuration/stm32u5_devices
test suite, core_init.overlay configure msis to use pll-mode.
Since pll-mode is not configured for msik in spi1_msik variant the test
fails since both clocks should support the same configuration regarding
pll mode (an assert in raised in the driver).

Fix this in spi1_msik test variant.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-07-30 08:23:35 -05:00
Kumar Gala
2014c59d20 clock_control: remove defconfig/proj setting of clock control drivers
Now that clock control drivers are enabled based on devicetree we
can remove any cases of them getting enabled by *defconfig and
proj.conf files.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-29 14:12:12 +02:00
Ederson de Souza
49d1583e2a soc/xtensa/intel_adsp: Enable WOVCRO based on platform support
Instead of enabling WOVCRO clock based on the SOC, use a configuration
to indicate support, so that each platform can specify if WOVCRO is
supported or not.

Signed-off-by: Ederson de Souza <ederson.desouza@intel.com>
2022-07-28 11:04:05 -04:00
Anas Nashif
43371d0414 intel_adsp: move cavs to be a series
Intel ADSP CAVS is now a proper series with all CAVS SoCs running under
it. This will give us to Intel ADSP series:
- CAVS
- ACE v1.x

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-25 16:50:24 -04:00
Tomislav Milkovic
0fe2c1fe90 everywhere: Fix legacy include paths
Any project with Kconfig option CONFIG_LEGACY_INCLUDE_PATH set to n
couldn't be built because some files were missing zephyr/ prefix in
includes
Re-run the migrate_includes.py script to fix all legacy include paths

Signed-off-by: Tomislav Milkovic <milkovic@byte-lab.com>
2022-07-18 16:16:47 +00:00
Johann Fischer
d66e047e5b tests: use unsigned int for irq_lock()
irq_lock() returns an unsigned integer key.
Generated by spatch using semantic patch
scripts/coccinelle/irq_lock.cocci

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2022-07-14 14:37:13 -05:00
Kumar Gala
284611f3f1 tests: clock_control_api: Rework test to use struct device
Move to pass 'struct device *' instead of a 'char *'.  This lets us move
from device_get_binding to DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-11 10:21:26 +02:00
Kumar Gala
9985f2d281 tests: drivers: nrf_clock_calibration: Convert to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-07 10:04:38 +02:00
Kumar Gala
ef26ab7e85 tests: clock_control: on_off: Convert to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-07 10:03:49 +02:00
Kumar Gala
e42cffb058 tests: clock_control: nrf_onoff_and_bt: Convert to use DEVICE_DT_GET
Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-07 10:03:36 +02:00
Thomas Stranger
33eba217de tests/drivers/clock_control: stm32_common_devices: add adc alt. clk. src
This commit adds a test case that configures an alternative clock source
for an ADC peripheral.

In case no alt clock is available, only the gating clock is enabled
and disabled.
Unlike the i2c and lptim test, the actual gating clock frequency is
not checked, because for the adc there seems to be no uniform way
to retrieve the frequency via the hal.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
a6f4d604b6 tests/drivers/clock_control: stm32 add adc-pll_p overlays(g0,g4,wl)
For the STM32G0, STM32G4, and STM32WL enable the adc node in one
configuration, and select the PLL_P output as its clock source.
PLL_P divider is chosen to be 20 to make sure it's a unique frequency.
- g0, and g4 have pll as sysclk
- wl has hse as sysclock

The test configurations and the overlay-files are renamed accordingly.
All overlays that don't specify an alternative clock source still
make sure that the adc node is "okay" to be able to perform basic test.
The basic test only turns on and off the gate clock without checking the
frequency.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00
Thomas Stranger
1feaea34aa tests/drivers/clock_control: stm32_common_devices: lptim check disabled
The test checks if the peripheral gating clock was correctly disabled
after the test, but accidentally the I2C_CLK was checked instead of the
LPTIM_CLK.

This commit fixes this by using __HAL_RCC_LPTIM1_IS_CLK_ENABLED instead.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2022-07-04 16:41:24 +02:00