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// Exynos3250 - 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 exynos3250_pmu_config[] = { 148c2ecf20Sopenharmony_ci /* { .offset = offset, .val = { AFTR, W-AFTR, SLEEP } */ 158c2ecf20Sopenharmony_ci { EXYNOS3_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 168c2ecf20Sopenharmony_ci { EXYNOS3_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 178c2ecf20Sopenharmony_ci { EXYNOS3_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 188c2ecf20Sopenharmony_ci { EXYNOS3_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 198c2ecf20Sopenharmony_ci { EXYNOS3_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 208c2ecf20Sopenharmony_ci { EXYNOS3_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 218c2ecf20Sopenharmony_ci { EXYNOS3_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 228c2ecf20Sopenharmony_ci { EXYNOS3_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 238c2ecf20Sopenharmony_ci { EXYNOS3_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 248c2ecf20Sopenharmony_ci { EXYNOS3_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 258c2ecf20Sopenharmony_ci { EXYNOS3_ARM_L2_SYS_PWR_REG, { 0x0, 0x0, 0x3} }, 268c2ecf20Sopenharmony_ci { EXYNOS3_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 278c2ecf20Sopenharmony_ci { EXYNOS3_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 288c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 298c2ecf20Sopenharmony_ci { EXYNOS3_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 308c2ecf20Sopenharmony_ci { EXYNOS3_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 318c2ecf20Sopenharmony_ci { EXYNOS3_LPDDR_PHY_DLL_LOCK_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 328c2ecf20Sopenharmony_ci { EXYNOS3_CMU_ACLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 338c2ecf20Sopenharmony_ci { EXYNOS3_CMU_SCLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 348c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 358c2ecf20Sopenharmony_ci { EXYNOS3_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 368c2ecf20Sopenharmony_ci { EXYNOS3_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 378c2ecf20Sopenharmony_ci { EXYNOS3_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 388c2ecf20Sopenharmony_ci { EXYNOS3_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 398c2ecf20Sopenharmony_ci { EXYNOS3_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 408c2ecf20Sopenharmony_ci { EXYNOS3_UPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 418c2ecf20Sopenharmony_ci { EXYNOS3_EPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 428c2ecf20Sopenharmony_ci { EXYNOS3_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 438c2ecf20Sopenharmony_ci { EXYNOS3_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 448c2ecf20Sopenharmony_ci { EXYNOS3_CMU_CLKSTOP_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 458c2ecf20Sopenharmony_ci { EXYNOS3_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 468c2ecf20Sopenharmony_ci { EXYNOS3_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 478c2ecf20Sopenharmony_ci { EXYNOS3_CMU_CLKSTOP_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 488c2ecf20Sopenharmony_ci { EXYNOS3_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 498c2ecf20Sopenharmony_ci { EXYNOS3_CMU_CLKSTOP_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 508c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 518c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 528c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 538c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 548c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 558c2ecf20Sopenharmony_ci { EXYNOS3_CMU_RESET_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 568c2ecf20Sopenharmony_ci { EXYNOS3_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 578c2ecf20Sopenharmony_ci { EXYNOS3_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 588c2ecf20Sopenharmony_ci { EXYNOS3_TOP_PWR_SYS_PWR_REG, { 0x3, 0x3, 0x3} }, 598c2ecf20Sopenharmony_ci { EXYNOS3_TOP_BUS_COREBLK_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 608c2ecf20Sopenharmony_ci { EXYNOS3_TOP_RETENTION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 618c2ecf20Sopenharmony_ci { EXYNOS3_TOP_PWR_COREBLK_SYS_PWR_REG, { 0x3, 0x3, 0x3} }, 628c2ecf20Sopenharmony_ci { EXYNOS3_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 638c2ecf20Sopenharmony_ci { EXYNOS3_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 648c2ecf20Sopenharmony_ci { EXYNOS3_LOGIC_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 658c2ecf20Sopenharmony_ci { EXYNOS3_OSCCLK_GATE_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 668c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 678c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 688c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_GPIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 698c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 708c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_MMC0_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 718c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_MMC1_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 728c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_MMC2_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 738c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 748c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 758c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 768c2ecf20Sopenharmony_ci { EXYNOS3_PAD_RETENTION_JTAG_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 778c2ecf20Sopenharmony_ci { EXYNOS3_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 788c2ecf20Sopenharmony_ci { EXYNOS3_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 798c2ecf20Sopenharmony_ci { EXYNOS3_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 808c2ecf20Sopenharmony_ci { EXYNOS3_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 818c2ecf20Sopenharmony_ci { EXYNOS3_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 828c2ecf20Sopenharmony_ci { EXYNOS3_EXT_REGULATOR_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 838c2ecf20Sopenharmony_ci { EXYNOS3_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 848c2ecf20Sopenharmony_ci { EXYNOS3_GPIO_MODE_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 858c2ecf20Sopenharmony_ci { EXYNOS3_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 868c2ecf20Sopenharmony_ci { EXYNOS3_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 878c2ecf20Sopenharmony_ci { EXYNOS3_TOP_ASB_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 888c2ecf20Sopenharmony_ci { EXYNOS3_TOP_ASB_ISOLATION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 898c2ecf20Sopenharmony_ci { EXYNOS3_CAM_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 908c2ecf20Sopenharmony_ci { EXYNOS3_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 918c2ecf20Sopenharmony_ci { EXYNOS3_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 928c2ecf20Sopenharmony_ci { EXYNOS3_LCD0_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 938c2ecf20Sopenharmony_ci { EXYNOS3_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 948c2ecf20Sopenharmony_ci { EXYNOS3_MAUDIO_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 958c2ecf20Sopenharmony_ci { EXYNOS3_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 968c2ecf20Sopenharmony_ci { PMU_TABLE_END,}, 978c2ecf20Sopenharmony_ci}; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_cistatic unsigned int const exynos3250_list_feed[] = { 1008c2ecf20Sopenharmony_ci EXYNOS3_ARM_CORE_OPTION(0), 1018c2ecf20Sopenharmony_ci EXYNOS3_ARM_CORE_OPTION(1), 1028c2ecf20Sopenharmony_ci EXYNOS3_ARM_CORE_OPTION(2), 1038c2ecf20Sopenharmony_ci EXYNOS3_ARM_CORE_OPTION(3), 1048c2ecf20Sopenharmony_ci EXYNOS3_ARM_COMMON_OPTION, 1058c2ecf20Sopenharmony_ci EXYNOS3_TOP_PWR_OPTION, 1068c2ecf20Sopenharmony_ci EXYNOS3_CORE_TOP_PWR_OPTION, 1078c2ecf20Sopenharmony_ci S5P_CAM_OPTION, 1088c2ecf20Sopenharmony_ci S5P_MFC_OPTION, 1098c2ecf20Sopenharmony_ci S5P_G3D_OPTION, 1108c2ecf20Sopenharmony_ci S5P_LCD0_OPTION, 1118c2ecf20Sopenharmony_ci S5P_ISP_OPTION, 1128c2ecf20Sopenharmony_ci}; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_cistatic void exynos3250_powerdown_conf_extra(enum sys_powerdown mode) 1158c2ecf20Sopenharmony_ci{ 1168c2ecf20Sopenharmony_ci unsigned int i; 1178c2ecf20Sopenharmony_ci unsigned int tmp; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci /* Enable only SC_FEEDBACK */ 1208c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(exynos3250_list_feed); i++) { 1218c2ecf20Sopenharmony_ci tmp = pmu_raw_readl(exynos3250_list_feed[i]); 1228c2ecf20Sopenharmony_ci tmp &= ~(EXYNOS3_OPTION_USE_SC_COUNTER); 1238c2ecf20Sopenharmony_ci tmp |= EXYNOS3_OPTION_USE_SC_FEEDBACK; 1248c2ecf20Sopenharmony_ci pmu_raw_writel(tmp, exynos3250_list_feed[i]); 1258c2ecf20Sopenharmony_ci } 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci if (mode != SYS_SLEEP) 1288c2ecf20Sopenharmony_ci return; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci pmu_raw_writel(XUSBXTI_DURATION, EXYNOS3_XUSBXTI_DURATION); 1318c2ecf20Sopenharmony_ci pmu_raw_writel(XXTI_DURATION, EXYNOS3_XXTI_DURATION); 1328c2ecf20Sopenharmony_ci pmu_raw_writel(EXT_REGULATOR_DURATION, EXYNOS3_EXT_REGULATOR_DURATION); 1338c2ecf20Sopenharmony_ci pmu_raw_writel(EXT_REGULATOR_COREBLK_DURATION, 1348c2ecf20Sopenharmony_ci EXYNOS3_EXT_REGULATOR_COREBLK_DURATION); 1358c2ecf20Sopenharmony_ci} 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_cistatic void exynos3250_pmu_init(void) 1388c2ecf20Sopenharmony_ci{ 1398c2ecf20Sopenharmony_ci unsigned int value; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci /* 1428c2ecf20Sopenharmony_ci * To prevent from issuing new bus request form L2 memory system 1438c2ecf20Sopenharmony_ci * If core status is power down, should be set '1' to L2 power down 1448c2ecf20Sopenharmony_ci */ 1458c2ecf20Sopenharmony_ci value = pmu_raw_readl(EXYNOS3_ARM_COMMON_OPTION); 1468c2ecf20Sopenharmony_ci value |= EXYNOS3_OPTION_SKIP_DEACTIVATE_ACEACP_IN_PWDN; 1478c2ecf20Sopenharmony_ci pmu_raw_writel(value, EXYNOS3_ARM_COMMON_OPTION); 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci /* Enable USE_STANDBY_WFI for all CORE */ 1508c2ecf20Sopenharmony_ci pmu_raw_writel(S5P_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION); 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci /* 1538c2ecf20Sopenharmony_ci * Set PSHOLD port for output high 1548c2ecf20Sopenharmony_ci */ 1558c2ecf20Sopenharmony_ci value = pmu_raw_readl(S5P_PS_HOLD_CONTROL); 1568c2ecf20Sopenharmony_ci value |= S5P_PS_HOLD_OUTPUT_HIGH; 1578c2ecf20Sopenharmony_ci pmu_raw_writel(value, S5P_PS_HOLD_CONTROL); 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci /* 1608c2ecf20Sopenharmony_ci * Enable signal for PSHOLD port 1618c2ecf20Sopenharmony_ci */ 1628c2ecf20Sopenharmony_ci value = pmu_raw_readl(S5P_PS_HOLD_CONTROL); 1638c2ecf20Sopenharmony_ci value |= S5P_PS_HOLD_EN; 1648c2ecf20Sopenharmony_ci pmu_raw_writel(value, S5P_PS_HOLD_CONTROL); 1658c2ecf20Sopenharmony_ci} 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ciconst struct exynos_pmu_data exynos3250_pmu_data = { 1688c2ecf20Sopenharmony_ci .pmu_config = exynos3250_pmu_config, 1698c2ecf20Sopenharmony_ci .pmu_init = exynos3250_pmu_init, 1708c2ecf20Sopenharmony_ci .powerdown_conf_extra = exynos3250_powerdown_conf_extra, 1718c2ecf20Sopenharmony_ci}; 172