blob: 6c8a76dd549485ef34000c6b7eae37e2fdb4dc0f [file] [log] [blame]
Jongpill Lee7d44d2b2012-02-17 09:51:31 +09001/*
Pankaj Dubey14fc8b92014-11-07 09:26:40 +09002 * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd.
Jaecheol Leee28e3012011-07-18 19:21:23 +09003 * http://www.samsung.com/
4 *
Jongpill Lee7d44d2b2012-02-17 09:51:31 +09005 * EXYNOS - CPU PMU(Power Management Unit) support
Jaecheol Leee28e3012011-07-18 19:21:23 +09006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/io.h>
Pankaj Dubey14fc8b92014-11-07 09:26:40 +090013#include <linux/of.h>
14#include <linux/platform_device.h>
Abhilash Kesavanaf2e0a02014-11-07 09:27:33 +090015#include <linux/delay.h>
16
Jaecheol Leee28e3012011-07-18 19:21:23 +090017
Pankaj Dubey6b7bfd82014-11-07 09:26:47 +090018#include "exynos-pmu.h"
Kukjin Kim65c9a852013-12-19 04:06:56 +090019#include "regs-pmu.h"
Jaecheol Leee28e3012011-07-18 19:21:23 +090020
Pankaj Dubey6b7bfd82014-11-07 09:26:47 +090021#define PMU_TABLE_END (-1U)
22
23struct exynos_pmu_conf {
24 unsigned int offset;
25 unsigned int val[NUM_SYS_POWERDOWN];
26};
27
Pankaj Dubey14fc8b92014-11-07 09:26:40 +090028struct exynos_pmu_data {
29 const struct exynos_pmu_conf *pmu_config;
30 const struct exynos_pmu_conf *pmu_config_extra;
31
32 void (*pmu_init)(void);
33 void (*powerdown_conf)(enum sys_powerdown);
34};
35
36struct exynos_pmu_context {
37 struct device *dev;
38 const struct exynos_pmu_data *pmu_data;
39};
40
Pankaj Dubey6b7bfd82014-11-07 09:26:47 +090041static void __iomem *pmu_base_addr;
Pankaj Dubey14fc8b92014-11-07 09:26:40 +090042static struct exynos_pmu_context *pmu_context;
Jaecheol Leee28e3012011-07-18 19:21:23 +090043
Pankaj Dubey6b7bfd82014-11-07 09:26:47 +090044static inline void pmu_raw_writel(u32 val, u32 offset)
45{
46 writel_relaxed(val, pmu_base_addr + offset);
47}
48
49static inline u32 pmu_raw_readl(u32 offset)
50{
51 return readl_relaxed(pmu_base_addr + offset);
52}
53
Daniel Kurtz53302222013-12-12 07:07:23 +090054static const struct exynos_pmu_conf exynos4210_pmu_config[] = {
Pankaj Dubey2e94ac42014-07-19 03:43:22 +090055 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
Jongpill Lee0dba4dc2011-09-27 07:22:11 +090056 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
57 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
58 { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
59 { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } },
60 { S5P_DIS_IRQ_CORE1, { 0x0, 0x0, 0x0 } },
61 { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } },
62 { S5P_ARM_COMMON_LOWPWR, { 0x0, 0x0, 0x2 } },
63 { S5P_L2_0_LOWPWR, { 0x2, 0x2, 0x3 } },
64 { S5P_L2_1_LOWPWR, { 0x2, 0x2, 0x3 } },
65 { S5P_CMU_ACLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
66 { S5P_CMU_SCLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
67 { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
68 { S5P_APLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
69 { S5P_MPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
70 { S5P_VPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
71 { S5P_EPLL_SYSCLK_LOWPWR, { 0x1, 0x1, 0x0 } },
72 { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x1, 0x0 } },
73 { S5P_CMU_RESET_GPSALIVE_LOWPWR, { 0x1, 0x1, 0x0 } },
74 { S5P_CMU_CLKSTOP_CAM_LOWPWR, { 0x1, 0x1, 0x0 } },
75 { S5P_CMU_CLKSTOP_TV_LOWPWR, { 0x1, 0x1, 0x0 } },
76 { S5P_CMU_CLKSTOP_MFC_LOWPWR, { 0x1, 0x1, 0x0 } },
77 { S5P_CMU_CLKSTOP_G3D_LOWPWR, { 0x1, 0x1, 0x0 } },
78 { S5P_CMU_CLKSTOP_LCD0_LOWPWR, { 0x1, 0x1, 0x0 } },
79 { S5P_CMU_CLKSTOP_LCD1_LOWPWR, { 0x1, 0x1, 0x0 } },
80 { S5P_CMU_CLKSTOP_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
81 { S5P_CMU_CLKSTOP_GPS_LOWPWR, { 0x1, 0x1, 0x0 } },
82 { S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x1, 0x0 } },
83 { S5P_CMU_RESET_TV_LOWPWR, { 0x1, 0x1, 0x0 } },
84 { S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x1, 0x0 } },
85 { S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x1, 0x0 } },
86 { S5P_CMU_RESET_LCD0_LOWPWR, { 0x1, 0x1, 0x0 } },
87 { S5P_CMU_RESET_LCD1_LOWPWR, { 0x1, 0x1, 0x0 } },
88 { S5P_CMU_RESET_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
89 { S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x1, 0x0 } },
90 { S5P_TOP_BUS_LOWPWR, { 0x3, 0x0, 0x0 } },
91 { S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } },
92 { S5P_TOP_PWR_LOWPWR, { 0x3, 0x0, 0x3 } },
93 { S5P_LOGIC_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
94 { S5P_ONENAND_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
95 { S5P_MODIMIF_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
96 { S5P_G2D_ACP_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
97 { S5P_USBOTG_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
98 { S5P_HSMMC_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
99 { S5P_CSSYS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
100 { S5P_SECSS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
101 { S5P_PCIE_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
102 { S5P_SATA_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
103 { S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } },
104 { S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
105 { S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } },
106 { S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } },
107 { S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } },
108 { S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } },
109 { S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } },
110 { S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } },
111 { S5P_PAD_RETENTION_ISOLATION_LOWPWR, { 0x1, 0x0, 0x0 } },
112 { S5P_PAD_RETENTION_ALV_SEL_LOWPWR, { 0x1, 0x0, 0x0 } },
113 { S5P_XUSBXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
114 { S5P_XXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
115 { S5P_EXT_REGULATOR_LOWPWR, { 0x1, 0x1, 0x0 } },
116 { S5P_GPIO_MODE_LOWPWR, { 0x1, 0x0, 0x0 } },
117 { S5P_GPIO_MODE_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
118 { S5P_CAM_LOWPWR, { 0x7, 0x0, 0x0 } },
119 { S5P_TV_LOWPWR, { 0x7, 0x0, 0x0 } },
120 { S5P_MFC_LOWPWR, { 0x7, 0x0, 0x0 } },
121 { S5P_G3D_LOWPWR, { 0x7, 0x0, 0x0 } },
122 { S5P_LCD0_LOWPWR, { 0x7, 0x0, 0x0 } },
123 { S5P_LCD1_LOWPWR, { 0x7, 0x0, 0x0 } },
124 { S5P_MAUDIO_LOWPWR, { 0x7, 0x7, 0x0 } },
125 { S5P_GPS_LOWPWR, { 0x7, 0x0, 0x0 } },
126 { S5P_GPS_ALIVE_LOWPWR, { 0x7, 0x0, 0x0 } },
127 { PMU_TABLE_END,},
Jaecheol Leee28e3012011-07-18 19:21:23 +0900128};
129
Daniel Kurtz53302222013-12-12 07:07:23 +0900130static const struct exynos_pmu_conf exynos4x12_pmu_config[] = {
Jongpill Lee00a351f2011-09-27 07:26:04 +0900131 { S5P_ARM_CORE0_LOWPWR, { 0x0, 0x0, 0x2 } },
132 { S5P_DIS_IRQ_CORE0, { 0x0, 0x0, 0x0 } },
133 { S5P_DIS_IRQ_CENTRAL0, { 0x0, 0x0, 0x0 } },
134 { S5P_ARM_CORE1_LOWPWR, { 0x0, 0x0, 0x2 } },
135 { S5P_DIS_IRQ_CORE1, { 0x0, 0x0, 0x0 } },
136 { S5P_DIS_IRQ_CENTRAL1, { 0x0, 0x0, 0x0 } },
137 { S5P_ISP_ARM_LOWPWR, { 0x1, 0x0, 0x0 } },
138 { S5P_DIS_IRQ_ISP_ARM_LOCAL_LOWPWR, { 0x0, 0x0, 0x0 } },
139 { S5P_DIS_IRQ_ISP_ARM_CENTRAL_LOWPWR, { 0x0, 0x0, 0x0 } },
140 { S5P_ARM_COMMON_LOWPWR, { 0x0, 0x0, 0x2 } },
141 { S5P_L2_0_LOWPWR, { 0x0, 0x0, 0x3 } },
142 /* XXX_OPTION register should be set other field */
143 { S5P_ARM_L2_0_OPTION, { 0x10, 0x10, 0x0 } },
144 { S5P_L2_1_LOWPWR, { 0x0, 0x0, 0x3 } },
145 { S5P_ARM_L2_1_OPTION, { 0x10, 0x10, 0x0 } },
146 { S5P_CMU_ACLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
147 { S5P_CMU_SCLKSTOP_LOWPWR, { 0x1, 0x0, 0x0 } },
148 { S5P_CMU_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
149 { S5P_DRAM_FREQ_DOWN_LOWPWR, { 0x1, 0x1, 0x1 } },
150 { S5P_DDRPHY_DLLOFF_LOWPWR, { 0x1, 0x1, 0x1 } },
151 { S5P_LPDDR_PHY_DLL_LOCK_LOWPWR, { 0x1, 0x1, 0x1 } },
152 { S5P_CMU_ACLKSTOP_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
153 { S5P_CMU_SCLKSTOP_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
154 { S5P_CMU_RESET_COREBLK_LOWPWR, { 0x1, 0x1, 0x0 } },
155 { S5P_APLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
156 { S5P_MPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
157 { S5P_VPLL_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
158 { S5P_EPLL_SYSCLK_LOWPWR, { 0x1, 0x1, 0x0 } },
159 { S5P_MPLLUSER_SYSCLK_LOWPWR, { 0x1, 0x0, 0x0 } },
160 { S5P_CMU_CLKSTOP_GPS_ALIVE_LOWPWR, { 0x1, 0x0, 0x0 } },
161 { S5P_CMU_RESET_GPSALIVE_LOWPWR, { 0x1, 0x0, 0x0 } },
162 { S5P_CMU_CLKSTOP_CAM_LOWPWR, { 0x1, 0x0, 0x0 } },
163 { S5P_CMU_CLKSTOP_TV_LOWPWR, { 0x1, 0x0, 0x0 } },
164 { S5P_CMU_CLKSTOP_MFC_LOWPWR, { 0x1, 0x0, 0x0 } },
165 { S5P_CMU_CLKSTOP_G3D_LOWPWR, { 0x1, 0x0, 0x0 } },
166 { S5P_CMU_CLKSTOP_LCD0_LOWPWR, { 0x1, 0x0, 0x0 } },
167 { S5P_CMU_CLKSTOP_ISP_LOWPWR, { 0x1, 0x0, 0x0 } },
168 { S5P_CMU_CLKSTOP_MAUDIO_LOWPWR, { 0x1, 0x0, 0x0 } },
169 { S5P_CMU_CLKSTOP_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
170 { S5P_CMU_RESET_CAM_LOWPWR, { 0x1, 0x0, 0x0 } },
171 { S5P_CMU_RESET_TV_LOWPWR, { 0x1, 0x0, 0x0 } },
172 { S5P_CMU_RESET_MFC_LOWPWR, { 0x1, 0x0, 0x0 } },
173 { S5P_CMU_RESET_G3D_LOWPWR, { 0x1, 0x0, 0x0 } },
174 { S5P_CMU_RESET_LCD0_LOWPWR, { 0x1, 0x0, 0x0 } },
175 { S5P_CMU_RESET_ISP_LOWPWR, { 0x1, 0x0, 0x0 } },
176 { S5P_CMU_RESET_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
177 { S5P_CMU_RESET_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
178 { S5P_TOP_BUS_LOWPWR, { 0x3, 0x0, 0x0 } },
179 { S5P_TOP_RETENTION_LOWPWR, { 0x1, 0x0, 0x1 } },
180 { S5P_TOP_PWR_LOWPWR, { 0x3, 0x0, 0x3 } },
181 { S5P_TOP_BUS_COREBLK_LOWPWR, { 0x3, 0x0, 0x0 } },
182 { S5P_TOP_RETENTION_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } },
183 { S5P_TOP_PWR_COREBLK_LOWPWR, { 0x3, 0x0, 0x3 } },
184 { S5P_LOGIC_RESET_LOWPWR, { 0x1, 0x1, 0x0 } },
185 { S5P_OSCCLK_GATE_LOWPWR, { 0x1, 0x0, 0x1 } },
186 { S5P_LOGIC_RESET_COREBLK_LOWPWR, { 0x1, 0x1, 0x0 } },
187 { S5P_OSCCLK_GATE_COREBLK_LOWPWR, { 0x1, 0x0, 0x1 } },
188 { S5P_ONENAND_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
189 { S5P_ONENAND_MEM_OPTION, { 0x10, 0x10, 0x0 } },
190 { S5P_HSI_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
191 { S5P_HSI_MEM_OPTION, { 0x10, 0x10, 0x0 } },
192 { S5P_G2D_ACP_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
193 { S5P_G2D_ACP_MEM_OPTION, { 0x10, 0x10, 0x0 } },
194 { S5P_USBOTG_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
195 { S5P_USBOTG_MEM_OPTION, { 0x10, 0x10, 0x0 } },
196 { S5P_HSMMC_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
197 { S5P_HSMMC_MEM_OPTION, { 0x10, 0x10, 0x0 } },
198 { S5P_CSSYS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
199 { S5P_CSSYS_MEM_OPTION, { 0x10, 0x10, 0x0 } },
200 { S5P_SECSS_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
201 { S5P_SECSS_MEM_OPTION, { 0x10, 0x10, 0x0 } },
202 { S5P_ROTATOR_MEM_LOWPWR, { 0x3, 0x0, 0x0 } },
203 { S5P_ROTATOR_MEM_OPTION, { 0x10, 0x10, 0x0 } },
204 { S5P_PAD_RETENTION_DRAM_LOWPWR, { 0x1, 0x0, 0x0 } },
205 { S5P_PAD_RETENTION_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
206 { S5P_PAD_RETENTION_GPIO_LOWPWR, { 0x1, 0x0, 0x0 } },
207 { S5P_PAD_RETENTION_UART_LOWPWR, { 0x1, 0x0, 0x0 } },
208 { S5P_PAD_RETENTION_MMCA_LOWPWR, { 0x1, 0x0, 0x0 } },
209 { S5P_PAD_RETENTION_MMCB_LOWPWR, { 0x1, 0x0, 0x0 } },
210 { S5P_PAD_RETENTION_EBIA_LOWPWR, { 0x1, 0x0, 0x0 } },
211 { S5P_PAD_RETENTION_EBIB_LOWPWR, { 0x1, 0x0, 0x0 } },
212 { S5P_PAD_RETENTION_GPIO_COREBLK_LOWPWR,{ 0x1, 0x0, 0x0 } },
213 { S5P_PAD_RETENTION_ISOLATION_LOWPWR, { 0x1, 0x0, 0x0 } },
214 { S5P_PAD_ISOLATION_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
215 { S5P_PAD_RETENTION_ALV_SEL_LOWPWR, { 0x1, 0x0, 0x0 } },
216 { S5P_XUSBXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
217 { S5P_XXTI_LOWPWR, { 0x1, 0x1, 0x0 } },
218 { S5P_EXT_REGULATOR_LOWPWR, { 0x1, 0x1, 0x0 } },
219 { S5P_GPIO_MODE_LOWPWR, { 0x1, 0x0, 0x0 } },
220 { S5P_GPIO_MODE_COREBLK_LOWPWR, { 0x1, 0x0, 0x0 } },
221 { S5P_GPIO_MODE_MAUDIO_LOWPWR, { 0x1, 0x1, 0x0 } },
222 { S5P_TOP_ASB_RESET_LOWPWR, { 0x1, 0x1, 0x1 } },
223 { S5P_TOP_ASB_ISOLATION_LOWPWR, { 0x1, 0x0, 0x1 } },
224 { S5P_CAM_LOWPWR, { 0x7, 0x0, 0x0 } },
225 { S5P_TV_LOWPWR, { 0x7, 0x0, 0x0 } },
226 { S5P_MFC_LOWPWR, { 0x7, 0x0, 0x0 } },
227 { S5P_G3D_LOWPWR, { 0x7, 0x0, 0x0 } },
228 { S5P_LCD0_LOWPWR, { 0x7, 0x0, 0x0 } },
229 { S5P_ISP_LOWPWR, { 0x7, 0x0, 0x0 } },
230 { S5P_MAUDIO_LOWPWR, { 0x7, 0x7, 0x0 } },
231 { S5P_GPS_LOWPWR, { 0x7, 0x0, 0x0 } },
232 { S5P_GPS_ALIVE_LOWPWR, { 0x7, 0x0, 0x0 } },
233 { S5P_CMU_SYSCLK_ISP_LOWPWR, { 0x1, 0x0, 0x0 } },
234 { S5P_CMU_SYSCLK_GPS_LOWPWR, { 0x1, 0x0, 0x0 } },
235 { PMU_TABLE_END,},
236};
237
Daniel Kurtz53302222013-12-12 07:07:23 +0900238static const struct exynos_pmu_conf exynos4412_pmu_config[] = {
Inderpal Singh5ddfa842012-05-15 00:20:09 +0900239 { S5P_ARM_CORE2_LOWPWR, { 0x0, 0x0, 0x2 } },
240 { S5P_DIS_IRQ_CORE2, { 0x0, 0x0, 0x0 } },
241 { S5P_DIS_IRQ_CENTRAL2, { 0x0, 0x0, 0x0 } },
242 { S5P_ARM_CORE3_LOWPWR, { 0x0, 0x0, 0x2 } },
243 { S5P_DIS_IRQ_CORE3, { 0x0, 0x0, 0x0 } },
244 { S5P_DIS_IRQ_CENTRAL3, { 0x0, 0x0, 0x0 } },
245 { PMU_TABLE_END,},
246};
247
Daniel Kurtz53302222013-12-12 07:07:23 +0900248static const struct exynos_pmu_conf exynos5250_pmu_config[] = {
Pankaj Dubey2e94ac42014-07-19 03:43:22 +0900249 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
Jongpill Lee7d44d2b2012-02-17 09:51:31 +0900250 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
251 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
252 { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
253 { EXYNOS5_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
254 { EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
255 { EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
256 { EXYNOS5_FSYS_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
257 { EXYNOS5_DIS_IRQ_FSYS_ARM_CENTRAL_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
258 { EXYNOS5_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
259 { EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
260 { EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
261 { EXYNOS5_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} },
262 { EXYNOS5_ARM_L2_SYS_PWR_REG, { 0x3, 0x3, 0x3} },
Inderpal Singh088584612013-04-29 17:01:47 +0530263 { EXYNOS5_ARM_L2_OPTION, { 0x10, 0x10, 0x0 } },
Jongpill Lee7d44d2b2012-02-17 09:51:31 +0900264 { EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
265 { EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
266 { EXYNOS5_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
267 { EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
268 { EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
269 { EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
270 { EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
271 { EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
272 { EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
273 { EXYNOS5_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
274 { EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
275 { EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
276 { EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
277 { EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
278 { EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
279 { EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
280 { EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
281 { EXYNOS5_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
282 { EXYNOS5_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
283 { EXYNOS5_TOP_PWR_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
284 { EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
285 { EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
286 { EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
287 { EXYNOS5_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
288 { EXYNOS5_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
289 { EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
290 { EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
291 { EXYNOS5_USBOTG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
292 { EXYNOS5_G2D_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
293 { EXYNOS5_USBDRD_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
294 { EXYNOS5_SDMMC_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
295 { EXYNOS5_CSSYS_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
296 { EXYNOS5_SECSS_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
297 { EXYNOS5_ROTATOR_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
298 { EXYNOS5_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
299 { EXYNOS5_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
300 { EXYNOS5_JPEG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
Vikas Sajjan32ed35f2014-09-24 16:45:13 +0900301 { EXYNOS5_JPEG_MEM_OPTION, { 0x10, 0x10, 0x0} },
Jongpill Lee7d44d2b2012-02-17 09:51:31 +0900302 { EXYNOS5_HSI_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
303 { EXYNOS5_MCUIOP_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
304 { EXYNOS5_SATA_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
305 { EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
306 { EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
307 { EXYNOS5_PAD_RETENTION_GPIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
308 { EXYNOS5_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
309 { EXYNOS5_PAD_RETENTION_MMCA_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
310 { EXYNOS5_PAD_RETENTION_MMCB_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
311 { EXYNOS5_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
312 { EXYNOS5_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
313 { EXYNOS5_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
314 { EXYNOS5_PAD_RETENTION_GPIO_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
315 { EXYNOS5_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
316 { EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
317 { EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
318 { EXYNOS5_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
319 { EXYNOS5_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
320 { EXYNOS5_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
321 { EXYNOS5_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
322 { EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
323 { EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
324 { EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
325 { EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
326 { EXYNOS5_GSCL_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
327 { EXYNOS5_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
328 { EXYNOS5_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
329 { EXYNOS5_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
330 { EXYNOS5_DISP1_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
331 { EXYNOS5_MAU_SYS_PWR_REG, { 0x7, 0x7, 0x0} },
332 { EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
333 { EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
334 { EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
335 { EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
336 { EXYNOS5_CMU_CLKSTOP_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
337 { EXYNOS5_CMU_CLKSTOP_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
338 { EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
339 { EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
340 { EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
341 { EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
342 { EXYNOS5_CMU_SYSCLK_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
343 { EXYNOS5_CMU_SYSCLK_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
344 { EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
345 { EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
346 { EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
347 { EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
348 { EXYNOS5_CMU_RESET_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
349 { EXYNOS5_CMU_RESET_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
350 { PMU_TABLE_END,},
351};
352
Abhilash Kesavanaf2e0a02014-11-07 09:27:33 +0900353static struct exynos_pmu_conf exynos5420_pmu_config[] = {
354 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
355 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
356 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
357 { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
358 { EXYNOS5_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
359 { EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
360 { EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
361 { EXYNOS5420_ARM_CORE2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
362 { EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
363 { EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
364 { EXYNOS5420_ARM_CORE3_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
365 { EXYNOS5420_DIS_IRQ_ARM_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
366 { EXYNOS5420_DIS_IRQ_ARM_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
367 { EXYNOS5420_KFC_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
368 { EXYNOS5420_DIS_IRQ_KFC_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
369 { EXYNOS5420_DIS_IRQ_KFC_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
370 { EXYNOS5420_KFC_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
371 { EXYNOS5420_DIS_IRQ_KFC_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
372 { EXYNOS5420_DIS_IRQ_KFC_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
373 { EXYNOS5420_KFC_CORE2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
374 { EXYNOS5420_DIS_IRQ_KFC_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
375 { EXYNOS5420_DIS_IRQ_KFC_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
376 { EXYNOS5420_KFC_CORE3_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
377 { EXYNOS5420_DIS_IRQ_KFC_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
378 { EXYNOS5420_DIS_IRQ_KFC_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
379 { EXYNOS5_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
380 { EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
381 { EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
382 { EXYNOS5420_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
383 { EXYNOS5420_KFC_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
384 { EXYNOS5_ARM_L2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
385 { EXYNOS5420_KFC_L2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
386 { EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
387 { EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
388 { EXYNOS5_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
389 { EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
390 { EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
391 { EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
392 { EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
393 { EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
394 { EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
395 { EXYNOS5_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
396 { EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
397 { EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
398 { EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
399 { EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
400 { EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
401 { EXYNOS5420_DPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
402 { EXYNOS5420_IPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
403 { EXYNOS5420_KPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
404 { EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
405 { EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
406 { EXYNOS5420_RPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
407 { EXYNOS5420_SPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
408 { EXYNOS5_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
409 { EXYNOS5_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x1, 0x1} },
410 { EXYNOS5_TOP_PWR_SYS_PWR_REG, { 0x3, 0x3, 0x0} },
411 { EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
412 { EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
413 { EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} },
414 { EXYNOS5_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
415 { EXYNOS5_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x0, 0x1} },
416 { EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
417 { EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
418 { EXYNOS5420_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
419 { EXYNOS5420_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} },
420 { EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
421 { EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
422 { EXYNOS5420_PAD_RETENTION_JTAG_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
423 { EXYNOS5420_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
424 { EXYNOS5420_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
425 { EXYNOS5420_PAD_RETENTION_MMC0_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
426 { EXYNOS5420_PAD_RETENTION_MMC1_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
427 { EXYNOS5420_PAD_RETENTION_MMC2_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
428 { EXYNOS5420_PAD_RETENTION_HSI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
429 { EXYNOS5420_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
430 { EXYNOS5420_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
431 { EXYNOS5420_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
432 { EXYNOS5420_PAD_RETENTION_DRAM_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
433 { EXYNOS5_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
434 { EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
435 { EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
436 { EXYNOS5_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
437 { EXYNOS5_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
438 { EXYNOS5_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
439 { EXYNOS5_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
440 { EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
441 { EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
442 { EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} },
443 { EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
444 { EXYNOS5_GSCL_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
445 { EXYNOS5_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
446 { EXYNOS5_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
447 { EXYNOS5_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
448 { EXYNOS5420_DISP1_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
449 { EXYNOS5420_MAU_SYS_PWR_REG, { 0x7, 0x7, 0x0} },
450 { EXYNOS5420_G2D_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
451 { EXYNOS5420_MSC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
452 { EXYNOS5420_FSYS_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
453 { EXYNOS5420_FSYS2_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
454 { EXYNOS5420_PSGEN_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
455 { EXYNOS5420_PERIC_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
456 { EXYNOS5420_WCORE_SYS_PWR_REG, { 0x7, 0x0, 0x0} },
457 { EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
458 { EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
459 { EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
460 { EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
461 { EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
462 { EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
463 { EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
464 { EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
465 { EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
466 { EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
467 { EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
468 { EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
469 { EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
470 { EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
471 { EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
472 { EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
473 { EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
474 { EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
475 { EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
476 { EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
477 { EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
478 { EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
479 { EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
480 { EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
481 { EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
482 { EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
483 { EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
484 { EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
485 { EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
486 { EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
487 { EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
488 { EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
489 { EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
490 { EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
491 { EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
492 { EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
493 { EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
494 { EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
495 { PMU_TABLE_END,},
496};
497
Pankaj Dubey2e94ac42014-07-19 03:43:22 +0900498static unsigned int const exynos5_list_both_cnt_feed[] = {
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900499 EXYNOS5_ARM_CORE0_OPTION,
500 EXYNOS5_ARM_CORE1_OPTION,
501 EXYNOS5_ARM_COMMON_OPTION,
502 EXYNOS5_GSCL_OPTION,
503 EXYNOS5_ISP_OPTION,
504 EXYNOS5_MFC_OPTION,
505 EXYNOS5_G3D_OPTION,
506 EXYNOS5_DISP1_OPTION,
507 EXYNOS5_MAU_OPTION,
508 EXYNOS5_TOP_PWR_OPTION,
509 EXYNOS5_TOP_PWR_SYSMEM_OPTION,
510};
511
Pankaj Dubeyd4c6c6c2014-11-07 08:30:33 +0900512static unsigned int const exynos5_list_disable_wfi_wfe[] = {
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900513 EXYNOS5_ARM_CORE1_OPTION,
514 EXYNOS5_FSYS_ARM_OPTION,
515 EXYNOS5_ISP_ARM_OPTION,
516};
517
Abhilash Kesavanaf2e0a02014-11-07 09:27:33 +0900518static unsigned int const exynos5420_list_disable_pmu_reg[] = {
519 EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG,
520 EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG,
521 EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG,
522 EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG,
523 EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG,
524 EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG,
525 EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG,
526 EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG,
527 EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG,
528 EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG,
529 EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG,
530 EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG,
531 EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG,
532 EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG,
533 EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG,
534 EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG,
535 EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG,
536 EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG,
537 EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG,
538 EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG,
539 EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG,
540 EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG,
541 EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG,
542 EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG,
543 EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG,
544 EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG,
545 EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG,
546 EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG,
547 EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG,
548 EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG,
549 EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG,
550 EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG,
551 EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG,
552 EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG,
553 EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
554};
555
556static void exynos5_power_off(void)
557{
558 unsigned int tmp;
559
560 pr_info("Power down.\n");
561 tmp = pmu_raw_readl(EXYNOS_PS_HOLD_CONTROL);
562 tmp ^= (1 << 8);
563 pmu_raw_writel(tmp, EXYNOS_PS_HOLD_CONTROL);
564
565 /* Wait a little so we don't give a false warning below */
566 mdelay(100);
567
568 pr_err("Power down failed, please power off system manually.\n");
569 while (1)
570 ;
571}
572
573void exynos5420_powerdown_conf(enum sys_powerdown mode)
574{
575 u32 this_cluster;
576
577 this_cluster = MPIDR_AFFINITY_LEVEL(read_cpuid_mpidr(), 1);
578
579 /*
580 * set the cluster id to IROM register to ensure that we wake
581 * up with the current cluster.
582 */
583 pmu_raw_writel(this_cluster, EXYNOS_IROM_DATA2);
584}
585
586
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900587static void exynos5_powerdown_conf(enum sys_powerdown mode)
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900588{
589 unsigned int i;
590 unsigned int tmp;
591
592 /*
593 * Enable both SC_FEEDBACK and SC_COUNTER
594 */
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900595 for (i = 0; i < ARRAY_SIZE(exynos5_list_both_cnt_feed); i++) {
Pankaj Dubey2e94ac42014-07-19 03:43:22 +0900596 tmp = pmu_raw_readl(exynos5_list_both_cnt_feed[i]);
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900597 tmp |= (EXYNOS5_USE_SC_FEEDBACK |
598 EXYNOS5_USE_SC_COUNTER);
Pankaj Dubey2e94ac42014-07-19 03:43:22 +0900599 pmu_raw_writel(tmp, exynos5_list_both_cnt_feed[i]);
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900600 }
601
602 /*
603 * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900604 */
Pankaj Dubey2e94ac42014-07-19 03:43:22 +0900605 tmp = pmu_raw_readl(EXYNOS5_ARM_COMMON_OPTION);
Inderpal Singh088584612013-04-29 17:01:47 +0530606 tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
Pankaj Dubey2e94ac42014-07-19 03:43:22 +0900607 pmu_raw_writel(tmp, EXYNOS5_ARM_COMMON_OPTION);
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900608
609 /*
610 * Disable WFI/WFE on XXX_OPTION
611 */
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900612 for (i = 0; i < ARRAY_SIZE(exynos5_list_disable_wfi_wfe); i++) {
Pankaj Dubeyd4c6c6c2014-11-07 08:30:33 +0900613 tmp = pmu_raw_readl(exynos5_list_disable_wfi_wfe[i]);
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900614 tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE |
615 EXYNOS5_OPTION_USE_STANDBYWFI);
Pankaj Dubeyd4c6c6c2014-11-07 08:30:33 +0900616 pmu_raw_writel(tmp, exynos5_list_disable_wfi_wfe[i]);
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900617 }
618}
619
Jongpill Lee7d44d2b2012-02-17 09:51:31 +0900620void exynos_sys_powerdown_conf(enum sys_powerdown mode)
Jaecheol Leee28e3012011-07-18 19:21:23 +0900621{
Jongpill Lee0dba4dc2011-09-27 07:22:11 +0900622 unsigned int i;
Jaecheol Leee28e3012011-07-18 19:21:23 +0900623
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900624 const struct exynos_pmu_data *pmu_data = pmu_context->pmu_data;
Jongpill Lee60e49ca2012-02-17 12:23:51 +0900625
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900626 if (pmu_data->powerdown_conf)
627 pmu_data->powerdown_conf(mode);
Inderpal Singh5ddfa842012-05-15 00:20:09 +0900628
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900629 if (pmu_data->pmu_config) {
630 for (i = 0; (pmu_data->pmu_config[i].offset != PMU_TABLE_END); i++)
631 pmu_raw_writel(pmu_data->pmu_config[i].val[mode],
632 pmu_data->pmu_config[i].offset);
633 }
634
635 if (pmu_data->pmu_config_extra) {
636 for (i = 0; pmu_data->pmu_config_extra[i].offset != PMU_TABLE_END; i++)
637 pmu_raw_writel(pmu_data->pmu_config_extra[i].val[mode],
638 pmu_data->pmu_config_extra[i].offset);
Inderpal Singh5ddfa842012-05-15 00:20:09 +0900639 }
Jaecheol Leee28e3012011-07-18 19:21:23 +0900640}
Jongpill Lee0dba4dc2011-09-27 07:22:11 +0900641
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900642static void exynos5250_pmu_init(void)
643{
644 unsigned int value;
645 /*
646 * When SYS_WDTRESET is set, watchdog timer reset request
647 * is ignored by power management unit.
648 */
649 value = pmu_raw_readl(EXYNOS5_AUTO_WDTRESET_DISABLE);
650 value &= ~EXYNOS5_SYS_WDTRESET;
651 pmu_raw_writel(value, EXYNOS5_AUTO_WDTRESET_DISABLE);
652
653 value = pmu_raw_readl(EXYNOS5_MASK_WDTRESET_REQUEST);
654 value &= ~EXYNOS5_SYS_WDTRESET;
655 pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST);
656}
657
Abhilash Kesavanaf2e0a02014-11-07 09:27:33 +0900658static void exynos5420_pmu_init(void)
659{
660 unsigned int value;
661 int i;
662
663 /*
664 * Set the CMU_RESET, CMU_SYSCLK and CMU_CLKSTOP registers
665 * for local power blocks to Low initially as per Table 8-4:
666 * "System-Level Power-Down Configuration Registers".
667 */
668 for (i = 0; i < ARRAY_SIZE(exynos5420_list_disable_pmu_reg); i++)
669 pmu_raw_writel(0, exynos5420_list_disable_pmu_reg[i]);
670
671 /* Enable USE_STANDBY_WFI for all CORE */
672 pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
673
674 value = pmu_raw_readl(EXYNOS_L2_OPTION(0));
675 value &= ~EXYNOS5_USE_RETENTION;
676 pmu_raw_writel(value, EXYNOS_L2_OPTION(0));
677
678 value = pmu_raw_readl(EXYNOS_L2_OPTION(1));
679 value &= ~EXYNOS5_USE_RETENTION;
680 pmu_raw_writel(value, EXYNOS_L2_OPTION(1));
681
682 /*
683 * If L2_COMMON is turned off, clocks related to ATB async
684 * bridge are gated. Thus, when ISP power is gated, LPI
685 * may get stuck.
686 */
687 value = pmu_raw_readl(EXYNOS5420_LPI_MASK);
688 value |= EXYNOS5420_ATB_ISP_ARM;
689 pmu_raw_writel(value, EXYNOS5420_LPI_MASK);
690
691 value = pmu_raw_readl(EXYNOS5420_LPI_MASK1);
692 value |= EXYNOS5420_ATB_KFC;
693 pmu_raw_writel(value, EXYNOS5420_LPI_MASK1);
694
695 /* Prevent issue of new bus request from L2 memory */
696 value = pmu_raw_readl(EXYNOS5420_ARM_COMMON_OPTION);
697 value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
698 pmu_raw_writel(value, EXYNOS5420_ARM_COMMON_OPTION);
699
700 value = pmu_raw_readl(EXYNOS5420_KFC_COMMON_OPTION);
701 value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
702 pmu_raw_writel(value, EXYNOS5420_KFC_COMMON_OPTION);
703
704 /* This setting is to reduce suspend/resume time */
705 pmu_raw_writel(DUR_WAIT_RESET, EXYNOS5420_LOGIC_RESET_DURATION3);
706
707 /* Serialized CPU wakeup of Eagle */
708 pmu_raw_writel(SPREAD_ENABLE, EXYNOS5420_ARM_INTR_SPREAD_ENABLE);
709
710 pmu_raw_writel(SPREAD_USE_STANDWFI,
711 EXYNOS5420_ARM_INTR_SPREAD_USE_STANDBYWFI);
712
713 pmu_raw_writel(0x1, EXYNOS5420_UP_SCHEDULER);
714
715 pm_power_off = exynos5_power_off;
716 pr_info("EXYNOS5420 PMU initialized\n");
717}
718
719
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900720static const struct exynos_pmu_data exynos4210_pmu_data = {
721 .pmu_config = exynos4210_pmu_config,
722};
723
724static const struct exynos_pmu_data exynos4212_pmu_data = {
725 .pmu_config = exynos4x12_pmu_config,
726};
727
728static const struct exynos_pmu_data exynos4412_pmu_data = {
729 .pmu_config = exynos4x12_pmu_config,
730 .pmu_config_extra = exynos4412_pmu_config,
731};
732
733static const struct exynos_pmu_data exynos5250_pmu_data = {
734 .pmu_config = exynos5250_pmu_config,
735 .pmu_init = exynos5250_pmu_init,
736 .powerdown_conf = exynos5_powerdown_conf,
737};
738
Abhilash Kesavanaf2e0a02014-11-07 09:27:33 +0900739static struct exynos_pmu_data exynos5420_pmu_data = {
740 .pmu_config = exynos5420_pmu_config,
741 .pmu_init = exynos5420_pmu_init,
742 .powerdown_conf = exynos5420_powerdown_conf,
743};
744
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900745/*
746 * PMU platform driver and devicetree bindings.
747 */
748static const struct of_device_id exynos_pmu_of_device_ids[] = {
749 {
750 .compatible = "samsung,exynos4210-pmu",
751 .data = &exynos4210_pmu_data,
752 }, {
753 .compatible = "samsung,exynos4212-pmu",
754 .data = &exynos4212_pmu_data,
755 }, {
756 .compatible = "samsung,exynos4412-pmu",
757 .data = &exynos4412_pmu_data,
758 }, {
759 .compatible = "samsung,exynos5250-pmu",
760 .data = &exynos5250_pmu_data,
Abhilash Kesavanaf2e0a02014-11-07 09:27:33 +0900761 }, {
762 .compatible = "samsung,exynos5420-pmu",
763 .data = &exynos5420_pmu_data,
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900764 },
765 { /*sentinel*/ },
766};
767
768static int exynos_pmu_probe(struct platform_device *pdev)
769{
770 const struct of_device_id *match;
771 struct device *dev = &pdev->dev;
772 struct resource *res;
773
774 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
775 pmu_base_addr = devm_ioremap_resource(dev, res);
776 if (IS_ERR(pmu_base_addr))
777 return PTR_ERR(pmu_base_addr);
778
779 pmu_context = devm_kzalloc(&pdev->dev,
780 sizeof(struct exynos_pmu_context),
781 GFP_KERNEL);
782 if (!pmu_context) {
783 dev_err(dev, "Cannot allocate memory.\n");
784 return -ENOMEM;
785 }
786 pmu_context->dev = dev;
787
788 match = of_match_node(exynos_pmu_of_device_ids, dev->of_node);
789
790 pmu_context->pmu_data = match->data;
791
792 if (pmu_context->pmu_data->pmu_init)
793 pmu_context->pmu_data->pmu_init();
794
795 platform_set_drvdata(pdev, pmu_context);
796
797 dev_dbg(dev, "Exynos PMU Driver probe done\n");
798 return 0;
799}
800
801static struct platform_driver exynos_pmu_driver = {
802 .driver = {
803 .name = "exynos-pmu",
804 .owner = THIS_MODULE,
805 .of_match_table = exynos_pmu_of_device_ids,
806 },
807 .probe = exynos_pmu_probe,
808};
809
Jongpill Lee7d44d2b2012-02-17 09:51:31 +0900810static int __init exynos_pmu_init(void)
Jongpill Lee0dba4dc2011-09-27 07:22:11 +0900811{
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900812 return platform_driver_register(&exynos_pmu_driver);
Jonghwan Choi7d896aa2012-06-27 09:47:35 +0900813
Jongpill Lee0dba4dc2011-09-27 07:22:11 +0900814}
Pankaj Dubey14fc8b92014-11-07 09:26:40 +0900815postcore_initcall(exynos_pmu_init);