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