]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(ti): add PSCI system_off support
authorAndrew Davis <afd@ti.com>
Wed, 16 Nov 2022 00:08:16 +0000 (18:08 -0600)
committerAndrew Davis <afd@ti.com>
Fri, 13 Jan 2023 00:44:54 +0000 (18:44 -0600)
Send a TI-SCI control message to system firmware to power down the board.

Signed-off-by: Andrew Davis <afd@ti.com>
Change-Id: I6b8fa64baa94da078db82fc8e115630c9f200b3d

plat/ti/k3/board/generic/include/board_def.h
plat/ti/k3/board/j784s4/include/board_def.h
plat/ti/k3/board/lite/include/board_def.h
plat/ti/k3/common/k3_bl31_setup.c
plat/ti/k3/common/k3_psci.c

index 4ff687cd8cce89a158a190707f3a80f9447d9a8a..e118cc3e8ef4a8338b4681a8d34d99063a321f78 100644 (file)
@@ -39,5 +39,6 @@
 #define PLAT_PROC_START_ID             U(32)
 #define PLAT_PROC_DEVICE_START_ID      U(202)
 #define PLAT_CLUSTER_DEVICE_START_ID   U(198)
+#define PLAT_BOARD_DEVICE_ID           U(157)
 
 #endif /* BOARD_DEF_H */
index c2debc70ec85c597edc141fd8db73ddc5a89d486..5683fc0b1dabe0ac358bdd1b4bb136fced658e52 100644 (file)
@@ -39,5 +39,6 @@
 
 #define PLAT_PROC_DEVICE_START_ID      U(202)
 #define PLAT_CLUSTER_DEVICE_START_ID   U(198)
+#define PLAT_BOARD_DEVICE_ID           U(157)
 
 #endif /* BOARD_DEF_H */
index fd4e5b1c4189101ef1632d91825373e665cd4291..b300c08338bbbbedfce723f28549f9bf797049b8 100644 (file)
@@ -41,5 +41,6 @@
 #define PLAT_PROC_START_ID             U(32)
 #define PLAT_PROC_DEVICE_START_ID      U(135)
 #define PLAT_CLUSTER_DEVICE_START_ID   U(134)
+#define PLAT_BOARD_DEVICE_ID           U(157)
 
 #endif /* BOARD_DEF_H */
index 457c95dd6f71d2e123d3ce187344ea65ca8a0f61..6436e7a6661984ca85054a9b8d982a3f3f260127 100644 (file)
@@ -120,6 +120,10 @@ void bl31_platform_setup(void)
        k3_gic_init();
 
        ti_sci_init();
+
+       if (ti_sci_device_get(PLAT_BOARD_DEVICE_ID)) {
+               WARN("Unable to take system power reference\n");
+       }
 }
 
 void platform_mem_init(void)
index 6febbc6d34c0fd4d7c9ea024775d0eb21964b67e..4eb3ab5623b293011956fe63d1c43a21bdd5615c 100644 (file)
@@ -205,7 +205,14 @@ void k3_pwr_domain_on_finish(const psci_power_state_t *target_state)
 
 static void __dead2 k3_system_off(void)
 {
-       ERROR("System Off: operation not handled.\n");
+       int ret;
+
+       /* Queue up the system shutdown request */
+       ret = ti_sci_device_put_no_wait(PLAT_BOARD_DEVICE_ID);
+       if (ret != 0) {
+               ERROR("Sending system shutdown message failed (%d)\n", ret);
+       }
+
        while (true)
                wfi();
 }