ti: k3: drivers: ti_sci: Use non-blocking TI-SCI messages for power down
Now that we have non-blocking TI-SCI functions we can initiate the shutdown
sequence from the PSCI handler without needing the ti_sci_proc_shutdown
helper function, which is removed. This gives us the greater control and
flexibility that will be needed when cluster power down sequences are added.
Signed-off-by: Andrew F. Davis <afd@ti.com>
diff --git a/plat/ti/k3/common/k3_psci.c b/plat/ti/k3/common/k3_psci.c
index 235e639..afe465e 100644
--- a/plat/ti/k3/common/k3_psci.c
+++ b/plat/ti/k3/common/k3_psci.c
@@ -13,6 +13,7 @@
#include <lib/psci/psci.h>
#include <plat/common/platform.h>
+#include <ti_sci_protocol.h>
#include <k3_gicv3.h>
#include <ti_sci.h>
@@ -90,9 +91,24 @@
proc = PLAT_PROC_START_ID + core_id;
device = PLAT_PROC_DEVICE_START_ID + core_id;
- ret = ti_sci_proc_shutdown(proc, device);
+ /* Start by sending wait for WFI command */
+ ret = ti_sci_proc_wait_boot_status_no_wait(proc,
+ /*
+ * Wait maximum time to give us the best chance to get
+ * to WFI before this command timeouts
+ */
+ UINT8_MAX, 100, UINT8_MAX, UINT8_MAX,
+ /* Wait for WFI */
+ PROC_BOOT_STATUS_FLAG_ARMV8_WFI, 0, 0, 0);
if (ret) {
- ERROR("Request to stop core failed: %d\n", ret);
+ ERROR("Sending wait for WFI failed (%d)\n", ret);
+ return;
+ }
+
+ /* Now queue up the core shutdown request */
+ ret = ti_sci_device_put_no_wait(device);
+ if (ret) {
+ ERROR("Sending core shutdown message failed (%d)\n", ret);
return;
}
}