Skip to content

Commit bb75fb4

Browse files
committed
tests/drivers/clock_control: stm32: Add stm32_common_devices tests
Add a test section to enable device clock source selection testing. Test targets I2C1 device which supports clock source selection on all SOCs using this driver except L1 Initial test done on wb target. Signed-off-by: Erwan Gouriou <[email protected]>
1 parent 2275aa9 commit bb75fb4

15 files changed

+1134
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
5+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
6+
project(stm32_clock_configuration_common_devices)
7+
8+
FILE(GLOB app_sources src/*.c)
9+
target_sources(app PRIVATE ${app_sources})
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (c) 2022 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Clocks clean up config
8+
* Aim is to avoid conflict with specific default board configuration
9+
*/
10+
11+
&clk_hse {
12+
status = "disabled";
13+
/delete-property/ hse-bypass;
14+
/delete-property/ clock-frequency;
15+
};
16+
17+
&clk_hsi {
18+
status = "disabled";
19+
};
20+
21+
&clk_lse {
22+
status = "disabled";
23+
};
24+
25+
&clk_lsi {
26+
status = "disabled";
27+
};
28+
29+
&pll {
30+
/delete-property/ mul;
31+
/delete-property/ div;
32+
/delete-property/ prediv;
33+
/delete-property/ xtpre;
34+
/delete-property/ clocks;
35+
status = "disabled";
36+
};
37+
38+
&rcc {
39+
/delete-property/ clocks;
40+
/delete-property/ clock-frequency;
41+
};
42+
43+
44+
/* Core set up
45+
* Aim of this part is to provide a base working clock config
46+
*/
47+
48+
&clk_hsi {
49+
clock-frequency = <DT_FREQ_M(8)>;
50+
status = "okay";
51+
};
52+
53+
&pll {
54+
prediv = <2>;
55+
mul = <8>;
56+
clocks = <&clk_hsi>;
57+
status = "okay";
58+
};
59+
60+
&rcc {
61+
clocks = <&pll>;
62+
clock-frequency = <DT_FREQ_M(32)>;
63+
};
64+
65+
&i2c1 {
66+
/delete-property/ clocks;
67+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>,
68+
<&rcc STM32_SRC_HSI I2C1_SEL(2)>;
69+
status = "okay";
70+
};
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* Copyright (c) 2022 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Clocks clean up config
8+
* Aim is to avoid conflict with specific default board configuration
9+
*/
10+
11+
&clk_hse {
12+
status = "disabled";
13+
/delete-property/ hse-bypass;
14+
/delete-property/ clock-frequency;
15+
};
16+
17+
&clk_hsi {
18+
status = "disabled";
19+
};
20+
21+
&clk_lse {
22+
status = "disabled";
23+
};
24+
25+
&clk_lsi {
26+
status = "disabled";
27+
};
28+
29+
&pll {
30+
/delete-property/ mul;
31+
/delete-property/ div;
32+
/delete-property/ prediv;
33+
/delete-property/ xtpre;
34+
/delete-property/ clocks;
35+
status = "disabled";
36+
};
37+
38+
&rcc {
39+
/delete-property/ clocks;
40+
/delete-property/ clock-frequency;
41+
};
42+
43+
/* Core set up
44+
* Aim of this part is to provide a base working clock config
45+
*/
46+
47+
&clk_hsi {
48+
clock-frequency = <DT_FREQ_M(8)>;
49+
status = "okay";
50+
};
51+
52+
&pll {
53+
prediv = <2>;
54+
mul = <8>;
55+
clocks = <&clk_hsi>;
56+
status = "okay";
57+
};
58+
59+
&rcc {
60+
clocks = <&pll>;
61+
clock-frequency = <DT_FREQ_M(32)>;
62+
};
63+
64+
&rcc {
65+
clocks = <&pll>;
66+
clock-frequency = <DT_FREQ_M(64)>;
67+
ahb-prescaler = <1>;
68+
apb1-prescaler = <2>;
69+
};
70+
71+
&i2c1 {
72+
/delete-property/ clocks;
73+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>,
74+
<&rcc STM32_SRC_HSI I2C1_SEL(2)>;
75+
status = "okay";
76+
};
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright (c) 2022 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Clocks clean up config
8+
* Aim is to avoid conflict with specific default board configuration
9+
*/
10+
11+
&clk_hse {
12+
status = "disabled";
13+
/delete-property/ hse-bypass;
14+
/delete-property/ clock-frequency;
15+
};
16+
17+
&clk_hsi {
18+
status = "disabled";
19+
};
20+
21+
&pll {
22+
/delete-property/ div-m;
23+
/delete-property/ mul-n;
24+
/delete-property/ div-p;
25+
/delete-property/ div-q;
26+
/delete-property/ div-r;
27+
/delete-property/ clocks;
28+
status = "disabled";
29+
};
30+
31+
&rcc {
32+
/delete-property/ clocks;
33+
/delete-property/ clock-frequency;
34+
};
35+
36+
37+
/* Core set up
38+
* Aim of this part is to provide a base working clock config
39+
*/
40+
41+
&clk_hsi {
42+
status = "okay";
43+
};
44+
45+
&clk_lse {
46+
status = "okay";
47+
};
48+
49+
&pll {
50+
div-m = <1>;
51+
mul-n = <8>;
52+
div-p = <2>;
53+
div-q = <2>;
54+
div-r = <2>;
55+
clocks = <&clk_hsi>;
56+
status = "okay";
57+
};
58+
59+
&rcc {
60+
clocks = <&pll>;
61+
clock-frequency = <DT_FREQ_M(64)>;
62+
ahb-prescaler = <1>;
63+
apb1-prescaler = <2>;
64+
};
65+
66+
&i2c1 {
67+
/delete-property/ clocks;
68+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>,
69+
<&rcc STM32_SRC_HSI I2C1_SEL(2)>;
70+
status = "okay";
71+
};
72+
73+
&lptim1 {
74+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>,
75+
<&rcc STM32_SRC_LSE LPTIM1_SEL(3)>;
76+
status = "okay";
77+
};
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
* Copyright (c) 2022 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Clocks clean up config
8+
* Aim is to avoid conflict with specific default board configuration
9+
*/
10+
11+
&clk_hse {
12+
status = "disabled";
13+
/delete-property/ hse-bypass;
14+
/delete-property/ clock-frequency;
15+
};
16+
17+
&clk_hsi {
18+
status = "disabled";
19+
};
20+
21+
&pll {
22+
/delete-property/ div-m;
23+
/delete-property/ mul-n;
24+
/delete-property/ div-p;
25+
/delete-property/ div-q;
26+
/delete-property/ div-r;
27+
/delete-property/ clocks;
28+
status = "disabled";
29+
};
30+
31+
&rcc {
32+
/delete-property/ clocks;
33+
/delete-property/ clock-frequency;
34+
};
35+
36+
37+
/* Core set up
38+
* Aim of this part is to provide a base working clock config
39+
*/
40+
41+
&clk_hsi {
42+
status = "okay";
43+
};
44+
45+
&clk_lsi {
46+
status = "okay";
47+
};
48+
49+
&pll {
50+
div-m = <1>;
51+
mul-n = <8>;
52+
div-p = <2>;
53+
div-q = <2>;
54+
div-r = <2>;
55+
clocks = <&clk_hsi>;
56+
status = "okay";
57+
};
58+
59+
&rcc {
60+
clocks = <&pll>;
61+
clock-frequency = <DT_FREQ_M(64)>;
62+
ahb-prescaler = <1>;
63+
apb1-prescaler = <2>;
64+
};
65+
66+
&i2c1 {
67+
/delete-property/ clocks;
68+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>,
69+
<&rcc STM32_SRC_SYSCLK I2C1_SEL(1)>;
70+
status = "okay";
71+
};
72+
73+
&lptim1 {
74+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x80000000>,
75+
<&rcc STM32_SRC_LSI LPTIM1_SEL(1)>;
76+
status = "okay";
77+
};
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2022 Linaro Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/* Clocks clean up config
8+
* Aim is to avoid conflict with specific default board configuration
9+
*/
10+
11+
&clk_hse {
12+
status = "disabled";
13+
/delete-property/ hse-bypass;
14+
/delete-property/ clock-frequency;
15+
};
16+
17+
&clk_hsi {
18+
status = "disabled";
19+
};
20+
21+
&pll {
22+
/delete-property/ div-m;
23+
/delete-property/ mul-n;
24+
/delete-property/ div-p;
25+
/delete-property/ div-q;
26+
/delete-property/ div-r;
27+
/delete-property/ clocks;
28+
status = "disabled";
29+
};
30+
31+
&rcc {
32+
/delete-property/ clocks;
33+
/delete-property/ clock-frequency;
34+
};
35+
36+
37+
/* Core set up
38+
* Aim of this part is to provide a base working clock config
39+
*/
40+
41+
&clk_hsi {
42+
status = "okay";
43+
};
44+
45+
&pll {
46+
div-m = <1>;
47+
mul-n = <8>;
48+
div-p = <2>;
49+
div-q = <2>;
50+
div-r = <2>;
51+
clocks = <&clk_hsi>;
52+
status = "okay";
53+
};
54+
55+
&rcc {
56+
clocks = <&pll>;
57+
clock-frequency = <DT_FREQ_M(64)>;
58+
ahb-prescaler = <1>;
59+
apb1-prescaler = <2>;
60+
};
61+
62+
&i2c1 {
63+
/delete-property/ clocks;
64+
clocks = <&rcc STM32_CLOCK_BUS_APB1 0x00200000>,
65+
<&rcc STM32_SRC_HSI I2C1_SEL(2)>;
66+
status = "okay";
67+
};

0 commit comments

Comments
 (0)