blob: 0ed818d2fe3bd949ed0a5328498a38b530890b0c [file] [log] [blame]
Caesar Wangb4003742016-10-12 08:10:12 +08001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Caesar Wangb4003742016-10-12 08:10:12 +08005 */
6
Xing Zheng93280b72016-10-26 21:25:26 +08007#include <m0_param.h>
Caesar Wangb4003742016-10-12 08:10:12 +08008#include "rk3399_mcu.h"
9
Xing Zheng93280b72016-10-26 21:25:26 +080010__attribute__((noreturn)) void main(void)
Caesar Wangb4003742016-10-12 08:10:12 +080011{
Xing Zheng93280b72016-10-26 21:25:26 +080012 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 Wangb4003742016-10-12 08:10:12 +080021 }
Caesar Wangb4003742016-10-12 08:10:12 +080022
Xing Zheng93280b72016-10-26 21:25:26 +080023 mmio_write_32(PARAM_ADDR + PARAM_M0_DONE, M0_DONE_FLAG);
Caesar Wangb4003742016-10-12 08:10:12 +080024
25 for (;;)
Xing Zheng93280b72016-10-26 21:25:26 +080026 __asm__ volatile ("wfi");
Caesar Wangb4003742016-10-12 08:10:12 +080027}