xref: /rk3399_ARM-atf/plat/qti/msm8916/msm8916_pm.c (revision dddba19a6a3cb7a1039beaffc3169c4eb3291afd)
1 /*
2  * Copyright (c) 2021, Stephan Gerhold <stephan@gerhold.net>
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch.h>
8 #include <common/debug.h>
9 #include <drivers/delay_timer.h>
10 #include <lib/mmio.h>
11 #include <lib/psci/psci.h>
12 #include <plat/common/platform.h>
13 
14 #include <msm8916_mmap.h>
15 
16 static void __dead2 msm8916_system_reset(void)
17 {
18 	mmio_write_32(MPM_PS_HOLD, 0);
19 	mdelay(1000);
20 
21 	ERROR("PSCI: System reset failed\n");
22 	panic();
23 }
24 
25 static const plat_psci_ops_t msm8916_psci_ops = {
26 	.system_off			= msm8916_system_reset,
27 	.system_reset			= msm8916_system_reset,
28 };
29 
30 /* Defined and used in msm8916_helpers.S */
31 extern uintptr_t msm8916_entry_point;
32 
33 int plat_setup_psci_ops(uintptr_t sec_entrypoint,
34 			const plat_psci_ops_t **psci_ops)
35 {
36 	msm8916_entry_point = sec_entrypoint;
37 	*psci_ops = &msm8916_psci_ops;
38 	return 0;
39 }
40