106512c53SKrzysztof Kozlowski // SPDX-License-Identifier: GPL-2.0
206512c53SKrzysztof Kozlowski //
306512c53SKrzysztof Kozlowski // Copyright (c) 2011-2015 Samsung Electronics Co., Ltd.
406512c53SKrzysztof Kozlowski //		http://www.samsung.com/
506512c53SKrzysztof Kozlowski //
694500540SKrzysztof Kozlowski // Exynos5420 - CPU PMU (Power Management Unit) support
7bfce552dSPankaj Dubey 
8bfce552dSPankaj Dubey #include <linux/pm.h>
9bfce552dSPankaj Dubey #include <linux/soc/samsung/exynos-regs-pmu.h>
10bfce552dSPankaj Dubey #include <linux/soc/samsung/exynos-pmu.h>
11bfce552dSPankaj Dubey 
12bfce552dSPankaj Dubey #include <asm/cputype.h>
13bfce552dSPankaj Dubey 
14bfce552dSPankaj Dubey #include "exynos-pmu.h"
15bfce552dSPankaj Dubey 
16aec6341eSKrzysztof Kozlowski static const struct exynos_pmu_conf exynos5420_pmu_config[] = {
17bfce552dSPankaj Dubey 	/* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
18bfce552dSPankaj Dubey 	{ EXYNOS5_ARM_CORE0_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
19bfce552dSPankaj Dubey 	{ EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
20bfce552dSPankaj Dubey 	{ EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
21bfce552dSPankaj Dubey 	{ EXYNOS5_ARM_CORE1_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
22bfce552dSPankaj Dubey 	{ EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
23bfce552dSPankaj Dubey 	{ EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
24bfce552dSPankaj Dubey 	{ EXYNOS5420_ARM_CORE2_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
25bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
26bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
27bfce552dSPankaj Dubey 	{ EXYNOS5420_ARM_CORE3_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
28bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_ARM_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
29bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_ARM_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
30bfce552dSPankaj Dubey 	{ EXYNOS5420_KFC_CORE0_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
31bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
32bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
33bfce552dSPankaj Dubey 	{ EXYNOS5420_KFC_CORE1_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
34bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
35bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
36bfce552dSPankaj Dubey 	{ EXYNOS5420_KFC_CORE2_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
37bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
38bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
39bfce552dSPankaj Dubey 	{ EXYNOS5420_KFC_CORE3_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
40bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
41bfce552dSPankaj Dubey 	{ EXYNOS5420_DIS_IRQ_KFC_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
42bfce552dSPankaj Dubey 	{ EXYNOS5_ISP_ARM_SYS_PWR_REG,			{ 0x1, 0x0, 0x0} },
43bfce552dSPankaj Dubey 	{ EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
44bfce552dSPankaj Dubey 	{ EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
45bfce552dSPankaj Dubey 	{ EXYNOS5420_ARM_COMMON_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
46bfce552dSPankaj Dubey 	{ EXYNOS5420_KFC_COMMON_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
47bfce552dSPankaj Dubey 	{ EXYNOS5_ARM_L2_SYS_PWR_REG,			{ 0x0, 0x0, 0x0} },
48bfce552dSPankaj Dubey 	{ EXYNOS5420_KFC_L2_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
49bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
50bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
51bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_RESET_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
52bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
53bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x1} },
54bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
55bfce552dSPankaj Dubey 	{ EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
56bfce552dSPankaj Dubey 	{ EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG,		{ 0x1, 0x1, 0x1} },
57bfce552dSPankaj Dubey 	{ EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
58bfce552dSPankaj Dubey 	{ EXYNOS5_APLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
59bfce552dSPankaj Dubey 	{ EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
60bfce552dSPankaj Dubey 	{ EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
61bfce552dSPankaj Dubey 	{ EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
62bfce552dSPankaj Dubey 	{ EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
63bfce552dSPankaj Dubey 	{ EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
64bfce552dSPankaj Dubey 	{ EXYNOS5420_DPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
65bfce552dSPankaj Dubey 	{ EXYNOS5420_IPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
66bfce552dSPankaj Dubey 	{ EXYNOS5420_KPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
67bfce552dSPankaj Dubey 	{ EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
68bfce552dSPankaj Dubey 	{ EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
69bfce552dSPankaj Dubey 	{ EXYNOS5420_RPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
70bfce552dSPankaj Dubey 	{ EXYNOS5420_SPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
71bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_BUS_SYS_PWR_REG,			{ 0x3, 0x0, 0x0} },
72bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_RETENTION_SYS_PWR_REG,		{ 0x1, 0x1, 0x1} },
73bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_PWR_SYS_PWR_REG,			{ 0x3, 0x3, 0x0} },
74bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x0} },
75bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x1} },
76bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x0} },
77bfce552dSPankaj Dubey 	{ EXYNOS5_LOGIC_RESET_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
78bfce552dSPankaj Dubey 	{ EXYNOS5_OSCCLK_GATE_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
79bfce552dSPankaj Dubey 	{ EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
80bfce552dSPankaj Dubey 	{ EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
81bfce552dSPankaj Dubey 	{ EXYNOS5420_INTRAM_MEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x3} },
82bfce552dSPankaj Dubey 	{ EXYNOS5420_INTROM_MEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x3} },
83bfce552dSPankaj Dubey 	{ EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
84bfce552dSPankaj Dubey 	{ EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG,	{ 0x1, 0x1, 0x0} },
85bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_JTAG_SYS_PWR_REG,	{ 0x1, 0x1, 0x0} },
86bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_DRAM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
87bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_UART_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
88bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_MMC0_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
89bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_MMC1_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
90bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_MMC2_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
91bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_HSI_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
92bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_EBIA_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
93bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_EBIB_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
94bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_SPI_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
95bfce552dSPankaj Dubey 	{ EXYNOS5420_PAD_RETENTION_DRAM_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
96bfce552dSPankaj Dubey 	{ EXYNOS5_PAD_ISOLATION_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
97bfce552dSPankaj Dubey 	{ EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
98bfce552dSPankaj Dubey 	{ EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
99bfce552dSPankaj Dubey 	{ EXYNOS5_XUSBXTI_SYS_PWR_REG,			{ 0x1, 0x1, 0x0} },
100bfce552dSPankaj Dubey 	{ EXYNOS5_XXTI_SYS_PWR_REG,			{ 0x1, 0x1, 0x0} },
101bfce552dSPankaj Dubey 	{ EXYNOS5_EXT_REGULATOR_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
102bfce552dSPankaj Dubey 	{ EXYNOS5_GPIO_MODE_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
103bfce552dSPankaj Dubey 	{ EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
104bfce552dSPankaj Dubey 	{ EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
105bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
106bfce552dSPankaj Dubey 	{ EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
107bfce552dSPankaj Dubey 	{ EXYNOS5_GSCL_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
108bfce552dSPankaj Dubey 	{ EXYNOS5_ISP_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
109bfce552dSPankaj Dubey 	{ EXYNOS5_MFC_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
110bfce552dSPankaj Dubey 	{ EXYNOS5_G3D_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
111bfce552dSPankaj Dubey 	{ EXYNOS5420_DISP1_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
112bfce552dSPankaj Dubey 	{ EXYNOS5420_MAU_SYS_PWR_REG,			{ 0x7, 0x7, 0x0} },
113bfce552dSPankaj Dubey 	{ EXYNOS5420_G2D_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
114bfce552dSPankaj Dubey 	{ EXYNOS5420_MSC_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
115bfce552dSPankaj Dubey 	{ EXYNOS5420_FSYS_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
116bfce552dSPankaj Dubey 	{ EXYNOS5420_FSYS2_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
117bfce552dSPankaj Dubey 	{ EXYNOS5420_PSGEN_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
118bfce552dSPankaj Dubey 	{ EXYNOS5420_PERIC_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
119bfce552dSPankaj Dubey 	{ EXYNOS5420_WCORE_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
120bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
121bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
122bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
123bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
124bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
125bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
126bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
127bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
128bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
129bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
130bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
131bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
132bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
133bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
134bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
135bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
136bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
137bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
138bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
139bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
140bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
141bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
142bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
143bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
144bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
145bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
146bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
147bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
148bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
149bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
150bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
151bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
152bfce552dSPankaj Dubey 	{ EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
153bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
154bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
155bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
156bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
157bfce552dSPankaj Dubey 	{ EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
158bfce552dSPankaj Dubey 	{ PMU_TABLE_END,},
159bfce552dSPankaj Dubey };
160bfce552dSPankaj Dubey 
161bfce552dSPankaj Dubey static unsigned int const exynos5420_list_disable_pmu_reg[] = {
162bfce552dSPankaj Dubey 	EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG,
163bfce552dSPankaj Dubey 	EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG,
164bfce552dSPankaj Dubey 	EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG,
165bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG,
166bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG,
167bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG,
168bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG,
169bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG,
170bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG,
171bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG,
172bfce552dSPankaj Dubey 	EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG,
173bfce552dSPankaj Dubey 	EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG,
174bfce552dSPankaj Dubey 	EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG,
175bfce552dSPankaj Dubey 	EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG,
176bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG,
177bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG,
178bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG,
179bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG,
180bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG,
181bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG,
182bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG,
183bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG,
184bfce552dSPankaj Dubey 	EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG,
185bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG,
186bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG,
187bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG,
188bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG,
189bfce552dSPankaj Dubey 	EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG,
190bfce552dSPankaj Dubey 	EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG,
191bfce552dSPankaj Dubey 	EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG,
192bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG,
193bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG,
194bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG,
195bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG,
196bfce552dSPankaj Dubey 	EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
197bfce552dSPankaj Dubey };
198bfce552dSPankaj Dubey 
exynos5420_powerdown_conf(enum sys_powerdown mode)199bfce552dSPankaj Dubey static void exynos5420_powerdown_conf(enum sys_powerdown mode)
200bfce552dSPankaj Dubey {
201bfce552dSPankaj Dubey 	u32 this_cluster;
202bfce552dSPankaj Dubey 
203bfce552dSPankaj Dubey 	this_cluster = MPIDR_AFFINITY_LEVEL(read_cpuid_mpidr(), 1);
204bfce552dSPankaj Dubey 
205bfce552dSPankaj Dubey 	/*
206bfce552dSPankaj Dubey 	 * set the cluster id to IROM register to ensure that we wake
207bfce552dSPankaj Dubey 	 * up with the current cluster.
208bfce552dSPankaj Dubey 	 */
209bfce552dSPankaj Dubey 	pmu_raw_writel(this_cluster, EXYNOS_IROM_DATA2);
210bfce552dSPankaj Dubey }
211bfce552dSPankaj Dubey 
exynos5420_pmu_init(void)212bfce552dSPankaj Dubey static void exynos5420_pmu_init(void)
213bfce552dSPankaj Dubey {
214bfce552dSPankaj Dubey 	unsigned int value;
215bfce552dSPankaj Dubey 	int i;
216bfce552dSPankaj Dubey 
217bfce552dSPankaj Dubey 	/*
218bfce552dSPankaj Dubey 	 * Set the CMU_RESET, CMU_SYSCLK and CMU_CLKSTOP registers
219bfce552dSPankaj Dubey 	 * for local power blocks to Low initially as per Table 8-4:
220bfce552dSPankaj Dubey 	 * "System-Level Power-Down Configuration Registers".
221bfce552dSPankaj Dubey 	 */
222bfce552dSPankaj Dubey 	for (i = 0; i < ARRAY_SIZE(exynos5420_list_disable_pmu_reg); i++)
223bfce552dSPankaj Dubey 		pmu_raw_writel(0, exynos5420_list_disable_pmu_reg[i]);
224bfce552dSPankaj Dubey 
225bfce552dSPankaj Dubey 	/* Enable USE_STANDBY_WFI for all CORE */
226bfce552dSPankaj Dubey 	pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
227bfce552dSPankaj Dubey 
228bfce552dSPankaj Dubey 	value  = pmu_raw_readl(EXYNOS_L2_OPTION(0));
229ee55ae61SKrzysztof Kozlowski 	value &= ~EXYNOS_L2_USE_RETENTION;
230bfce552dSPankaj Dubey 	pmu_raw_writel(value, EXYNOS_L2_OPTION(0));
231bfce552dSPankaj Dubey 
232bfce552dSPankaj Dubey 	value = pmu_raw_readl(EXYNOS_L2_OPTION(1));
233ee55ae61SKrzysztof Kozlowski 	value &= ~EXYNOS_L2_USE_RETENTION;
234bfce552dSPankaj Dubey 	pmu_raw_writel(value, EXYNOS_L2_OPTION(1));
235bfce552dSPankaj Dubey 
236bfce552dSPankaj Dubey 	/*
237bfce552dSPankaj Dubey 	 * If L2_COMMON is turned off, clocks related to ATB async
238bfce552dSPankaj Dubey 	 * bridge are gated. Thus, when ISP power is gated, LPI
239bfce552dSPankaj Dubey 	 * may get stuck.
240bfce552dSPankaj Dubey 	 */
241bfce552dSPankaj Dubey 	value = pmu_raw_readl(EXYNOS5420_LPI_MASK);
242bfce552dSPankaj Dubey 	value |= EXYNOS5420_ATB_ISP_ARM;
243bfce552dSPankaj Dubey 	pmu_raw_writel(value, EXYNOS5420_LPI_MASK);
244bfce552dSPankaj Dubey 
245bfce552dSPankaj Dubey 	value  = pmu_raw_readl(EXYNOS5420_LPI_MASK1);
246bfce552dSPankaj Dubey 	value |= EXYNOS5420_ATB_KFC;
247bfce552dSPankaj Dubey 	pmu_raw_writel(value, EXYNOS5420_LPI_MASK1);
248bfce552dSPankaj Dubey 
249bfce552dSPankaj Dubey 	/* Prevent issue of new bus request from L2 memory */
250bfce552dSPankaj Dubey 	value = pmu_raw_readl(EXYNOS5420_ARM_COMMON_OPTION);
251bfce552dSPankaj Dubey 	value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
252bfce552dSPankaj Dubey 	pmu_raw_writel(value, EXYNOS5420_ARM_COMMON_OPTION);
253bfce552dSPankaj Dubey 
254bfce552dSPankaj Dubey 	value = pmu_raw_readl(EXYNOS5420_KFC_COMMON_OPTION);
255bfce552dSPankaj Dubey 	value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
256bfce552dSPankaj Dubey 	pmu_raw_writel(value, EXYNOS5420_KFC_COMMON_OPTION);
257bfce552dSPankaj Dubey 
258bfce552dSPankaj Dubey 	/* This setting is to reduce suspend/resume time */
259bfce552dSPankaj Dubey 	pmu_raw_writel(DUR_WAIT_RESET, EXYNOS5420_LOGIC_RESET_DURATION3);
260bfce552dSPankaj Dubey 
261bfce552dSPankaj Dubey 	/* Serialized CPU wakeup of Eagle */
262bfce552dSPankaj Dubey 	pmu_raw_writel(SPREAD_ENABLE, EXYNOS5420_ARM_INTR_SPREAD_ENABLE);
263bfce552dSPankaj Dubey 
264bfce552dSPankaj Dubey 	pmu_raw_writel(SPREAD_USE_STANDWFI,
265bfce552dSPankaj Dubey 			EXYNOS5420_ARM_INTR_SPREAD_USE_STANDBYWFI);
266bfce552dSPankaj Dubey 
267bfce552dSPankaj Dubey 	pmu_raw_writel(0x1, EXYNOS5420_UP_SCHEDULER);
268bfce552dSPankaj Dubey 
269bfce552dSPankaj Dubey 	pr_info("EXYNOS5420 PMU initialized\n");
270bfce552dSPankaj Dubey }
271bfce552dSPankaj Dubey 
272bfce552dSPankaj Dubey const struct exynos_pmu_data exynos5420_pmu_data = {
273bfce552dSPankaj Dubey 	.pmu_config	= exynos5420_pmu_config,
274bfce552dSPankaj Dubey 	.pmu_init	= exynos5420_pmu_init,
275bfce552dSPankaj Dubey 	.powerdown_conf	= exynos5420_powerdown_conf,
276bfce552dSPankaj Dubey };
277