diff options
author | Luka Kovacic <luka.kovacic@sartura.hr> | 2020-01-13 20:37:35 +0100 |
---|---|---|
committer | Luka Kovacic <luka.kovacic@sartura.hr> | 2020-01-15 07:31:43 +0100 |
commit | 8c11ebfcdac0802119293f8c00912a54048ddd02 (patch) | |
tree | 89a47aa69aeca606c0497bad92a45f1bc80156e4 /plat/marvell/a8k | |
parent | 743600b25ccbea5733a9794241f98f2a9cdd508d (diff) | |
download | trusted-firmware-a-8c11ebfcdac0802119293f8c00912a54048ddd02.tar.gz |
a8k: Implement platform specific power off
Implements a way to add platform specific power off code to a
Marvell Armada 8K platform.
Marvell Armada 8K boards can now add a board/system_power.c file
that contains a system_power_off() function.
This function can now send a command to a power management MCU or
other board periferals before shutting the board down.
Signed-off-by: Luka Kovacic <luka.kovacic@sartura.hr>
Cc: Luka Perkov <luka.perkov@sartura.hr>
Change-Id: Iaba20bc2f603195679c54ad12c0c18962dd8e3db
---
I am working on a device that will be ported later, which has a
custom power management MCU that handles LEDs, board power and fans
and requires this separation.
Diffstat (limited to 'plat/marvell/a8k')
-rw-r--r-- | plat/marvell/a8k/common/a8k_common.mk | 11 | ||||
-rw-r--r-- | plat/marvell/a8k/common/plat_pm.c | 12 |
2 files changed, 23 insertions, 0 deletions
diff --git a/plat/marvell/a8k/common/a8k_common.mk b/plat/marvell/a8k/common/a8k_common.mk index ccb662bb2c..bf79ebeec6 100644 --- a/plat/marvell/a8k/common/a8k_common.mk +++ b/plat/marvell/a8k/common/a8k_common.mk @@ -37,6 +37,13 @@ DOIMAGETOOL ?= ${DOIMAGEPATH}/doimage ROM_BIN_EXT ?= $(BUILD_PLAT)/ble.bin DOIMAGE_FLAGS += -b $(ROM_BIN_EXT) $(NAND_DOIMAGE_FLAGS) $(DOIMAGE_SEC_FLAGS) +# Check whether to build system_power.c for the platform +ifneq ("$(wildcard $(PLAT_FAMILY_BASE)/$(PLAT)/board/system_power.c)","") +SYSTEM_POWER_SUPPORT = 1 +else +SYSTEM_POWER_SUPPORT = 0 +endif + # This define specifies DDR type for BLE $(eval $(call add_define,CONFIG_DDR4)) @@ -82,6 +89,10 @@ MARVELL_DRV := $(MARVELL_DRV_BASE)/io_win.c \ BL31_PORTING_SOURCES := $(PLAT_FAMILY_BASE)/$(PLAT)/board/marvell_plat_config.c +ifeq ($(SYSTEM_POWER_SUPPORT),1) +BL31_PORTING_SOURCES += $(PLAT_FAMILY_BASE)/$(PLAT)/board/system_power.c +endif + BL31_SOURCES += lib/cpus/aarch64/cortex_a72.S \ $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ $(PLAT_COMMON_BASE)/aarch64/plat_arch_config.c \ diff --git a/plat/marvell/a8k/common/plat_pm.c b/plat/marvell/a8k/common/plat_pm.c index d07601a5f7..96e95c2715 100644 --- a/plat/marvell/a8k/common/plat_pm.c +++ b/plat/marvell/a8k/common/plat_pm.c @@ -792,8 +792,20 @@ __dead2 a8k_pwr_domain_pwr_down_wfi(const psci_power_state_t *target_state) * A8K handlers to shutdown/reboot the system ***************************************************************************** */ + +/* Set a weak stub for platforms that don't configure system power off */ +#pragma weak system_power_off +int system_power_off(void) +{ + return 0; +} + static void __dead2 a8k_system_off(void) { + /* Call the platform specific system power off function */ + system_power_off(); + + /* board doesn't have a system off implementation */ ERROR("%s: needs to be implemented\n", __func__); panic(); } |