18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci//
38c2ecf20Sopenharmony_ci// Copyright (c) 2011-2015 Samsung Electronics Co., Ltd.
48c2ecf20Sopenharmony_ci//		http://www.samsung.com/
58c2ecf20Sopenharmony_ci//
68c2ecf20Sopenharmony_ci// Exynos5420 - CPU PMU (Power Management Unit) support
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/pm.h>
98c2ecf20Sopenharmony_ci#include <linux/soc/samsung/exynos-regs-pmu.h>
108c2ecf20Sopenharmony_ci#include <linux/soc/samsung/exynos-pmu.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/cputype.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "exynos-pmu.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistatic const struct exynos_pmu_conf exynos5420_pmu_config[] = {
178c2ecf20Sopenharmony_ci	/* { .offset = offset, .val = { AFTR, LPA, SLEEP } */
188c2ecf20Sopenharmony_ci	{ EXYNOS5_ARM_CORE0_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
198c2ecf20Sopenharmony_ci	{ EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
208c2ecf20Sopenharmony_ci	{ EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
218c2ecf20Sopenharmony_ci	{ EXYNOS5_ARM_CORE1_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
228c2ecf20Sopenharmony_ci	{ EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
238c2ecf20Sopenharmony_ci	{ EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
248c2ecf20Sopenharmony_ci	{ EXYNOS5420_ARM_CORE2_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
258c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
268c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
278c2ecf20Sopenharmony_ci	{ EXYNOS5420_ARM_CORE3_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
288c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_ARM_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
298c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_ARM_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
308c2ecf20Sopenharmony_ci	{ EXYNOS5420_KFC_CORE0_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
318c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
328c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
338c2ecf20Sopenharmony_ci	{ EXYNOS5420_KFC_CORE1_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
348c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
358c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
368c2ecf20Sopenharmony_ci	{ EXYNOS5420_KFC_CORE2_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
378c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE2_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
388c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE2_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
398c2ecf20Sopenharmony_ci	{ EXYNOS5420_KFC_CORE3_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
408c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE3_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
418c2ecf20Sopenharmony_ci	{ EXYNOS5420_DIS_IRQ_KFC_CORE3_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
428c2ecf20Sopenharmony_ci	{ EXYNOS5_ISP_ARM_SYS_PWR_REG,			{ 0x1, 0x0, 0x0} },
438c2ecf20Sopenharmony_ci	{ EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
448c2ecf20Sopenharmony_ci	{ EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
458c2ecf20Sopenharmony_ci	{ EXYNOS5420_ARM_COMMON_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
468c2ecf20Sopenharmony_ci	{ EXYNOS5420_KFC_COMMON_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
478c2ecf20Sopenharmony_ci	{ EXYNOS5_ARM_L2_SYS_PWR_REG,			{ 0x0, 0x0, 0x0} },
488c2ecf20Sopenharmony_ci	{ EXYNOS5420_KFC_L2_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
498c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
508c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
518c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_RESET_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
528c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
538c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x1} },
548c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
558c2ecf20Sopenharmony_ci	{ EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
568c2ecf20Sopenharmony_ci	{ EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG,		{ 0x1, 0x1, 0x1} },
578c2ecf20Sopenharmony_ci	{ EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
588c2ecf20Sopenharmony_ci	{ EXYNOS5_APLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
598c2ecf20Sopenharmony_ci	{ EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
608c2ecf20Sopenharmony_ci	{ EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
618c2ecf20Sopenharmony_ci	{ EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
628c2ecf20Sopenharmony_ci	{ EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
638c2ecf20Sopenharmony_ci	{ EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
648c2ecf20Sopenharmony_ci	{ EXYNOS5420_DPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
658c2ecf20Sopenharmony_ci	{ EXYNOS5420_IPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
668c2ecf20Sopenharmony_ci	{ EXYNOS5420_KPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
678c2ecf20Sopenharmony_ci	{ EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
688c2ecf20Sopenharmony_ci	{ EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
698c2ecf20Sopenharmony_ci	{ EXYNOS5420_RPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
708c2ecf20Sopenharmony_ci	{ EXYNOS5420_SPLL_SYSCLK_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
718c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_BUS_SYS_PWR_REG,			{ 0x3, 0x0, 0x0} },
728c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_RETENTION_SYS_PWR_REG,		{ 0x1, 0x1, 0x1} },
738c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_PWR_SYS_PWR_REG,			{ 0x3, 0x3, 0x0} },
748c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x0} },
758c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x1} },
768c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x0} },
778c2ecf20Sopenharmony_ci	{ EXYNOS5_LOGIC_RESET_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
788c2ecf20Sopenharmony_ci	{ EXYNOS5_OSCCLK_GATE_SYS_PWR_REG,		{ 0x1, 0x0, 0x1} },
798c2ecf20Sopenharmony_ci	{ EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
808c2ecf20Sopenharmony_ci	{ EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
818c2ecf20Sopenharmony_ci	{ EXYNOS5420_INTRAM_MEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x3} },
828c2ecf20Sopenharmony_ci	{ EXYNOS5420_INTROM_MEM_SYS_PWR_REG,		{ 0x3, 0x0, 0x3} },
838c2ecf20Sopenharmony_ci	{ EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
848c2ecf20Sopenharmony_ci	{ EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG,	{ 0x1, 0x1, 0x0} },
858c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_JTAG_SYS_PWR_REG,	{ 0x1, 0x1, 0x0} },
868c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_DRAM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
878c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_UART_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
888c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_MMC0_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
898c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_MMC1_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
908c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_MMC2_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
918c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_HSI_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
928c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_EBIA_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
938c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_EBIB_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
948c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_SPI_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
958c2ecf20Sopenharmony_ci	{ EXYNOS5420_PAD_RETENTION_DRAM_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} },
968c2ecf20Sopenharmony_ci	{ EXYNOS5_PAD_ISOLATION_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
978c2ecf20Sopenharmony_ci	{ EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
988c2ecf20Sopenharmony_ci	{ EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
998c2ecf20Sopenharmony_ci	{ EXYNOS5_XUSBXTI_SYS_PWR_REG,			{ 0x1, 0x1, 0x0} },
1008c2ecf20Sopenharmony_ci	{ EXYNOS5_XXTI_SYS_PWR_REG,			{ 0x1, 0x1, 0x0} },
1018c2ecf20Sopenharmony_ci	{ EXYNOS5_EXT_REGULATOR_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
1028c2ecf20Sopenharmony_ci	{ EXYNOS5_GPIO_MODE_SYS_PWR_REG,		{ 0x1, 0x0, 0x0} },
1038c2ecf20Sopenharmony_ci	{ EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
1048c2ecf20Sopenharmony_ci	{ EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
1058c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG,		{ 0x1, 0x1, 0x0} },
1068c2ecf20Sopenharmony_ci	{ EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG,	{ 0x1, 0x0, 0x0} },
1078c2ecf20Sopenharmony_ci	{ EXYNOS5_GSCL_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1088c2ecf20Sopenharmony_ci	{ EXYNOS5_ISP_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1098c2ecf20Sopenharmony_ci	{ EXYNOS5_MFC_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1108c2ecf20Sopenharmony_ci	{ EXYNOS5_G3D_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1118c2ecf20Sopenharmony_ci	{ EXYNOS5420_DISP1_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1128c2ecf20Sopenharmony_ci	{ EXYNOS5420_MAU_SYS_PWR_REG,			{ 0x7, 0x7, 0x0} },
1138c2ecf20Sopenharmony_ci	{ EXYNOS5420_G2D_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1148c2ecf20Sopenharmony_ci	{ EXYNOS5420_MSC_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1158c2ecf20Sopenharmony_ci	{ EXYNOS5420_FSYS_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1168c2ecf20Sopenharmony_ci	{ EXYNOS5420_FSYS2_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1178c2ecf20Sopenharmony_ci	{ EXYNOS5420_PSGEN_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1188c2ecf20Sopenharmony_ci	{ EXYNOS5420_PERIC_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1198c2ecf20Sopenharmony_ci	{ EXYNOS5420_WCORE_SYS_PWR_REG,			{ 0x7, 0x0, 0x0} },
1208c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1218c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1228c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1238c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1248c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1258c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1268c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1278c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1288c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1298c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1308c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1318c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1328c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1338c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1348c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1358c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1368c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1378c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1388c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1398c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1408c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1418c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1428c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1438c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1448c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1458c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1468c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1478c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1488c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1498c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1508c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1518c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1528c2ecf20Sopenharmony_ci	{ EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1538c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1548c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1558c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1568c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG,		{ 0x0, 0x0, 0x0} },
1578c2ecf20Sopenharmony_ci	{ EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,	{ 0x0, 0x0, 0x0} },
1588c2ecf20Sopenharmony_ci	{ PMU_TABLE_END,},
1598c2ecf20Sopenharmony_ci};
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_cistatic unsigned int const exynos5420_list_disable_pmu_reg[] = {
1628c2ecf20Sopenharmony_ci	EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG,
1638c2ecf20Sopenharmony_ci	EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG,
1648c2ecf20Sopenharmony_ci	EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG,
1658c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG,
1668c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG,
1678c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG,
1688c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG,
1698c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG,
1708c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG,
1718c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG,
1728c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG,
1738c2ecf20Sopenharmony_ci	EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG,
1748c2ecf20Sopenharmony_ci	EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG,
1758c2ecf20Sopenharmony_ci	EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG,
1768c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG,
1778c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG,
1788c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG,
1798c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG,
1808c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG,
1818c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG,
1828c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG,
1838c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG,
1848c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG,
1858c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG,
1868c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG,
1878c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG,
1888c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG,
1898c2ecf20Sopenharmony_ci	EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG,
1908c2ecf20Sopenharmony_ci	EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG,
1918c2ecf20Sopenharmony_ci	EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG,
1928c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG,
1938c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG,
1948c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG,
1958c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG,
1968c2ecf20Sopenharmony_ci	EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG,
1978c2ecf20Sopenharmony_ci};
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_cistatic void exynos5420_powerdown_conf(enum sys_powerdown mode)
2008c2ecf20Sopenharmony_ci{
2018c2ecf20Sopenharmony_ci	u32 this_cluster;
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci	this_cluster = MPIDR_AFFINITY_LEVEL(read_cpuid_mpidr(), 1);
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	/*
2068c2ecf20Sopenharmony_ci	 * set the cluster id to IROM register to ensure that we wake
2078c2ecf20Sopenharmony_ci	 * up with the current cluster.
2088c2ecf20Sopenharmony_ci	 */
2098c2ecf20Sopenharmony_ci	pmu_raw_writel(this_cluster, EXYNOS_IROM_DATA2);
2108c2ecf20Sopenharmony_ci}
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_cistatic void exynos5420_pmu_init(void)
2138c2ecf20Sopenharmony_ci{
2148c2ecf20Sopenharmony_ci	unsigned int value;
2158c2ecf20Sopenharmony_ci	int i;
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci	/*
2188c2ecf20Sopenharmony_ci	 * Set the CMU_RESET, CMU_SYSCLK and CMU_CLKSTOP registers
2198c2ecf20Sopenharmony_ci	 * for local power blocks to Low initially as per Table 8-4:
2208c2ecf20Sopenharmony_ci	 * "System-Level Power-Down Configuration Registers".
2218c2ecf20Sopenharmony_ci	 */
2228c2ecf20Sopenharmony_ci	for (i = 0; i < ARRAY_SIZE(exynos5420_list_disable_pmu_reg); i++)
2238c2ecf20Sopenharmony_ci		pmu_raw_writel(0, exynos5420_list_disable_pmu_reg[i]);
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci	/* Enable USE_STANDBY_WFI for all CORE */
2268c2ecf20Sopenharmony_ci	pmu_raw_writel(EXYNOS5420_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION);
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	value  = pmu_raw_readl(EXYNOS_L2_OPTION(0));
2298c2ecf20Sopenharmony_ci	value &= ~EXYNOS_L2_USE_RETENTION;
2308c2ecf20Sopenharmony_ci	pmu_raw_writel(value, EXYNOS_L2_OPTION(0));
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci	value = pmu_raw_readl(EXYNOS_L2_OPTION(1));
2338c2ecf20Sopenharmony_ci	value &= ~EXYNOS_L2_USE_RETENTION;
2348c2ecf20Sopenharmony_ci	pmu_raw_writel(value, EXYNOS_L2_OPTION(1));
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	/*
2378c2ecf20Sopenharmony_ci	 * If L2_COMMON is turned off, clocks related to ATB async
2388c2ecf20Sopenharmony_ci	 * bridge are gated. Thus, when ISP power is gated, LPI
2398c2ecf20Sopenharmony_ci	 * may get stuck.
2408c2ecf20Sopenharmony_ci	 */
2418c2ecf20Sopenharmony_ci	value = pmu_raw_readl(EXYNOS5420_LPI_MASK);
2428c2ecf20Sopenharmony_ci	value |= EXYNOS5420_ATB_ISP_ARM;
2438c2ecf20Sopenharmony_ci	pmu_raw_writel(value, EXYNOS5420_LPI_MASK);
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci	value  = pmu_raw_readl(EXYNOS5420_LPI_MASK1);
2468c2ecf20Sopenharmony_ci	value |= EXYNOS5420_ATB_KFC;
2478c2ecf20Sopenharmony_ci	pmu_raw_writel(value, EXYNOS5420_LPI_MASK1);
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	/* Prevent issue of new bus request from L2 memory */
2508c2ecf20Sopenharmony_ci	value = pmu_raw_readl(EXYNOS5420_ARM_COMMON_OPTION);
2518c2ecf20Sopenharmony_ci	value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
2528c2ecf20Sopenharmony_ci	pmu_raw_writel(value, EXYNOS5420_ARM_COMMON_OPTION);
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci	value = pmu_raw_readl(EXYNOS5420_KFC_COMMON_OPTION);
2558c2ecf20Sopenharmony_ci	value |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN;
2568c2ecf20Sopenharmony_ci	pmu_raw_writel(value, EXYNOS5420_KFC_COMMON_OPTION);
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci	/* This setting is to reduce suspend/resume time */
2598c2ecf20Sopenharmony_ci	pmu_raw_writel(DUR_WAIT_RESET, EXYNOS5420_LOGIC_RESET_DURATION3);
2608c2ecf20Sopenharmony_ci
2618c2ecf20Sopenharmony_ci	/* Serialized CPU wakeup of Eagle */
2628c2ecf20Sopenharmony_ci	pmu_raw_writel(SPREAD_ENABLE, EXYNOS5420_ARM_INTR_SPREAD_ENABLE);
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci	pmu_raw_writel(SPREAD_USE_STANDWFI,
2658c2ecf20Sopenharmony_ci			EXYNOS5420_ARM_INTR_SPREAD_USE_STANDBYWFI);
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci	pmu_raw_writel(0x1, EXYNOS5420_UP_SCHEDULER);
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci	pr_info("EXYNOS5420 PMU initialized\n");
2708c2ecf20Sopenharmony_ci}
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ciconst struct exynos_pmu_data exynos5420_pmu_data = {
2738c2ecf20Sopenharmony_ci	.pmu_config	= exynos5420_pmu_config,
2748c2ecf20Sopenharmony_ci	.pmu_init	= exynos5420_pmu_init,
2758c2ecf20Sopenharmony_ci	.powerdown_conf	= exynos5420_powerdown_conf,
2768c2ecf20Sopenharmony_ci};
277