imx: imx8qx: add domain off support
authorAnson Huang <Anson.Huang@nxp.com>
Thu, 12 Jul 2018 03:07:10 +0000 (11:07 +0800)
committerAnson Huang <Anson.Huang@nxp.com>
Thu, 12 Jul 2018 03:12:39 +0000 (11:12 +0800)
Add domain off support for Linux kernel's cpu
hot-plug feature, when there are cpu off request
from Linux kernel, TF-A will send command to
system controller to do CPU power gate accordingly.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
plat/imx/imx8qx/imx8qx_psci.c

index 80f747b19a326c977dd55fbe6978120402dce551..7a6e822b743baba7be4166e3b8103f08ce881be9 100644 (file)
@@ -60,12 +60,24 @@ int imx_validate_ns_entrypoint(uintptr_t ns_entrypoint)
        return PSCI_E_SUCCESS;
 }
 
+void imx_pwr_domain_off(const psci_power_state_t *target_state)
+{
+       u_register_t mpidr = read_mpidr_el1();
+       unsigned int cpu_id = MPIDR_AFFLVL0_VAL(mpidr);
+
+       plat_gic_cpuif_disable();
+       sc_pm_req_cpu_low_power_mode(ipc_handle, ap_core_index[cpu_id],
+               SC_PM_PW_MODE_OFF, SC_PM_WAKE_SRC_NONE);
+       tf_printf("turn off core:%d\n", cpu_id);
+}
+
 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,
        .validate_ns_entrypoint = imx_validate_ns_entrypoint,
        .system_off = imx_system_off,
        .system_reset = imx_system_reset,
+       .pwr_domain_off = imx_pwr_domain_off,
 };
 
 int plat_setup_psci_ops(uintptr_t sec_entrypoint,