1*2025cf9eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
29c1ec8e1SChris Zhong /*
39c1ec8e1SChris Zhong * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
49c1ec8e1SChris Zhong * Author: Tony Xie <tony.xie@rock-chips.com>
59c1ec8e1SChris Zhong */
69c1ec8e1SChris Zhong
79c1ec8e1SChris Zhong #ifndef __MACH_ROCKCHIP_PM_H
89c1ec8e1SChris Zhong #define __MACH_ROCKCHIP_PM_H
99c1ec8e1SChris Zhong
109c1ec8e1SChris Zhong extern unsigned long rkpm_bootdata_cpusp;
119c1ec8e1SChris Zhong extern unsigned long rkpm_bootdata_cpu_code;
129c1ec8e1SChris Zhong extern unsigned long rkpm_bootdata_l2ctlr_f;
139c1ec8e1SChris Zhong extern unsigned long rkpm_bootdata_l2ctlr;
149c1ec8e1SChris Zhong extern unsigned long rkpm_bootdata_ddr_code;
159c1ec8e1SChris Zhong extern unsigned long rkpm_bootdata_ddr_data;
169c1ec8e1SChris Zhong extern unsigned long rk3288_bootram_sz;
179c1ec8e1SChris Zhong
189c1ec8e1SChris Zhong void rockchip_slp_cpu_resume(void);
19c8823e7aSArnd Bergmann #ifdef CONFIG_PM_SLEEP
209c1ec8e1SChris Zhong void __init rockchip_suspend_init(void);
21c8823e7aSArnd Bergmann #else
rockchip_suspend_init(void)22c8823e7aSArnd Bergmann static inline void rockchip_suspend_init(void)
23c8823e7aSArnd Bergmann {
24c8823e7aSArnd Bergmann }
25c8823e7aSArnd Bergmann #endif
269c1ec8e1SChris Zhong
279c1ec8e1SChris Zhong /****** following is rk3288 defined **********/
289c1ec8e1SChris Zhong #define RK3288_PMU_WAKEUP_CFG0 0x00
299c1ec8e1SChris Zhong #define RK3288_PMU_WAKEUP_CFG1 0x04
309c1ec8e1SChris Zhong #define RK3288_PMU_PWRMODE_CON 0x18
319c1ec8e1SChris Zhong #define RK3288_PMU_OSC_CNT 0x20
329c1ec8e1SChris Zhong #define RK3288_PMU_PLL_CNT 0x24
339c1ec8e1SChris Zhong #define RK3288_PMU_STABL_CNT 0x28
349c1ec8e1SChris Zhong #define RK3288_PMU_DDR0IO_PWRON_CNT 0x2c
359c1ec8e1SChris Zhong #define RK3288_PMU_DDR1IO_PWRON_CNT 0x30
369c1ec8e1SChris Zhong #define RK3288_PMU_CORE_PWRDWN_CNT 0x34
379c1ec8e1SChris Zhong #define RK3288_PMU_CORE_PWRUP_CNT 0x38
389c1ec8e1SChris Zhong #define RK3288_PMU_GPU_PWRDWN_CNT 0x3c
399c1ec8e1SChris Zhong #define RK3288_PMU_GPU_PWRUP_CNT 0x40
409c1ec8e1SChris Zhong #define RK3288_PMU_WAKEUP_RST_CLR_CNT 0x44
419c1ec8e1SChris Zhong #define RK3288_PMU_PWRMODE_CON1 0x90
429c1ec8e1SChris Zhong
439c1ec8e1SChris Zhong #define RK3288_SGRF_SOC_CON0 (0x0000)
449c1ec8e1SChris Zhong #define RK3288_SGRF_FAST_BOOT_ADDR (0x0120)
45a0307d18SChris Zhong #define SGRF_PCLK_WDT_GATE BIT(6)
46a0307d18SChris Zhong #define SGRF_PCLK_WDT_GATE_WRITE BIT(22)
479c1ec8e1SChris Zhong #define SGRF_FAST_BOOT_EN BIT(8)
489c1ec8e1SChris Zhong #define SGRF_FAST_BOOT_EN_WRITE BIT(24)
499c1ec8e1SChris Zhong
500ea001d3SChris Zhong #define RK3288_SGRF_CPU_CON0 (0x40)
510ea001d3SChris Zhong #define SGRF_DAPDEVICEEN BIT(0)
520ea001d3SChris Zhong #define SGRF_DAPDEVICEEN_WRITE BIT(16)
530ea001d3SChris Zhong
549c1ec8e1SChris Zhong /* PMU_WAKEUP_CFG1 bits */
559c1ec8e1SChris Zhong #define PMU_ARMINT_WAKEUP_EN BIT(0)
569bb91ae9SHeiko Stuebner #define PMU_GPIOINT_WAKEUP_EN BIT(3)
579c1ec8e1SChris Zhong
589c1ec8e1SChris Zhong enum rk3288_pwr_mode_con {
599c1ec8e1SChris Zhong PMU_PWR_MODE_EN = 0,
609c1ec8e1SChris Zhong PMU_CLK_CORE_SRC_GATE_EN,
619c1ec8e1SChris Zhong PMU_GLOBAL_INT_DISABLE,
629c1ec8e1SChris Zhong PMU_L2FLUSH_EN,
639c1ec8e1SChris Zhong PMU_BUS_PD_EN,
649c1ec8e1SChris Zhong PMU_A12_0_PD_EN,
659c1ec8e1SChris Zhong PMU_SCU_EN,
669c1ec8e1SChris Zhong PMU_PLL_PD_EN,
679c1ec8e1SChris Zhong PMU_CHIP_PD_EN, /* POWER OFF PIN ENABLE */
689c1ec8e1SChris Zhong PMU_PWROFF_COMB,
699c1ec8e1SChris Zhong PMU_ALIVE_USE_LF,
709c1ec8e1SChris Zhong PMU_PMU_USE_LF,
719c1ec8e1SChris Zhong PMU_OSC_24M_DIS,
729c1ec8e1SChris Zhong PMU_INPUT_CLAMP_EN,
739c1ec8e1SChris Zhong PMU_WAKEUP_RESET_EN,
749c1ec8e1SChris Zhong PMU_SREF0_ENTER_EN,
759c1ec8e1SChris Zhong PMU_SREF1_ENTER_EN,
769c1ec8e1SChris Zhong PMU_DDR0IO_RET_EN,
779c1ec8e1SChris Zhong PMU_DDR1IO_RET_EN,
789c1ec8e1SChris Zhong PMU_DDR0_GATING_EN,
799c1ec8e1SChris Zhong PMU_DDR1_GATING_EN,
809c1ec8e1SChris Zhong PMU_DDR0IO_RET_DE_REQ,
819c1ec8e1SChris Zhong PMU_DDR1IO_RET_DE_REQ
829c1ec8e1SChris Zhong };
839c1ec8e1SChris Zhong
849c1ec8e1SChris Zhong enum rk3288_pwr_mode_con1 {
859c1ec8e1SChris Zhong PMU_CLR_BUS = 0,
869c1ec8e1SChris Zhong PMU_CLR_CORE,
879c1ec8e1SChris Zhong PMU_CLR_CPUP,
889c1ec8e1SChris Zhong PMU_CLR_ALIVE,
899c1ec8e1SChris Zhong PMU_CLR_DMA,
909c1ec8e1SChris Zhong PMU_CLR_PERI,
919c1ec8e1SChris Zhong PMU_CLR_GPU,
929c1ec8e1SChris Zhong PMU_CLR_VIDEO,
939c1ec8e1SChris Zhong PMU_CLR_HEVC,
949c1ec8e1SChris Zhong PMU_CLR_VIO,
959c1ec8e1SChris Zhong };
969c1ec8e1SChris Zhong
979c1ec8e1SChris Zhong #endif /* __MACH_ROCKCHIP_PM_H */
98