File tree Expand file tree Collapse file tree 6 files changed +51
-0
lines changed
include/zephyr/dt-bindings/clock
soc/nuvoton/numaker/m2l31x Expand file tree Collapse file tree 6 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 48
48
clk-pclkdiv = <(NUMAKER_CLK_PCLKDIV_APB0DIV_DIV2 |
49
49
NUMAKER_CLK_PCLKDIV_APB1DIV_DIV2)>;
50
50
core-clock = <DT_FREQ_M(72)>;
51
+ powerdown-mode = <NUMAKER_CLK_PMUCTL_PDMSEL_DPD0>;
51
52
52
53
pcc: peripheral-clock-controller {
53
54
compatible = "nuvoton,numaker-pcc";
Original file line number Diff line number Diff line change 271
271
#define NUMAKER_LPADC0_MODULE 0xB5431218
272
272
#define NUMAKER_OPA_MODULE 0xA000001B
273
273
274
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_PD 0x00000000
275
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_NPD0 0x00000000
276
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_NPD1 0x00000001
277
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_NPD2 0x00000002
278
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_NPD3 0x00000003
279
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_NPD4 0x00000004
280
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_NPD5 0x00000005
281
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_SPD0 0x00000008
282
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_SPD1 0x00000009
283
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_SPD2 0x0000000A
284
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_DPD0 0x0000000C
285
+ #define NUMAKER_CLK_PMUCTL_PDMSEL_DPD1 0x0000000D
286
+
274
287
#endif
Original file line number Diff line number Diff line change @@ -6,4 +6,6 @@ zephyr_sources(soc.c)
6
6
7
7
zephyr_include_directories (. )
8
8
9
+ zephyr_library_sources_ifdef (CONFIG_POWEROFF poweroff.c )
10
+
9
11
set (SOC_LINKER_SCRIPT ${ZEPHYR_BASE} /include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "" )
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ config SOC_SERIES_M2L31X
8
8
select CPU_CORTEX_M_HAS_SYSTICK
9
9
select CPU_CORTEX_M_HAS_VTOR
10
10
select CPU_HAS_ARM_MPU
11
+ select HAS_POWEROFF
11
12
12
13
config SOC_M2L31XXX
13
14
select HAS_NUMAKER_HAL
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2024 Nuvoton Technology Corporation.
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ #include <zephyr/kernel.h>
8
+ #include <zephyr/devicetree.h>
9
+ #include <zephyr/sys/poweroff.h>
10
+ #include <NuMicro.h>
11
+
12
+ void z_sys_poweroff (void )
13
+ {
14
+ SYS_UnlockReg ();
15
+
16
+ /* Clear all wake-up flag */
17
+ CLK -> PMUSTS |= CLK_PMUSTS_CLRWK_Msk ;
18
+
19
+ /* Select Power-down mode */
20
+ CLK_SetPowerDownMode (DT_PROP_OR (DT_NODELABEL (scc ), powerdown_mode , CLK_PMUCTL_PDMSEL_SPD0 ));
21
+
22
+ /* Enable RTC wake-up */
23
+ CLK_ENABLE_RTCWK ();
24
+
25
+ /* Enter to Power-down mode */
26
+ CLK_PowerDown ();
27
+
28
+ k_cpu_idle ();
29
+
30
+ CODE_UNREACHABLE ;
31
+ }
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ void z_arm_platform_init(void)
16
16
/* Unlock protected registers */
17
17
SYS_UnlockReg ();
18
18
19
+ /* Release I/O hold status */
20
+ CLK -> IOPDCTL = 1 ;
21
+
19
22
/*
20
23
* -------------------
21
24
* Init System Clock
You can’t perform that action at this time.
0 commit comments