Skip to content

Commit 337dbc9

Browse files
committed
soc: nxp: mcxw2xx: Enable the power management
Enabled modes: idle: SLEEP suspend: DEEP-SLEEP standby: POWER-DOWN with CPU retention OS Time Base: OSTIMER with fro1m clock source Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
1 parent f3fa3fd commit 337dbc9

File tree

6 files changed

+327
-5
lines changed

6 files changed

+327
-5
lines changed

boards/nxp/frdm_mcxw23/doc/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,21 @@ should see the following message in the terminal:
198198
*** Booting Zephyr OS build v4.2.0-2105-g48f2ffda26de ***
199199
Hello World! frdm_mcxw23/mcxw236
200200
201+
Power Management
202+
================
203+
204+
When Power Management is enabled, OSTIMER is used as OS tick timer.
205+
Add device tree overlay file to the main directory of your application
206+
to enable OSTIMER.
207+
208+
.. code-block:: devicetree
209+
210+
&os_timer {
211+
status = "okay";
212+
};
213+
214+
Limitation: Wakeup pin can't be used as wakeup source in Standby mode.
215+
201216
.. include:: ../../common/board-footer.rst.inc
202217

203218
.. _MCXW23 SoC Website:

boards/nxp/mcxw23_evk/doc/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ should see the following message in the terminal:
177177
*** Booting Zephyr OS build v4.2.0-2105-g9da1d56da9e7 ***
178178
Hello World! mcxw23_evk/mcxw236
179179
180+
Power Management
181+
================
182+
183+
When Power Management is enabled, OSTIMER is used as OS tick timer.
184+
Add device tree overlay file to the main directory of your application
185+
to enable OSTIMER.
186+
187+
.. code-block:: devicetree
188+
189+
&os_timer {
190+
status = "okay";
191+
};
192+
193+
Limitation: Wakeup pin can't be used as wakeup source in Standby mode.
194+
180195
.. include:: ../../common/board-footer.rst.inc
181196

182197
.. _MCXW23 SoC Website:

dts/arm/nxp/nxp_mcxw23x_common.dtsi

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,47 @@
3232
reg = <0>;
3333
#address-cells = <1>;
3434
#size-cells = <1>;
35+
cpu-power-states = <&idle &suspend &standby>;
3536

3637
mpu: mpu@e000ed90 {
3738
compatible = "arm,armv8m-mpu";
3839
reg = <0xe000ed90 0x40>;
3940
};
4041
};
42+
43+
power-states {
44+
/* Idle mode maps to Sleep mode. */
45+
idle: idle {
46+
compatible = "zephyr,power-state";
47+
power-state-name = "runtime-idle";
48+
min-residency-us = <60>;
49+
exit-latency-us = <16>;
50+
zephyr,pm-device-disabled;
51+
};
52+
53+
/* Suspend mode maps to Deep Sleep mode. */
54+
suspend: suspend {
55+
compatible = "zephyr,power-state";
56+
power-state-name = "suspend-to-idle";
57+
min-residency-us = <1300>;
58+
exit-latency-us = <749>;
59+
};
60+
61+
/* Standby mode maps to Power Down mode with CPU retention . */
62+
standby: standby {
63+
compatible = "zephyr,power-state";
64+
power-state-name = "standby";
65+
min-residency-us = <2000>;
66+
exit-latency-us = <1345>;
67+
};
68+
};
69+
};
70+
71+
/* For the resource which will be off and lose content. */
72+
standby_off_domain: standby-off-domain {
73+
compatible = "power-domain-soc-state-change";
74+
#power-domain-cells = <0>;
75+
onoff-power-states = <&standby>;
4176
};
4277

4378
sysclk: system-clock {
@@ -175,6 +210,7 @@
175210
mode = <0>;
176211
input = <0>;
177212
prescale = <0>;
213+
zephyr,disabling-power-states = <&suspend &standby>;
178214
};
179215

180216
ctimer1: ctimer@9000 {
@@ -187,6 +223,7 @@
187223
mode = <0>;
188224
input = <0>;
189225
prescale = <0>;
226+
zephyr,disabling-power-states = <&suspend &standby>;
190227
};
191228

192229
ctimer2: ctimer@28000 {
@@ -199,6 +236,7 @@
199236
mode = <0>;
200237
input = <0>;
201238
prescale = <0>;
239+
zephyr,disabling-power-states = <&suspend &standby>;
202240
};
203241

204242
ctimer3: ctimer@29000 {
@@ -211,6 +249,7 @@
211249
mode = <0>;
212250
input = <0>;
213251
prescale = <0>;
252+
zephyr,disabling-power-states = <&suspend &standby>;
214253
};
215254

216255
ctimer4: ctimer@2a000 {
@@ -223,6 +262,7 @@
223262
mode = <0>;
224263
input = <0>;
225264
prescale = <0>;
265+
zephyr,disabling-power-states = <&suspend &standby>;
226266
};
227267

228268
sc_timer: pwm@85000 {
@@ -232,14 +272,15 @@
232272
status = "disabled";
233273
clocks = <&syscon MCUX_SCTIMER_CLK>;
234274
prescaler = <2>;
275+
zephyr,disabling-power-states = <&suspend &standby>;
235276
#pwm-cells = <3>;
236277
};
237278

238279
os_timer: timers@2d000 {
239280
compatible = "nxp,os-timer";
240281
reg = <0x2d000 0x1000>;
241282
interrupts = <38 1>;
242-
status = "disabled";
283+
resets = <&reset NXP_SYSCON_RESET(1, 1)>;
243284
};
244285

245286
flexcomm0: flexcomm@86000 {
@@ -250,6 +291,7 @@
250291
resets = <&reset NXP_SYSCON_RESET(1, 11)>;
251292
dmas = <&dma0 4 &dma0 5>;
252293
dma-names = "rx", "tx";
294+
zephyr,disabling-power-states = <&suspend &standby>;
253295
status = "disabled";
254296
};
255297

@@ -261,6 +303,8 @@
261303
resets = <&reset NXP_SYSCON_RESET(1, 12)>;
262304
dmas = <&dma0 6 &dma0 7>;
263305
dma-names = "rx", "tx";
306+
zephyr,disabling-power-states = <&suspend &standby>;
307+
power-domains = <&standby_off_domain>;
264308
status = "disabled";
265309
};
266310

@@ -272,6 +316,8 @@
272316
resets = <&reset NXP_SYSCON_RESET(1, 13)>;
273317
dmas = <&dma0 8 &dma0 9>;
274318
dma-names = "rx", "tx";
319+
zephyr,disabling-power-states = <&suspend &standby>;
320+
power-domains = <&standby_off_domain>;
275321
status = "disabled";
276322
};
277323

@@ -287,6 +333,8 @@
287333
reg = <0x82000 0x1000>;
288334
interrupts = <1 1>;
289335
dma-channels = <23>;
336+
zephyr,disabling-power-states = <&suspend &standby>;
337+
power-domains = <&standby_off_domain>;
290338
status = "disabled";
291339
#dma-cells = <1>;
292340
};
@@ -296,6 +344,8 @@
296344
reg = <0xa7000 0x1000>;
297345
interrupts = <58 1>;
298346
dma-channels = <10>;
347+
zephyr,disabling-power-states = <&suspend &standby>;
348+
power-domains = <&standby_off_domain>;
299349
status = "disabled";
300350
#dma-cells = <1>;
301351
};
@@ -328,6 +378,7 @@
328378
resets = <&reset NXP_SYSCON_RESET(1, 0)>;
329379
#address-cells = <1>;
330380
#size-cells = <0>;
381+
zephyr,disabling-power-states = <&suspend &standby>;
331382

332383
mrt0_channel0: mrt0_channel@0 {
333384
compatible = "nxp,mrt-channel";

soc/nxp/mcx/mcxw/mcxw2xx/Kconfig.defconfig

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
if SOC_SERIES_MCXW2XX
66

7+
config MCUX_OS_TIMER
8+
default y if PM
9+
710
config CORTEX_M_SYSTICK
811
default n if MCUX_OS_TIMER
912

@@ -36,4 +39,35 @@ config MAIN_STACK_SIZE
3639

3740
endif # BT
3841

42+
if PM
43+
44+
# Enable PM_DEVICE for Suspend mode and Standby mode,
45+
# because some devices can't work in these modes.
46+
config PM_DEVICE
47+
default y if "$(dt_nodelabel_enabled,standby)" || "$(dt_nodelabel_enabled,suspend)"
48+
49+
config PM_POLICY_DEVICE_CONSTRAINTS
50+
default y if PM_DEVICE
51+
52+
config IDLE_STACK_SIZE
53+
default 640
54+
55+
config TICKLESS_KERNEL
56+
default y if PM
57+
58+
if BT
59+
choice PM_POLICY
60+
default PM_POLICY_CUSTOM
61+
endchoice
62+
endif # BT
63+
64+
endif # PM
65+
66+
if PM_DEVICE
67+
68+
config POWER_DOMAIN
69+
default y
70+
71+
endif # PM_DEVICE
72+
3973
endif # SOC_SERIES_MCXW2XX

0 commit comments

Comments
 (0)