Skip to content

Commit

Permalink
soc: arm: nxp_imx: rt5xx: add support for power off
Browse files Browse the repository at this point in the history
Implement support for sys_poweroff(). Code re-used from the PM SOFT_OFF
implementation.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
  • Loading branch information
gmarull authored and carlescufi committed Aug 4, 2023
1 parent 96b3827 commit b5d05e9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions soc/arm/nxp_imx/rt5xx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ zephyr_sources(

zephyr_sources_ifdef(CONFIG_PM power.c)

zephyr_sources_ifdef(CONFIG_POWEROFF poweroff.c)

zephyr_library_include_directories(
${ZEPHYR_BASE}/kernel/include
${ZEPHYR_BASE}/arch/${ARCH}/include
Expand Down
1 change: 1 addition & 0 deletions soc/arm/nxp_imx/rt5xx/Kconfig.series
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ config SOC_SERIES_IMX_RT5XX
select SOC_FAMILY_IMX
select CLOCK_CONTROL
select HAS_PM
select HAS_POWEROFF
help
Enable support for i.MX RT5XX Series MCU series
23 changes: 23 additions & 0 deletions soc/arm/nxp_imx/rt5xx/poweroff.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/sys/poweroff.h>
#include <zephyr/toolchain.h>

#include <fsl_power.h>

static const uint32_t exclude_from_pd[] = {0, 0, 0, 0};

void z_sys_poweroff(void)
{
/* Disable ISP Pin pull-ups and input buffers to avoid current leakage */
IOPCTL->PIO[1][15] = 0;
IOPCTL->PIO[3][28] = 0;
IOPCTL->PIO[3][29] = 0;

POWER_EnterDeepPowerDown(exclude_from_pd);

CODE_UNREACHABLE;
}

0 comments on commit b5d05e9

Please sign in to comment.