From 542e7d15f95a6084e23316214d333b67c484248a Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Wed, 5 Jul 2017 18:29:30 +0800 Subject: plat: freescale: imx8mq: add system off support Add system off support, linux kernel can issue "poweroff" to power down system. Signed-off-by: Anson Huang --- plat/freescale/imx8mq/imx8m_psci.c | 13 +++++++++++++ plat/freescale/imx8mq/include/platform_def.h | 1 + 2 files changed, 14 insertions(+) diff --git a/plat/freescale/imx8mq/imx8m_psci.c b/plat/freescale/imx8mq/imx8m_psci.c index 117188b7..132468e1 100644 --- a/plat/freescale/imx8mq/imx8m_psci.c +++ b/plat/freescale/imx8mq/imx8m_psci.c @@ -44,6 +44,8 @@ #define GPC_CPU_PGC_SW_PUP_REQ 0xf0 #define GPC_CPU_PGC_SW_PDN_REQ 0xfc +#define SNVS_LPCR 0x38 + extern void imx_gpc_set_core_pdn_pup_by_software(unsigned int cpu, bool pdn); extern void imx_gpc_set_cpu_power_gate_by_wfi(unsigned int cpu, bool pdn); @@ -211,6 +213,16 @@ void __attribute__((noreturn)) imx_system_reset(void) ; } +void __attribute__((noreturn)) imx_system_off(void) +{ + mmio_write_32(IMX_SNVS_BASE + SNVS_LPCR, 0x61); + + tf_printf("Unable to poweroff system\n"); + + while (1) + ; +} + static const plat_psci_ops_t imx_plat_psci_ops = { .pwr_domain_on = imx_pwr_domain_on, .pwr_domain_on_finish = imx_pwr_domain_on_finish, @@ -222,6 +234,7 @@ static const plat_psci_ops_t imx_plat_psci_ops = { .pwr_domain_suspend_finish = imx_domain_suspend_finish, .get_sys_suspend_power_state = imx_get_sys_suspend_power_state, .system_reset = imx_system_reset, + .system_off = imx_system_off, }; /* export the platform specific psci ops */ diff --git a/plat/freescale/imx8mq/include/platform_def.h b/plat/freescale/imx8mq/include/platform_def.h index 058cd4ef..32d5839d 100644 --- a/plat/freescale/imx8mq/include/platform_def.h +++ b/plat/freescale/imx8mq/include/platform_def.h @@ -46,6 +46,7 @@ #define IMX_SRC_BASE 0x30390000 #define IMX_GPC_BASE 0x303a0000 #define IMX_WDOG_BASE 0x30280000 +#define IMX_SNVS_BASE 0x30370000 #define COUNTER_FREQUENCY 8000000 /* 8MHz */ -- cgit v1.2.3