106512c53SKrzysztof Kozlowski // SPDX-License-Identifier: GPL-2.0 206512c53SKrzysztof Kozlowski // 306512c53SKrzysztof Kozlowski // Copyright (c) 2011-2015 Samsung Electronics Co., Ltd. 406512c53SKrzysztof Kozlowski // http://www.samsung.com/ 506512c53SKrzysztof Kozlowski // 6*94500540SKrzysztof Kozlowski // Exynos3250 - CPU PMU (Power Management Unit) support 7bfce552dSPankaj Dubey 8bfce552dSPankaj Dubey #include <linux/soc/samsung/exynos-regs-pmu.h> 9bfce552dSPankaj Dubey #include <linux/soc/samsung/exynos-pmu.h> 10bfce552dSPankaj Dubey 11bfce552dSPankaj Dubey #include "exynos-pmu.h" 12bfce552dSPankaj Dubey 13aec6341eSKrzysztof Kozlowski static const struct exynos_pmu_conf exynos3250_pmu_config[] = { 14bfce552dSPankaj Dubey /* { .offset = offset, .val = { AFTR, W-AFTR, SLEEP } */ 15bfce552dSPankaj Dubey { EXYNOS3_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 16bfce552dSPankaj Dubey { EXYNOS3_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 17bfce552dSPankaj Dubey { EXYNOS3_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 18bfce552dSPankaj Dubey { EXYNOS3_ARM_CORE1_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 19bfce552dSPankaj Dubey { EXYNOS3_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 20bfce552dSPankaj Dubey { EXYNOS3_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 21bfce552dSPankaj Dubey { EXYNOS3_ISP_ARM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 22bfce552dSPankaj Dubey { EXYNOS3_DIS_IRQ_ISP_ARM_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 23bfce552dSPankaj Dubey { EXYNOS3_DIS_IRQ_ISP_ARM_CENTRAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 24bfce552dSPankaj Dubey { EXYNOS3_ARM_COMMON_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 25bfce552dSPankaj Dubey { EXYNOS3_ARM_L2_SYS_PWR_REG, { 0x0, 0x0, 0x3} }, 26bfce552dSPankaj Dubey { EXYNOS3_CMU_ACLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 27bfce552dSPankaj Dubey { EXYNOS3_CMU_SCLKSTOP_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 28bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 29bfce552dSPankaj Dubey { EXYNOS3_DRAM_FREQ_DOWN_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 30bfce552dSPankaj Dubey { EXYNOS3_DDRPHY_DLLOFF_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 31bfce552dSPankaj Dubey { EXYNOS3_LPDDR_PHY_DLL_LOCK_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 32bfce552dSPankaj Dubey { EXYNOS3_CMU_ACLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 33bfce552dSPankaj Dubey { EXYNOS3_CMU_SCLKSTOP_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 34bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 35bfce552dSPankaj Dubey { EXYNOS3_APLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 36bfce552dSPankaj Dubey { EXYNOS3_MPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 37bfce552dSPankaj Dubey { EXYNOS3_BPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 38bfce552dSPankaj Dubey { EXYNOS3_VPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 39bfce552dSPankaj Dubey { EXYNOS3_EPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 40bfce552dSPankaj Dubey { EXYNOS3_UPLL_SYSCLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 41bfce552dSPankaj Dubey { EXYNOS3_EPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 42bfce552dSPankaj Dubey { EXYNOS3_MPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 43bfce552dSPankaj Dubey { EXYNOS3_BPLLUSER_SYSCLK_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 44bfce552dSPankaj Dubey { EXYNOS3_CMU_CLKSTOP_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 45bfce552dSPankaj Dubey { EXYNOS3_CMU_CLKSTOP_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 46bfce552dSPankaj Dubey { EXYNOS3_CMU_CLKSTOP_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 47bfce552dSPankaj Dubey { EXYNOS3_CMU_CLKSTOP_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 48bfce552dSPankaj Dubey { EXYNOS3_CMU_CLKSTOP_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 49bfce552dSPankaj Dubey { EXYNOS3_CMU_CLKSTOP_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 50bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_CAM_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 51bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_MFC_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 52bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_G3D_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 53bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_LCD0_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 54bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 55bfce552dSPankaj Dubey { EXYNOS3_CMU_RESET_MAUDIO_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 56bfce552dSPankaj Dubey { EXYNOS3_TOP_BUS_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 57bfce552dSPankaj Dubey { EXYNOS3_TOP_RETENTION_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 58bfce552dSPankaj Dubey { EXYNOS3_TOP_PWR_SYS_PWR_REG, { 0x3, 0x3, 0x3} }, 59bfce552dSPankaj Dubey { EXYNOS3_TOP_BUS_COREBLK_SYS_PWR_REG, { 0x3, 0x0, 0x0} }, 60bfce552dSPankaj Dubey { EXYNOS3_TOP_RETENTION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 61bfce552dSPankaj Dubey { EXYNOS3_TOP_PWR_COREBLK_SYS_PWR_REG, { 0x3, 0x3, 0x3} }, 62bfce552dSPankaj Dubey { EXYNOS3_LOGIC_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 63bfce552dSPankaj Dubey { EXYNOS3_OSCCLK_GATE_SYS_PWR_REG, { 0x1, 0x1, 0x1} }, 64bfce552dSPankaj Dubey { EXYNOS3_LOGIC_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 65bfce552dSPankaj Dubey { EXYNOS3_OSCCLK_GATE_COREBLK_SYS_PWR_REG, { 0x1, 0x0, 0x1} }, 66bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_DRAM_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 67bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 68bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_GPIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 69bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_UART_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 70bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_MMC0_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 71bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_MMC1_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 72bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_MMC2_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 73bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_SPI_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 74bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_EBIA_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 75bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_EBIB_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 76bfce552dSPankaj Dubey { EXYNOS3_PAD_RETENTION_JTAG_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 77bfce552dSPankaj Dubey { EXYNOS3_PAD_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 78bfce552dSPankaj Dubey { EXYNOS3_PAD_ALV_SEL_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 79bfce552dSPankaj Dubey { EXYNOS3_XUSBXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 80bfce552dSPankaj Dubey { EXYNOS3_XXTI_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 81bfce552dSPankaj Dubey { EXYNOS3_EXT_REGULATOR_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 82bfce552dSPankaj Dubey { EXYNOS3_EXT_REGULATOR_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 83bfce552dSPankaj Dubey { EXYNOS3_GPIO_MODE_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 84bfce552dSPankaj Dubey { EXYNOS3_GPIO_MODE_MAUDIO_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 85bfce552dSPankaj Dubey { EXYNOS3_TOP_ASB_RESET_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 86bfce552dSPankaj Dubey { EXYNOS3_TOP_ASB_ISOLATION_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 87bfce552dSPankaj Dubey { EXYNOS3_TOP_ASB_RESET_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 88bfce552dSPankaj Dubey { EXYNOS3_TOP_ASB_ISOLATION_COREBLK_SYS_PWR_REG, { 0x1, 0x1, 0x0} }, 89bfce552dSPankaj Dubey { EXYNOS3_CAM_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 90bfce552dSPankaj Dubey { EXYNOS3_MFC_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 91bfce552dSPankaj Dubey { EXYNOS3_G3D_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 92bfce552dSPankaj Dubey { EXYNOS3_LCD0_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 93bfce552dSPankaj Dubey { EXYNOS3_ISP_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 94bfce552dSPankaj Dubey { EXYNOS3_MAUDIO_SYS_PWR_REG, { 0x7, 0x0, 0x0} }, 95bfce552dSPankaj Dubey { EXYNOS3_CMU_SYSCLK_ISP_SYS_PWR_REG, { 0x1, 0x0, 0x0} }, 96bfce552dSPankaj Dubey { PMU_TABLE_END,}, 97bfce552dSPankaj Dubey }; 98bfce552dSPankaj Dubey 99bfce552dSPankaj Dubey static unsigned int const exynos3250_list_feed[] = { 100bfce552dSPankaj Dubey EXYNOS3_ARM_CORE_OPTION(0), 101bfce552dSPankaj Dubey EXYNOS3_ARM_CORE_OPTION(1), 102bfce552dSPankaj Dubey EXYNOS3_ARM_CORE_OPTION(2), 103bfce552dSPankaj Dubey EXYNOS3_ARM_CORE_OPTION(3), 104bfce552dSPankaj Dubey EXYNOS3_ARM_COMMON_OPTION, 105bfce552dSPankaj Dubey EXYNOS3_TOP_PWR_OPTION, 106bfce552dSPankaj Dubey EXYNOS3_CORE_TOP_PWR_OPTION, 107bfce552dSPankaj Dubey S5P_CAM_OPTION, 108bfce552dSPankaj Dubey S5P_MFC_OPTION, 109bfce552dSPankaj Dubey S5P_G3D_OPTION, 110bfce552dSPankaj Dubey S5P_LCD0_OPTION, 111bfce552dSPankaj Dubey S5P_ISP_OPTION, 112bfce552dSPankaj Dubey }; 113bfce552dSPankaj Dubey 114bfce552dSPankaj Dubey static void exynos3250_powerdown_conf_extra(enum sys_powerdown mode) 115bfce552dSPankaj Dubey { 116bfce552dSPankaj Dubey unsigned int i; 117bfce552dSPankaj Dubey unsigned int tmp; 118bfce552dSPankaj Dubey 119bfce552dSPankaj Dubey /* Enable only SC_FEEDBACK */ 120bfce552dSPankaj Dubey for (i = 0; i < ARRAY_SIZE(exynos3250_list_feed); i++) { 121bfce552dSPankaj Dubey tmp = pmu_raw_readl(exynos3250_list_feed[i]); 122bfce552dSPankaj Dubey tmp &= ~(EXYNOS3_OPTION_USE_SC_COUNTER); 123bfce552dSPankaj Dubey tmp |= EXYNOS3_OPTION_USE_SC_FEEDBACK; 124bfce552dSPankaj Dubey pmu_raw_writel(tmp, exynos3250_list_feed[i]); 125bfce552dSPankaj Dubey } 126bfce552dSPankaj Dubey 127bfce552dSPankaj Dubey if (mode != SYS_SLEEP) 128bfce552dSPankaj Dubey return; 129bfce552dSPankaj Dubey 130bfce552dSPankaj Dubey pmu_raw_writel(XUSBXTI_DURATION, EXYNOS3_XUSBXTI_DURATION); 131bfce552dSPankaj Dubey pmu_raw_writel(XXTI_DURATION, EXYNOS3_XXTI_DURATION); 132bfce552dSPankaj Dubey pmu_raw_writel(EXT_REGULATOR_DURATION, EXYNOS3_EXT_REGULATOR_DURATION); 133bfce552dSPankaj Dubey pmu_raw_writel(EXT_REGULATOR_COREBLK_DURATION, 134bfce552dSPankaj Dubey EXYNOS3_EXT_REGULATOR_COREBLK_DURATION); 135bfce552dSPankaj Dubey } 136bfce552dSPankaj Dubey 137bfce552dSPankaj Dubey static void exynos3250_pmu_init(void) 138bfce552dSPankaj Dubey { 139bfce552dSPankaj Dubey unsigned int value; 140bfce552dSPankaj Dubey 141bfce552dSPankaj Dubey /* 142bfce552dSPankaj Dubey * To prevent from issuing new bus request form L2 memory system 143bfce552dSPankaj Dubey * If core status is power down, should be set '1' to L2 power down 144bfce552dSPankaj Dubey */ 145bfce552dSPankaj Dubey value = pmu_raw_readl(EXYNOS3_ARM_COMMON_OPTION); 146bfce552dSPankaj Dubey value |= EXYNOS3_OPTION_SKIP_DEACTIVATE_ACEACP_IN_PWDN; 147bfce552dSPankaj Dubey pmu_raw_writel(value, EXYNOS3_ARM_COMMON_OPTION); 148bfce552dSPankaj Dubey 149bfce552dSPankaj Dubey /* Enable USE_STANDBY_WFI for all CORE */ 150bfce552dSPankaj Dubey pmu_raw_writel(S5P_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION); 151bfce552dSPankaj Dubey 152bfce552dSPankaj Dubey /* 153bfce552dSPankaj Dubey * Set PSHOLD port for output high 154bfce552dSPankaj Dubey */ 155bfce552dSPankaj Dubey value = pmu_raw_readl(S5P_PS_HOLD_CONTROL); 156bfce552dSPankaj Dubey value |= S5P_PS_HOLD_OUTPUT_HIGH; 157bfce552dSPankaj Dubey pmu_raw_writel(value, S5P_PS_HOLD_CONTROL); 158bfce552dSPankaj Dubey 159bfce552dSPankaj Dubey /* 160bfce552dSPankaj Dubey * Enable signal for PSHOLD port 161bfce552dSPankaj Dubey */ 162bfce552dSPankaj Dubey value = pmu_raw_readl(S5P_PS_HOLD_CONTROL); 163bfce552dSPankaj Dubey value |= S5P_PS_HOLD_EN; 164bfce552dSPankaj Dubey pmu_raw_writel(value, S5P_PS_HOLD_CONTROL); 165bfce552dSPankaj Dubey } 166bfce552dSPankaj Dubey 167bfce552dSPankaj Dubey const struct exynos_pmu_data exynos3250_pmu_data = { 168bfce552dSPankaj Dubey .pmu_config = exynos3250_pmu_config, 169bfce552dSPankaj Dubey .pmu_init = exynos3250_pmu_init, 170bfce552dSPankaj Dubey .powerdown_conf_extra = exynos3250_powerdown_conf_extra, 171bfce552dSPankaj Dubey }; 172