summaryrefslogtreecommitdiffstats
path: root/plat/mediatek/mt8186/include/plat_mtk_lpm.h
blob: 12ea9d72c00a26d9b0bcd488fd45aa642106dfe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright (c) 2021, MediaTek Inc. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef PLAT_MTK_LPM_H
#define PLAT_MTK_LPM_H

#include <lib/psci/psci.h>
#include <lib/utils_def.h>

#define MT_IRQ_REMAIN_MAX	U(32)
#define MT_IRQ_REMAIN_CAT_LOG	BIT(31)

struct mt_irqremain {
	unsigned int count;
	unsigned int irqs[MT_IRQ_REMAIN_MAX];
	unsigned int wakeupsrc_cat[MT_IRQ_REMAIN_MAX];
	unsigned int wakeupsrc[MT_IRQ_REMAIN_MAX];
};

#define PLAT_RC_STATUS_READY		BIT(0)
#define PLAT_RC_STATUS_FEATURE_EN	BIT(1)
#define PLAT_RC_STATUS_UART_NONSLEEP	BIT(31)

struct mt_lpm_tz {
	int (*pwr_prompt)(unsigned int cpu, const psci_power_state_t *state);
	int (*pwr_reflect)(unsigned int cpu, const psci_power_state_t *state);

	int (*pwr_cpu_on)(unsigned int cpu, const psci_power_state_t *state);
	int (*pwr_cpu_dwn)(unsigned int cpu, const psci_power_state_t *state);

	int (*pwr_cluster_on)(unsigned int cpu,
					const psci_power_state_t *state);
	int (*pwr_cluster_dwn)(unsigned int cpu,
					const psci_power_state_t *state);

	int (*pwr_mcusys_on)(unsigned int cpu, const psci_power_state_t *state);
	int (*pwr_mcusys_on_finished)(unsigned int cpu,
					const psci_power_state_t *state);
	int (*pwr_mcusys_dwn)(unsigned int cpu,
					const psci_power_state_t *state);
};

const struct mt_lpm_tz *mt_plat_cpu_pm_init(void);
int plat_mt_pm_register(struct mt_lpm_tz *mt_pm);

#endif /* PLAT_MTK_LPM_H */