]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
zynqmp: pm: Add support for PS and system reset on WDT restart
authorWill Wong <willw@xilinx.com>
Mon, 23 Nov 2020 07:45:21 +0000 (23:45 -0800)
committerMadhukar Pappireddy <madhukar.pappireddy@arm.com>
Tue, 12 Jan 2021 16:59:55 +0000 (16:59 +0000)
Add ability to support PS and System reset after idling the APU,
by reading the restart scope from the PMU.

Signed-off-by: Will Wong <willw@xilinx.com>
Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Change-Id: I23c01725d8ebb71ad34be02ab204411b93620702

plat/xilinx/zynqmp/include/zynqmp_def.h
plat/xilinx/zynqmp/pm_service/pm_svc_main.c

index b492210b00751ae23d838307f9144a280ed6bb71..f47463000dd7029f042d78877bd27262f767352a 100644 (file)
 #define PMU_GLOBAL_GEN_STORAGE4                        (GGS_BASEADDR + 0x10)
 /* Warm restart boot health status mask */
 #define PM_BOOT_HEALTH_STATUS_MASK             U(0x01)
+/* WDT restart scope shift and mask */
+#define RESTART_SCOPE_SHIFT                    (3)
+#define RESTART_SCOPE_MASK                     (0x3U << RESTART_SCOPE_SHIFT)
 
 /*AFI registers */
 #define  AFIFM6_WRCTRL         U(13)
index 49824c70d293f5781105ec84ea07c497e077fdb7..a49bda8d2935fdc901a2a2f6dd0e9acd7ce53d73 100644 (file)
@@ -142,6 +142,8 @@ static uint64_t __unused __dead2 zynqmp_sgi7_irq(uint32_t id, uint32_t flags,
                                                 void *handle, void *cookie)
 {
        int i;
+       uint32_t value;
+
        /* enter wfi and stay there */
        INFO("Entering wfi\n");
 
@@ -156,8 +158,9 @@ static uint64_t __unused __dead2 zynqmp_sgi7_irq(uint32_t id, uint32_t flags,
        spin_unlock(&inc_lock);
 
        if (active_cores == 0) {
-               pm_system_shutdown(PMF_SHUTDOWN_TYPE_RESET,
-                               PMF_SHUTDOWN_SUBTYPE_SUBSYSTEM);
+               pm_mmio_read(PMU_GLOBAL_GEN_STORAGE4, &value);
+               value = (value & RESTART_SCOPE_MASK) >> RESTART_SCOPE_SHIFT;
+               pm_system_shutdown(PMF_SHUTDOWN_TYPE_RESET, value);
        }
 
        /* enter wfi and stay there */