imx8qm: turn off A53 cluster for cpu hotplug

The issue of A53 cluster runtime power ON/OFF has been
identified as fifo reset issue, and there is software
workaround to avoid such issue and A53 cluster now can
be turned OFF.

Signed-off-by: Nitin Garg <nitin.garg@nxp.com>
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
(cherry picked from commit 77de1ee8108781ee373613606b94e6ad55ae8ccc)
diff --git a/bl31/aarch64/bl31_entrypoint.S b/bl31/aarch64/bl31_entrypoint.S
index 58e8afb..fe55f12 100644
--- a/bl31/aarch64/bl31_entrypoint.S
+++ b/bl31/aarch64/bl31_entrypoint.S
@@ -21,6 +21,41 @@
 	 */
 
 func bl31_entrypoint
+#ifdef PLAT_imx8qm
+	ldr    x1, stm
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1] /* 16 */
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1]
+	str    w0, [x1] /* 32 */
+#endif
 #if !RESET_TO_BL31
 	/* ---------------------------------------------------------------
 	 * Stash the previous bootloader arguments x0 - x3 for later use.
@@ -110,6 +145,10 @@
 	b	el3_exit
 endfunc bl31_entrypoint
 
+.ltorg
+stm:
+	.quad 0x5D1B0020
+
 	/* --------------------------------------------------------------------
 	 * This CPU has been physically powered up. It is either resuming from
 	 * suspend or has simply been turned on. In both cases, call the BL31
diff --git a/plat/imx/imx8qm/imx8qm_psci.c b/plat/imx/imx8qm/imx8qm_psci.c
index 4825d4d..1536255 100644
--- a/plat/imx/imx8qm/imx8qm_psci.c
+++ b/plat/imx/imx8qm/imx8qm_psci.c
@@ -78,8 +78,8 @@
 	sc_pm_set_resource_power_mode(ipc_handle, cluster_id == 0 ?
 		SC_R_A53 : SC_R_A72, SC_PM_PW_MODE_ON);
 
-	if (cluster_id == 1)
-		sc_pm_req_low_power_mode(ipc_handle, SC_R_A72, SC_PM_PW_MODE_ON);
+	sc_pm_req_low_power_mode(ipc_handle, cluster_id == 0 ?
+		SC_R_A53 : SC_R_A72, SC_PM_PW_MODE_ON);
 
 	if (sc_pm_set_resource_power_mode(ipc_handle,
 		ap_core_index[cpu_id + PLATFORM_CLUSTER0_CORE_COUNT * cluster_id],
@@ -122,8 +122,8 @@
 
 	if (is_local_state_off(CLUSTER_PWR_STATE(target_state))) {
 		cci_disable_snoop_dvm_reqs(cluster_id);
-		if (cluster_id == 1)
-			sc_pm_req_low_power_mode(ipc_handle, SC_R_A72, SC_PM_PW_MODE_OFF);
+		sc_pm_req_low_power_mode(ipc_handle, cluster_id == 0 ?
+			SC_R_A53 : SC_R_A72, SC_PM_PW_MODE_OFF);
 	}
 }