Commit 199017fa authored by Sanjay Vallimanalan's avatar Sanjay Vallimanalan Committed by Benjamin Cabé
Browse files

soc: mspm0: add poweroff support



add support for SHUTDOWN operating mode in TI MSPM0 series for power-off
operation. Uses HWINFO for reset cause detection to handle shutdown IO
release on low power wakeup.

Signed-off-by: default avatarSanjay Vallimanalan <sanjay@linumiz.com>
Signed-off-by: default avatarParthiban Nallathambi <parthiban@linumiz.com>
parent 0c7edef7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -15,4 +15,8 @@ config MSPM0_PERIPH_STARTUP_DELAY
	int
	default 8

config HWINFO
	bool
	default y if POWEROFF

endif # SOC_FAMILY_TI_MSPM0
+1 −0
Original line number Diff line number Diff line
@@ -4,3 +4,4 @@ zephyr_sources(soc.c)
zephyr_include_directories(.)

zephyr_sources_ifdef(CONFIG_PM power.c)
zephyr_sources_ifdef(CONFIG_POWEROFF poweroff.c)
+40 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2025 Linumiz GmbH
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <soc.h>
#include <zephyr/drivers/hwinfo.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/poweroff.h>
#include <zephyr/toolchain.h>

#include <ti/driverlib/driverlib.h>

void z_sys_poweroff(void)
{
	DL_SYSCTL_setPowerPolicySHUTDOWN();
	__WFI();

	CODE_UNREACHABLE;
}

static int ti_mspm0_poweroff_init(void)
{
	int ret;
	uint32_t rst_cause;

	ret = hwinfo_get_reset_cause(&rst_cause);
	if (ret != 0) {
		return ret;
	}

	if (RESET_LOW_POWER_WAKE == rst_cause) {
		DL_SYSCTL_releaseShutdownIO();
	}

	return 0;
}

SYS_INIT(ti_mspm0_poweroff_init, POST_KERNEL, 0);
+1 −0
Original line number Diff line number Diff line
@@ -14,5 +14,6 @@ config SOC_SERIES_MSPM0G
	select BUILD_OUTPUT_HEX
	select HAS_MSPM0_SDK
	select HAS_PM
	select HAS_POWEROFF
	select CLOCK_CONTROL
	select SOC_EARLY_INIT_HOOK
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ config SOC_SERIES_MSPM0L
	select BUILD_OUTPUT_HEX
	select HAS_MSPM0_SDK
	select HAS_PM
	select HAS_POWEROFF
	select CLOCK_CONTROL
	select SOC_EARLY_INIT_HOOK