Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 1 | /* |
2 | * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. | ||||
3 | * | ||||
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame^] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 5 | */ |
6 | |||||
Xing Zheng | 93280b7 | 2016-10-26 21:25:26 +0800 | [diff] [blame] | 7 | #include <m0_param.h> |
Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 8 | #include "rk3399_mcu.h" |
9 | |||||
Xing Zheng | 93280b7 | 2016-10-26 21:25:26 +0800 | [diff] [blame] | 10 | __attribute__((noreturn)) void main(void) |
Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 11 | { |
Xing Zheng | 93280b7 | 2016-10-26 21:25:26 +0800 | [diff] [blame] | 12 | switch (mmio_read_32(PARAM_ADDR + PARAM_M0_FUNC)) { |
13 | case M0_FUNC_SUSPEND: | ||||
14 | handle_suspend(); | ||||
15 | break; | ||||
16 | case M0_FUNC_DRAM: | ||||
17 | handle_dram(); | ||||
18 | break; | ||||
19 | default: | ||||
20 | break; | ||||
Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 21 | } |
Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 22 | |
Xing Zheng | 93280b7 | 2016-10-26 21:25:26 +0800 | [diff] [blame] | 23 | mmio_write_32(PARAM_ADDR + PARAM_M0_DONE, M0_DONE_FLAG); |
Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 24 | |
25 | for (;;) | ||||
Xing Zheng | 93280b7 | 2016-10-26 21:25:26 +0800 | [diff] [blame] | 26 | __asm__ volatile ("wfi"); |
Caesar Wang | b400374 | 2016-10-12 08:10:12 +0800 | [diff] [blame] | 27 | } |