suspend.c 579 Bytes
Newer Older
1
2
3
/*
 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

7
#include <pmu_regs.h>
8
#include "rk3399_mcu.h"
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
#define M0_SCR			0xe000ed10  /* System Control Register (SCR) */

#define SCR_SLEEPDEEP_SHIFT	(1 << 2)

void handle_suspend(void)
{
	unsigned int status_value;

	while (1) {
		status_value = mmio_read_32(PMU_BASE + PMU_POWER_ST);
		if (status_value) {
			mmio_clrbits_32(PMU_BASE + PMU_PWRMODE_CON, 0x01);
			return;
		}
24
25
	}

26
27
	/* m0 enter deep sleep mode */
	mmio_setbits_32(M0_SCR, SCR_SLEEPDEEP_SHIFT);
28
}