Skip to content

Commit eff83ae

Browse files
soc: telink: soc_context.h Fix SOC context
Fixed initial values for Telink specific SOC context. Default SOC context values should correspond to their registers reset values. Setting custom specific initial values leds to unpredictable SOC behavior. Signed-off-by: Andrii Bilynskyi <andrii.bilynskyi@telink-semi.com>
1 parent 1015495 commit eff83ae

File tree

3 files changed

+33
-72
lines changed

3 files changed

+33
-72
lines changed
+11-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021-2024 Telink Semiconductor
2+
* Copyright (c) 2021-2025 Telink Semiconductor
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -11,40 +11,27 @@
1111

1212
/* Telink B91 specific registers. */
1313
#if defined(CONFIG_TELINK_B9X_PFT_ARCH) && defined(__riscv_dsp)
14-
#define SOC_ESF_MEMBERS \
15-
uint32_t mxstatus; \
16-
uint32_t ucode \
1714

18-
#define SOC_ESF_INIT \
19-
0xdeadbaad, \
20-
0xdeadbaad
15+
#define SOC_ESF_MEMBERS \
16+
uint32_t mxstatus; \
17+
uint32_t ucode
2118

22-
#define SOC_ESF_THREAD_INIT(soc_context) \
23-
(soc_context)->mxstatus = 0; \
24-
(soc_context)->ucode = 0
19+
#define SOC_ESF_INIT 0, 0
2520

2621
#elif defined(CONFIG_TELINK_B9X_PFT_ARCH)
27-
#define SOC_ESF_MEMBERS \
28-
uint32_t mxstatus
2922

30-
#define SOC_ESF_INIT \
31-
0xdeadbaad
23+
#define SOC_ESF_MEMBERS uint32_t mxstatus
3224

33-
#define SOC_ESF_THREAD_INIT(soc_context) \
34-
(soc_context)->mxstatus = 0
25+
#define SOC_ESF_INIT 0
3526

3627
#elif defined(__riscv_dsp)
3728

38-
#define SOC_ESF_MEMBERS \
39-
uint32_t ucode
29+
#define SOC_ESF_MEMBERS uint32_t ucode
4030

41-
#define SOC_ESF_INIT \
42-
0xdeadbaad
31+
#define SOC_ESF_INIT 0
4332

44-
#define SOC_ESF_THREAD_INIT(soc_context) \
45-
(soc_context)->ucode = 0
4633
#endif
4734

48-
#endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
35+
#endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
4936

50-
#endif /* SOC_RISCV_TELINK_B9X_SOC_CONTEXT_H */
37+
#endif /* SOC_RISCV_TELINK_B9X_SOC_CONTEXT_H */
+11-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 Telink Semiconductor
2+
* Copyright (c) 2023-2025 Telink Semiconductor
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -11,40 +11,27 @@
1111

1212
/* Telink B91 specific registers. */
1313
#if defined(CONFIG_TELINK_TLX_PFT_ARCH) && defined(__riscv_dsp)
14-
#define SOC_ESF_MEMBERS \
15-
uint32_t mxstatus; \
16-
uint32_t ucode \
1714

18-
#define SOC_ESF_INIT \
19-
0xdeadbaad, \
20-
0xdeadbaad
15+
#define SOC_ESF_MEMBERS \
16+
uint32_t mxstatus; \
17+
uint32_t ucode
2118

22-
#define SOC_ESF_THREAD_INIT(soc_context) \
23-
(soc_context)->mxstatus = 0; \
24-
(soc_context)->ucode = 0
19+
#define SOC_ESF_INIT 0, 0
2520

2621
#elif defined(CONFIG_TELINK_TLX_PFT_ARCH)
27-
#define SOC_ESF_MEMBERS \
28-
uint32_t mxstatus
2922

30-
#define SOC_ESF_INIT \
31-
0xdeadbaad
23+
#define SOC_ESF_MEMBERS uint32_t mxstatus
3224

33-
#define SOC_ESF_THREAD_INIT(soc_context) \
34-
(soc_context)->mxstatus = 0
25+
#define SOC_ESF_INIT 0
3526

3627
#elif defined(__riscv_dsp)
3728

38-
#define SOC_ESF_MEMBERS \
39-
uint32_t ucode
29+
#define SOC_ESF_MEMBERS uint32_t ucode
4030

41-
#define SOC_ESF_INIT \
42-
0xdeadbaad
31+
#define SOC_ESF_INIT 0
4332

44-
#define SOC_ESF_THREAD_INIT(soc_context) \
45-
(soc_context)->ucode = 0
4633
#endif
4734

48-
#endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
35+
#endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
4936

50-
#endif /* SOC_RISCV_TELINK_TLX_SOC_CONTEXT_H */
37+
#endif /* SOC_RISCV_TELINK_TLX_SOC_CONTEXT_H */
+11-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023 Telink Semiconductor
2+
* Copyright (c) 2023-2025 Telink Semiconductor
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -11,40 +11,27 @@
1111

1212
/* Telink W91 specific registers. */
1313
#if defined(CONFIG_TELINK_W91_PFT_ARCH) && defined(__riscv_dsp)
14-
#define SOC_ESF_MEMBERS \
15-
uint32_t mxstatus; \
16-
uint32_t ucode \
1714

18-
#define SOC_ESF_INIT \
19-
0xdeadbaad, \
20-
0xdeadbaad
15+
#define SOC_ESF_MEMBERS \
16+
uint32_t mxstatus; \
17+
uint32_t ucode
2118

22-
#define SOC_ESF_THREAD_INIT(soc_context) \
23-
(soc_context)->mxstatus = 0; \
24-
(soc_context)->ucode = 0
19+
#define SOC_ESF_INIT 0, 0
2520

2621
#elif defined(CONFIG_TELINK_W91_PFT_ARCH)
27-
#define SOC_ESF_MEMBERS \
28-
uint32_t mxstatus
2922

30-
#define SOC_ESF_INIT \
31-
0xdeadbaad
23+
#define SOC_ESF_MEMBERS uint32_t mxstatus
3224

33-
#define SOC_ESF_THREAD_INIT(soc_context) \
34-
(soc_context)->mxstatus = 0
25+
#define SOC_ESF_INIT 0
3526

3627
#elif defined(__riscv_dsp)
3728

38-
#define SOC_ESF_MEMBERS \
39-
uint32_t ucode
29+
#define SOC_ESF_MEMBERS uint32_t ucode
4030

41-
#define SOC_ESF_INIT \
42-
0xdeadbaad
31+
#define SOC_ESF_INIT 0
4332

44-
#define SOC_ESF_THREAD_INIT(soc_context) \
45-
(soc_context)->ucode = 0
4633
#endif
4734

48-
#endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
35+
#endif /* CONFIG_RISCV_SOC_CONTEXT_SAVE */
4936

50-
#endif /* SOC_RISCV_TELINK_W91_SOC_CONTEXT_H */
37+
#endif /* SOC_RISCV_TELINK_W91_SOC_CONTEXT_H */

0 commit comments

Comments
 (0)