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// Exynos5250 - CPU PMU (Power Management Unit) support 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/soc/samsung/exynos-regs-pmu.h> 98c2ecf20Sopenharmony_ci#include <linux/soc/samsung/exynos-pmu.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include "exynos-pmu.h" 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistatic const struct exynos_pmu_conf exynos5250_pmu_config[] = { 148c2ecf20Sopenharmony_ci /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */ 158c2ecf20Sopenharmony_ci { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 168c2ecf20Sopenharmony_ci { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 178c2ecf20Sopenharmony_ci { EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 188c2ecf20Sopenharmony_ci { EXYNOS5_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 198c2ecf20Sopenharmony_ci { EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 208c2ecf20Sopenharmony_ci { EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 218c2ecf20Sopenharmony_ci { EXYNOS5_FSYS_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 228c2ecf20Sopenharmony_ci { EXYNOS5_DIS_IRQ_FSYS_ARM_CENTRAL_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 238c2ecf20Sopenharmony_ci { EXYNOS5_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 248c2ecf20Sopenharmony_ci { EXYNOS5_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 258c2ecf20Sopenharmony_ci { EXYNOS5_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 268c2ecf20Sopenharmony_ci { EXYNOS5_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 278c2ecf20Sopenharmony_ci { EXYNOS5_ARM_L2_SYS_PWR_REG, { 0x3, 0x3, 0x3} }, 288c2ecf20Sopenharmony_ci { EXYNOS_L2_OPTION(0), { 0x10, 0x10, 0x0 } }, 298c2ecf20Sopenharmony_ci { EXYNOS5_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 308c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 318c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 328c2ecf20Sopenharmony_ci { EXYNOS5_CMU_ACLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 338c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SCLKSTOP_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 348c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 358c2ecf20Sopenharmony_ci { EXYNOS5_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 368c2ecf20Sopenharmony_ci { EXYNOS5_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 378c2ecf20Sopenharmony_ci { EXYNOS5_DDRPHY_DLLLOCK_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 388c2ecf20Sopenharmony_ci { EXYNOS5_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 398c2ecf20Sopenharmony_ci { EXYNOS5_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 408c2ecf20Sopenharmony_ci { EXYNOS5_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 418c2ecf20Sopenharmony_ci { EXYNOS5_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 428c2ecf20Sopenharmony_ci { EXYNOS5_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 438c2ecf20Sopenharmony_ci { EXYNOS5_CPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 448c2ecf20Sopenharmony_ci { EXYNOS5_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 458c2ecf20Sopenharmony_ci { EXYNOS5_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 468c2ecf20Sopenharmony_ci { EXYNOS5_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 478c2ecf20Sopenharmony_ci { EXYNOS5_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 488c2ecf20Sopenharmony_ci { EXYNOS5_TOP_PWR_SYS_PWR_REG, { 0x3, 0x0, 0x3} }, 498c2ecf20Sopenharmony_ci { EXYNOS5_TOP_BUS_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 508c2ecf20Sopenharmony_ci { EXYNOS5_TOP_RETENTION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 518c2ecf20Sopenharmony_ci { EXYNOS5_TOP_PWR_SYSMEM_SYS_PWR_REG, { 0x3, 0x0, 0x3} }, 528c2ecf20Sopenharmony_ci { EXYNOS5_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 538c2ecf20Sopenharmony_ci { EXYNOS5_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 548c2ecf20Sopenharmony_ci { EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 558c2ecf20Sopenharmony_ci { EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 568c2ecf20Sopenharmony_ci { EXYNOS5_USBOTG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 578c2ecf20Sopenharmony_ci { EXYNOS5_G2D_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 588c2ecf20Sopenharmony_ci { EXYNOS5_USBDRD_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 598c2ecf20Sopenharmony_ci { EXYNOS5_SDMMC_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 608c2ecf20Sopenharmony_ci { EXYNOS5_CSSYS_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 618c2ecf20Sopenharmony_ci { EXYNOS5_SECSS_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 628c2ecf20Sopenharmony_ci { EXYNOS5_ROTATOR_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 638c2ecf20Sopenharmony_ci { EXYNOS5_INTRAM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 648c2ecf20Sopenharmony_ci { EXYNOS5_INTROM_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 658c2ecf20Sopenharmony_ci { EXYNOS5_JPEG_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 668c2ecf20Sopenharmony_ci { EXYNOS5_JPEG_MEM_OPTION, { 0x10, 0x10, 0x0} }, 678c2ecf20Sopenharmony_ci { EXYNOS5_HSI_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 688c2ecf20Sopenharmony_ci { EXYNOS5_MCUIOP_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 698c2ecf20Sopenharmony_ci { EXYNOS5_SATA_MEM_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 708c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 718c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 728c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_GPIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 738c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 748c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_MMCA_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 758c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_MMCB_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 768c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 778c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 788c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 798c2ecf20Sopenharmony_ci { EXYNOS5_PAD_RETENTION_GPIO_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 808c2ecf20Sopenharmony_ci { EXYNOS5_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 818c2ecf20Sopenharmony_ci { EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 828c2ecf20Sopenharmony_ci { EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 838c2ecf20Sopenharmony_ci { EXYNOS5_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 848c2ecf20Sopenharmony_ci { EXYNOS5_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 858c2ecf20Sopenharmony_ci { EXYNOS5_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 868c2ecf20Sopenharmony_ci { EXYNOS5_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 878c2ecf20Sopenharmony_ci { EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 888c2ecf20Sopenharmony_ci { EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 898c2ecf20Sopenharmony_ci { EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 908c2ecf20Sopenharmony_ci { EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 918c2ecf20Sopenharmony_ci { EXYNOS5_GSCL_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 928c2ecf20Sopenharmony_ci { EXYNOS5_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 938c2ecf20Sopenharmony_ci { EXYNOS5_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 948c2ecf20Sopenharmony_ci { EXYNOS5_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 958c2ecf20Sopenharmony_ci { EXYNOS5_DISP1_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 968c2ecf20Sopenharmony_ci { EXYNOS5_MAU_SYS_PWR_REG, { 0x7, 0x7, 0x0} }, 978c2ecf20Sopenharmony_ci { EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 988c2ecf20Sopenharmony_ci { EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 998c2ecf20Sopenharmony_ci { EXYNOS5_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1008c2ecf20Sopenharmony_ci { EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1018c2ecf20Sopenharmony_ci { EXYNOS5_CMU_CLKSTOP_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1028c2ecf20Sopenharmony_ci { EXYNOS5_CMU_CLKSTOP_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 1038c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1048c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1058c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SYSCLK_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1068c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1078c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SYSCLK_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1088c2ecf20Sopenharmony_ci { EXYNOS5_CMU_SYSCLK_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 1098c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1108c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1118c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1128c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1138c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_DISP1_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 1148c2ecf20Sopenharmony_ci { EXYNOS5_CMU_RESET_MAU_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 1158c2ecf20Sopenharmony_ci { PMU_TABLE_END,}, 1168c2ecf20Sopenharmony_ci}; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_cistatic unsigned int const exynos5_list_both_cnt_feed[] = { 1198c2ecf20Sopenharmony_ci EXYNOS5_ARM_CORE0_OPTION, 1208c2ecf20Sopenharmony_ci EXYNOS5_ARM_CORE1_OPTION, 1218c2ecf20Sopenharmony_ci EXYNOS5_ARM_COMMON_OPTION, 1228c2ecf20Sopenharmony_ci EXYNOS5_GSCL_OPTION, 1238c2ecf20Sopenharmony_ci EXYNOS5_ISP_OPTION, 1248c2ecf20Sopenharmony_ci EXYNOS5_MFC_OPTION, 1258c2ecf20Sopenharmony_ci EXYNOS5_G3D_OPTION, 1268c2ecf20Sopenharmony_ci EXYNOS5_DISP1_OPTION, 1278c2ecf20Sopenharmony_ci EXYNOS5_MAU_OPTION, 1288c2ecf20Sopenharmony_ci EXYNOS5_TOP_PWR_OPTION, 1298c2ecf20Sopenharmony_ci EXYNOS5_TOP_PWR_SYSMEM_OPTION, 1308c2ecf20Sopenharmony_ci}; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_cistatic unsigned int const exynos5_list_disable_wfi_wfe[] = { 1338c2ecf20Sopenharmony_ci EXYNOS5_ARM_CORE1_OPTION, 1348c2ecf20Sopenharmony_ci EXYNOS5_FSYS_ARM_OPTION, 1358c2ecf20Sopenharmony_ci EXYNOS5_ISP_ARM_OPTION, 1368c2ecf20Sopenharmony_ci}; 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_cistatic void exynos5250_pmu_init(void) 1398c2ecf20Sopenharmony_ci{ 1408c2ecf20Sopenharmony_ci unsigned int value; 1418c2ecf20Sopenharmony_ci /* 1428c2ecf20Sopenharmony_ci * When SYS_WDTRESET is set, watchdog timer reset request 1438c2ecf20Sopenharmony_ci * is ignored by power management unit. 1448c2ecf20Sopenharmony_ci */ 1458c2ecf20Sopenharmony_ci value = pmu_raw_readl(EXYNOS5_AUTO_WDTRESET_DISABLE); 1468c2ecf20Sopenharmony_ci value &= ~EXYNOS5_SYS_WDTRESET; 1478c2ecf20Sopenharmony_ci pmu_raw_writel(value, EXYNOS5_AUTO_WDTRESET_DISABLE); 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci value = pmu_raw_readl(EXYNOS5_MASK_WDTRESET_REQUEST); 1508c2ecf20Sopenharmony_ci value &= ~EXYNOS5_SYS_WDTRESET; 1518c2ecf20Sopenharmony_ci pmu_raw_writel(value, EXYNOS5_MASK_WDTRESET_REQUEST); 1528c2ecf20Sopenharmony_ci} 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_cistatic void exynos5_powerdown_conf(enum sys_powerdown mode) 1558c2ecf20Sopenharmony_ci{ 1568c2ecf20Sopenharmony_ci unsigned int i; 1578c2ecf20Sopenharmony_ci unsigned int tmp; 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci /* 1608c2ecf20Sopenharmony_ci * Enable both SC_FEEDBACK and SC_COUNTER 1618c2ecf20Sopenharmony_ci */ 1628c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(exynos5_list_both_cnt_feed); i++) { 1638c2ecf20Sopenharmony_ci tmp = pmu_raw_readl(exynos5_list_both_cnt_feed[i]); 1648c2ecf20Sopenharmony_ci tmp |= (EXYNOS5_USE_SC_FEEDBACK | 1658c2ecf20Sopenharmony_ci EXYNOS5_USE_SC_COUNTER); 1668c2ecf20Sopenharmony_ci pmu_raw_writel(tmp, exynos5_list_both_cnt_feed[i]); 1678c2ecf20Sopenharmony_ci } 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci /* 1708c2ecf20Sopenharmony_ci * SKIP_DEACTIVATE_ACEACP_IN_PWDN_BITFIELD Enable 1718c2ecf20Sopenharmony_ci */ 1728c2ecf20Sopenharmony_ci tmp = pmu_raw_readl(EXYNOS5_ARM_COMMON_OPTION); 1738c2ecf20Sopenharmony_ci tmp |= EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN; 1748c2ecf20Sopenharmony_ci pmu_raw_writel(tmp, EXYNOS5_ARM_COMMON_OPTION); 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci /* 1778c2ecf20Sopenharmony_ci * Disable WFI/WFE on XXX_OPTION 1788c2ecf20Sopenharmony_ci */ 1798c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(exynos5_list_disable_wfi_wfe); i++) { 1808c2ecf20Sopenharmony_ci tmp = pmu_raw_readl(exynos5_list_disable_wfi_wfe[i]); 1818c2ecf20Sopenharmony_ci tmp &= ~(EXYNOS5_OPTION_USE_STANDBYWFE | 1828c2ecf20Sopenharmony_ci EXYNOS5_OPTION_USE_STANDBYWFI); 1838c2ecf20Sopenharmony_ci pmu_raw_writel(tmp, exynos5_list_disable_wfi_wfe[i]); 1848c2ecf20Sopenharmony_ci } 1858c2ecf20Sopenharmony_ci} 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ciconst struct exynos_pmu_data exynos5250_pmu_data = { 1888c2ecf20Sopenharmony_ci .pmu_config = exynos5250_pmu_config, 1898c2ecf20Sopenharmony_ci .pmu_init = exynos5250_pmu_init, 1908c2ecf20Sopenharmony_ci .powerdown_conf = exynos5_powerdown_conf, 1918c2ecf20Sopenharmony_ci}; 192