soc: arm: nxp_imx: rt5xx: add support for power off

Implement support for sys_poweroff(). Code re-used from the PM SOFT_OFF
implementation.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2023-07-20 12:43:10 +02:00 committed by Carles Cufí
commit b5d05e9670
3 changed files with 26 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -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;
}