Commit 234b8512 authored by Anson Huang's avatar Anson Huang

imx: add system_reset2 support for i.MX8QM/i.MX8QX

Add system_reset2 support for i.MX8QM/i.MX8QX to support
WARM/COLD/BOARD reset.
Signed-off-by: default avatarAnson Huang <Anson.Huang@nxp.com>
parent c77586be
......@@ -164,6 +164,8 @@
#define PSCI_RESET2_TYPE_VENDOR (U(1) << PSCI_RESET2_TYPE_VENDOR_SHIFT)
#define PSCI_RESET2_TYPE_ARCH (U(0) << PSCI_RESET2_TYPE_VENDOR_SHIFT)
#define PSCI_RESET2_SYSTEM_WARM_RESET (PSCI_RESET2_TYPE_ARCH | U(0))
#define PSCI_RESET2_SYSTEM_COLD_RESET (PSCI_RESET2_TYPE_VENDOR | U(1))
#define PSCI_RESET2_SYSTEM_BOARD_RESET (PSCI_RESET2_TYPE_VENDOR | U(2))
#ifndef __ASSEMBLY__
......
......@@ -27,6 +27,32 @@ void __dead2 imx_system_reset(void)
panic();
}
int imx_system_reset2(int is_vendor, int reset_type, u_register_t cookie)
{
const char *reset_type_name = "";
switch(reset_type) {
case PSCI_RESET2_SYSTEM_WARM_RESET:
sc_pm_reboot(ipc_handle, SC_PM_RESET_TYPE_WARM);
reset_type_name = "warm";
break;
case PSCI_RESET2_SYSTEM_COLD_RESET:
sc_pm_reboot(ipc_handle, SC_PM_RESET_TYPE_COLD);
reset_type_name = "cold";
break;
case PSCI_RESET2_SYSTEM_BOARD_RESET:
sc_pm_reset(ipc_handle, SC_PM_RESET_TYPE_BOARD);
reset_type_name = "board";
break;
default:
return PSCI_E_INVALID_PARAMS;
}
wfi();
ERROR("system %s reset failed.\n", reset_type_name);
panic();
}
#define CORE_PWR_STATE(state) ((state)->pwr_domain_state[MPIDR_AFFLVL0])
#define CLUSTER_PWR_STATE(state) ((state)->pwr_domain_state[MPIDR_AFFLVL1])
#define SYSTEM_PWR_STATE(state) ((state)->pwr_domain_state[PLAT_MAX_PWR_LVL])
......
......@@ -27,6 +27,7 @@ void plat_gic_restore(unsigned int proc_num, struct plat_gic_ctx *ctx);
void __dead2 imx_system_off(void);
void __dead2 imx_system_reset(void);
int imx_system_reset2(int is_vendor, int reset_type, u_register_t cookie);
int imx_validate_power_state(unsigned int power_state,
psci_power_state_t *req_state);
void imx_get_sys_suspend_power_state(psci_power_state_t *req_state);
......
......@@ -294,6 +294,7 @@ static const plat_psci_ops_t imx_plat_psci_ops = {
.validate_ns_entrypoint = imx_validate_ns_entrypoint,
.system_off = imx_system_off,
.system_reset = imx_system_reset,
.system_reset2 = imx_system_reset2,
.pwr_domain_pwr_down_wfi = imx_pwr_domain_pwr_down_wfi,
};
......
......@@ -214,6 +214,7 @@ static const plat_psci_ops_t imx_plat_psci_ops = {
.validate_ns_entrypoint = imx_validate_ns_entrypoint,
.system_off = imx_system_off,
.system_reset = imx_system_reset,
.system_reset2 = imx_system_reset2,
.pwr_domain_off = imx_pwr_domain_off,
.pwr_domain_suspend = imx_domain_suspend,
.pwr_domain_suspend_finish = imx_domain_suspend_finish,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment