18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
48c2ecf20Sopenharmony_ci * Author: Tony Xie <tony.xie@rock-chips.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#ifndef __MACH_ROCKCHIP_PM_H
88c2ecf20Sopenharmony_ci#define __MACH_ROCKCHIP_PM_H
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciextern unsigned long rkpm_bootdata_cpusp;
118c2ecf20Sopenharmony_ciextern unsigned long rkpm_bootdata_cpu_code;
128c2ecf20Sopenharmony_ciextern unsigned long rkpm_bootdata_l2ctlr_f;
138c2ecf20Sopenharmony_ciextern unsigned long rkpm_bootdata_l2ctlr;
148c2ecf20Sopenharmony_ciextern unsigned long rkpm_bootdata_ddr_code;
158c2ecf20Sopenharmony_ciextern unsigned long rkpm_bootdata_ddr_data;
168c2ecf20Sopenharmony_ciextern unsigned long rk3288_bootram_sz;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_civoid rockchip_slp_cpu_resume(void);
198c2ecf20Sopenharmony_ci#ifdef CONFIG_PM_SLEEP
208c2ecf20Sopenharmony_civoid __init rockchip_suspend_init(void);
218c2ecf20Sopenharmony_ci#else
228c2ecf20Sopenharmony_cistatic inline void rockchip_suspend_init(void)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci}
258c2ecf20Sopenharmony_ci#endif
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci/****** following is rk3288 defined **********/
288c2ecf20Sopenharmony_ci#define RK3288_PMU_WAKEUP_CFG0		0x00
298c2ecf20Sopenharmony_ci#define RK3288_PMU_WAKEUP_CFG1		0x04
308c2ecf20Sopenharmony_ci#define RK3288_PMU_PWRMODE_CON		0x18
318c2ecf20Sopenharmony_ci#define RK3288_PMU_OSC_CNT		0x20
328c2ecf20Sopenharmony_ci#define RK3288_PMU_PLL_CNT		0x24
338c2ecf20Sopenharmony_ci#define RK3288_PMU_STABL_CNT		0x28
348c2ecf20Sopenharmony_ci#define RK3288_PMU_DDR0IO_PWRON_CNT	0x2c
358c2ecf20Sopenharmony_ci#define RK3288_PMU_DDR1IO_PWRON_CNT	0x30
368c2ecf20Sopenharmony_ci#define RK3288_PMU_CORE_PWRDWN_CNT	0x34
378c2ecf20Sopenharmony_ci#define RK3288_PMU_CORE_PWRUP_CNT	0x38
388c2ecf20Sopenharmony_ci#define RK3288_PMU_GPU_PWRDWN_CNT	0x3c
398c2ecf20Sopenharmony_ci#define RK3288_PMU_GPU_PWRUP_CNT	0x40
408c2ecf20Sopenharmony_ci#define RK3288_PMU_WAKEUP_RST_CLR_CNT	0x44
418c2ecf20Sopenharmony_ci#define RK3288_PMU_PWRMODE_CON1		0x90
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define RK3288_SGRF_SOC_CON0		(0x0000)
448c2ecf20Sopenharmony_ci#define RK3288_SGRF_FAST_BOOT_ADDR	(0x0120)
458c2ecf20Sopenharmony_ci#define SGRF_PCLK_WDT_GATE		BIT(6)
468c2ecf20Sopenharmony_ci#define SGRF_PCLK_WDT_GATE_WRITE	BIT(22)
478c2ecf20Sopenharmony_ci#define SGRF_FAST_BOOT_EN		BIT(8)
488c2ecf20Sopenharmony_ci#define SGRF_FAST_BOOT_EN_WRITE		BIT(24)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define RK3288_SGRF_CPU_CON0		(0x40)
518c2ecf20Sopenharmony_ci#define SGRF_DAPDEVICEEN		BIT(0)
528c2ecf20Sopenharmony_ci#define SGRF_DAPDEVICEEN_WRITE		BIT(16)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* PMU_WAKEUP_CFG1 bits */
558c2ecf20Sopenharmony_ci#define PMU_ARMINT_WAKEUP_EN		BIT(0)
568c2ecf20Sopenharmony_ci#define PMU_GPIOINT_WAKEUP_EN		BIT(3)
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cienum rk3288_pwr_mode_con {
598c2ecf20Sopenharmony_ci	PMU_PWR_MODE_EN = 0,
608c2ecf20Sopenharmony_ci	PMU_CLK_CORE_SRC_GATE_EN,
618c2ecf20Sopenharmony_ci	PMU_GLOBAL_INT_DISABLE,
628c2ecf20Sopenharmony_ci	PMU_L2FLUSH_EN,
638c2ecf20Sopenharmony_ci	PMU_BUS_PD_EN,
648c2ecf20Sopenharmony_ci	PMU_A12_0_PD_EN,
658c2ecf20Sopenharmony_ci	PMU_SCU_EN,
668c2ecf20Sopenharmony_ci	PMU_PLL_PD_EN,
678c2ecf20Sopenharmony_ci	PMU_CHIP_PD_EN, /* POWER OFF PIN ENABLE */
688c2ecf20Sopenharmony_ci	PMU_PWROFF_COMB,
698c2ecf20Sopenharmony_ci	PMU_ALIVE_USE_LF,
708c2ecf20Sopenharmony_ci	PMU_PMU_USE_LF,
718c2ecf20Sopenharmony_ci	PMU_OSC_24M_DIS,
728c2ecf20Sopenharmony_ci	PMU_INPUT_CLAMP_EN,
738c2ecf20Sopenharmony_ci	PMU_WAKEUP_RESET_EN,
748c2ecf20Sopenharmony_ci	PMU_SREF0_ENTER_EN,
758c2ecf20Sopenharmony_ci	PMU_SREF1_ENTER_EN,
768c2ecf20Sopenharmony_ci	PMU_DDR0IO_RET_EN,
778c2ecf20Sopenharmony_ci	PMU_DDR1IO_RET_EN,
788c2ecf20Sopenharmony_ci	PMU_DDR0_GATING_EN,
798c2ecf20Sopenharmony_ci	PMU_DDR1_GATING_EN,
808c2ecf20Sopenharmony_ci	PMU_DDR0IO_RET_DE_REQ,
818c2ecf20Sopenharmony_ci	PMU_DDR1IO_RET_DE_REQ
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_cienum rk3288_pwr_mode_con1 {
858c2ecf20Sopenharmony_ci	PMU_CLR_BUS = 0,
868c2ecf20Sopenharmony_ci	PMU_CLR_CORE,
878c2ecf20Sopenharmony_ci	PMU_CLR_CPUP,
888c2ecf20Sopenharmony_ci	PMU_CLR_ALIVE,
898c2ecf20Sopenharmony_ci	PMU_CLR_DMA,
908c2ecf20Sopenharmony_ci	PMU_CLR_PERI,
918c2ecf20Sopenharmony_ci	PMU_CLR_GPU,
928c2ecf20Sopenharmony_ci	PMU_CLR_VIDEO,
938c2ecf20Sopenharmony_ci	PMU_CLR_HEVC,
948c2ecf20Sopenharmony_ci	PMU_CLR_VIO,
958c2ecf20Sopenharmony_ci};
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#endif /* __MACH_ROCKCHIP_PM_H */
98