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