Merge tag 'riscv-for-linus-4.15-rc2_cleanups' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / drivers / soc / bcm / brcmstb / pm / pm.h
blobb7d35ac70e6058616c5d2c010724f8566e52b44b
1 /*
2 * Definitions for Broadcom STB power management / Always ON (AON) block
4 * Copyright © 2016-2017 Broadcom
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef __BRCMSTB_PM_H__
17 #define __BRCMSTB_PM_H__
19 #define AON_CTRL_RESET_CTRL 0x00
20 #define AON_CTRL_PM_CTRL 0x04
21 #define AON_CTRL_PM_STATUS 0x08
22 #define AON_CTRL_PM_CPU_WAIT_COUNT 0x10
23 #define AON_CTRL_PM_INITIATE 0x88
24 #define AON_CTRL_HOST_MISC_CMDS 0x8c
25 #define AON_CTRL_SYSTEM_DATA_RAM_OFS 0x200
27 /* MIPS PM constants */
28 /* MEMC0 offsets */
29 #define DDR40_PHY_CONTROL_REGS_0_PLL_STATUS 0x10
30 #define DDR40_PHY_CONTROL_REGS_0_STANDBY_CTRL 0xa4
32 /* TIMER offsets */
33 #define TIMER_TIMER1_CTRL 0x0c
34 #define TIMER_TIMER1_STAT 0x1c
36 /* TIMER defines */
37 #define RESET_TIMER 0x0
38 #define START_TIMER 0xbfffffff
39 #define TIMER_MASK 0x3fffffff
41 /* PM_CTRL bitfield (Method #0) */
42 #define PM_FAST_PWRDOWN (1 << 6)
43 #define PM_WARM_BOOT (1 << 5)
44 #define PM_DEEP_STANDBY (1 << 4)
45 #define PM_CPU_PWR (1 << 3)
46 #define PM_USE_CPU_RDY (1 << 2)
47 #define PM_PLL_PWRDOWN (1 << 1)
48 #define PM_PWR_DOWN (1 << 0)
50 /* PM_CTRL bitfield (Method #1) */
51 #define PM_DPHY_STANDBY_CLEAR (1 << 20)
52 #define PM_MIN_S3_WIDTH_TIMER_BYPASS (1 << 7)
54 #define PM_S2_COMMAND (PM_PLL_PWRDOWN | PM_USE_CPU_RDY | PM_PWR_DOWN)
56 /* Method 0 bitmasks */
57 #define PM_COLD_CONFIG (PM_PLL_PWRDOWN | PM_DEEP_STANDBY)
58 #define PM_WARM_CONFIG (PM_COLD_CONFIG | PM_USE_CPU_RDY | PM_WARM_BOOT)
60 /* Method 1 bitmask */
61 #define M1_PM_WARM_CONFIG (PM_DPHY_STANDBY_CLEAR | \
62 PM_MIN_S3_WIDTH_TIMER_BYPASS | \
63 PM_WARM_BOOT | PM_DEEP_STANDBY | \
64 PM_PLL_PWRDOWN | PM_PWR_DOWN)
66 #define M1_PM_COLD_CONFIG (PM_DPHY_STANDBY_CLEAR | \
67 PM_MIN_S3_WIDTH_TIMER_BYPASS | \
68 PM_DEEP_STANDBY | \
69 PM_PLL_PWRDOWN | PM_PWR_DOWN)
71 #ifndef __ASSEMBLY__
73 #ifndef CONFIG_MIPS
74 extern const unsigned long brcmstb_pm_do_s2_sz;
75 extern asmlinkage int brcmstb_pm_do_s2(void __iomem *aon_ctrl_base,
76 void __iomem *ddr_phy_pll_status);
77 #else
78 /* s2 asm */
79 extern asmlinkage int brcm_pm_do_s2(u32 *s2_params);
81 /* s3 asm */
82 extern asmlinkage int brcm_pm_do_s3(void __iomem *aon_ctrl_base,
83 int dcache_linesz);
84 extern int s3_reentry;
85 #endif /* CONFIG_MIPS */
87 #endif
89 #endif /* __BRCMSTB_PM_H__ */