From ef3f0fc559c355038872549ee2deac32418e42a4 Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Wed, 6 Sep 2017 20:54:24 +0800 Subject: i.mx8qm/i.mx8qxp: psci: add power off support Add system_off pcsi callback to avoid below kernel message when doing power off: [11613.953711] reboot: Power down [11613.958318] systemd-shutdow: 8 output lines suppressed due to ratelimiting [11613.965285] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00 [11613.965285] [11613.974441] CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 4.9.11-03354-g0e1 [11613.982369] Hardware name: Freescale i.MX8QXP LPDDR4 ARM2 (DT) [11613.988216] Call trace: [11613.990681] [] dump_backtrace+0x0/0x1a8 [11613.996092] [] show_stack+0x14/0x1c [11614.001154] [] dump_stack+0x8c/0xac [11614.006213] [] panic+0x124/0x28c [11614.011016] [] complete_and_exit+0x0/0x20 [11614.016600] [] SyS_reboot+0x168/0x244 [11614.021829] [] el0_svc_naked+0x24/0x28 [11614.027153] Kernel Offset: disabled [11614.030646] Memory Limit: none [11614.040755] ---[ end Kernel panic - not syncing: Attempted to kill init! exi0 [11614.040755] As there is no system power off SCFW API available now, so just simply do wfi and never return when system_off is called. Signed-off-by: Anson Huang --- plat/freescale/imx8qm/imx8qm_psci.c | 11 +++++++++++ plat/freescale/imx8qxp/imx8qxp_psci.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/plat/freescale/imx8qm/imx8qm_psci.c b/plat/freescale/imx8qm/imx8qm_psci.c index 7cc80c88..ebc7d08c 100644 --- a/plat/freescale/imx8qm/imx8qm_psci.c +++ b/plat/freescale/imx8qm/imx8qm_psci.c @@ -224,6 +224,16 @@ void __attribute__((noreturn)) imx_system_reset(void) ; } +void __attribute__((noreturn)) imx_system_off(void) +{ + /* + * Never return, no SCFW API is available for + * system poweroff, here just do wfi for now + */ + while (1) + wfi(); +} + 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, @@ -235,6 +245,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/imx8qxp/imx8qxp_psci.c b/plat/freescale/imx8qxp/imx8qxp_psci.c index 6f2883f4..f235d5ec 100644 --- a/plat/freescale/imx8qxp/imx8qxp_psci.c +++ b/plat/freescale/imx8qxp/imx8qxp_psci.c @@ -201,6 +201,16 @@ void __attribute__((noreturn)) imx_system_reset(void) ; } +void __attribute__((noreturn)) imx_system_off(void) +{ + /* + * Never return, no SCFW API is available for + * system poweroff, here just do wfi for now + */ + while (1) + wfi(); +} + 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, @@ -212,6 +222,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 */ -- cgit v1.2.3