18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * MMP2 Power Management Routines
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * (C) Copyright 2010 Marvell International Ltd.
68c2ecf20Sopenharmony_ci * All Rights Reserved
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __MMP2_PM_H__
108c2ecf20Sopenharmony_ci#define __MMP2_PM_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include "addr-map.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define APMU_PJ_IDLE_CFG			APMU_REG(0x018)
158c2ecf20Sopenharmony_ci#define APMU_PJ_IDLE_CFG_PJ_IDLE		(1 << 1)
168c2ecf20Sopenharmony_ci#define APMU_PJ_IDLE_CFG_PJ_PWRDWN		(1 << 5)
178c2ecf20Sopenharmony_ci#define APMU_PJ_IDLE_CFG_PWR_SW(x)		((x) << 16)
188c2ecf20Sopenharmony_ci#define APMU_PJ_IDLE_CFG_L2_PWR_SW		(1 << 19)
198c2ecf20Sopenharmony_ci#define APMU_PJ_IDLE_CFG_ISO_MODE_CNTRL_MASK	(3 << 28)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define APMU_SRAM_PWR_DWN			APMU_REG(0x08c)
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define MPMU_SCCR				MPMU_REG(0x038)
248c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ				MPMU_REG(0x1000)
258c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_AXISD			(1 << 31)
268c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPEN			(1 << 29)
278c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SPSD			(1 << 28)
288c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_DDRCORSD			(1 << 27)
298c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_APBSD			(1 << 26)
308c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_INTCLR			(1 << 24)
318c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP0			(1 << 23)
328c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP1			(1 << 22)
338c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP2			(1 << 21)
348c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP3			(1 << 20)
358c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_VCTCXOSD			(1 << 19)
368c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP4			(1 << 18)
378c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP5			(1 << 17)
388c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP6			(1 << 16)
398c2ecf20Sopenharmony_ci#define MPMU_PCR_PJ_SLPWP7			(1 << 15)
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#define MPMU_PLL2_CTRL1				MPMU_REG(0x0414)
428c2ecf20Sopenharmony_ci#define MPMU_CGR_PJ				MPMU_REG(0x1024)
438c2ecf20Sopenharmony_ci#define MPMU_WUCRM_PJ				MPMU_REG(0x104c)
448c2ecf20Sopenharmony_ci#define MPMU_WUCRM_PJ_WAKEUP(x)			(1 << (x))
458c2ecf20Sopenharmony_ci#define MPMU_WUCRM_PJ_RTC_ALARM			(1 << 17)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cienum {
488c2ecf20Sopenharmony_ci	POWER_MODE_ACTIVE = 0,
498c2ecf20Sopenharmony_ci	POWER_MODE_CORE_INTIDLE,
508c2ecf20Sopenharmony_ci	POWER_MODE_CORE_EXTIDLE,
518c2ecf20Sopenharmony_ci	POWER_MODE_APPS_IDLE,
528c2ecf20Sopenharmony_ci	POWER_MODE_APPS_SLEEP,
538c2ecf20Sopenharmony_ci	POWER_MODE_CHIP_SLEEP,
548c2ecf20Sopenharmony_ci	POWER_MODE_SYS_SLEEP,
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciextern void mmp2_pm_enter_lowpower_mode(int state);
588c2ecf20Sopenharmony_ciextern int mmp2_set_wake(struct irq_data *d, unsigned int on);
598c2ecf20Sopenharmony_ci#endif
60