Adds PMU and S2R support for exynos5420
v7 cover Adds PMU and S2R support for exynos5420
Rebased on
1] Kukjin Kim's tree, master branch
http://git.kernel.org/cgit/linux/kernel/git/kgene/linux-samsung.git/log/
2] Pankaj Dubey's v7 PMU patchset
https://lkml.org/lkml/2014/7/9/2
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/270655.html
3] My pm.c refactoring patchset
http://www.spinics.net/lists/linux-samsung-soc/msg35740.html
changes since v6:
- rebased on 3.17.rc1.
changes since v5:
- Refactored pm.c to use DT based lookup as suggested by Tomasz Figa.
changes since v4:
- Adressed comments from Tomasz figa and rebased on Pankaj Dubey's v5 PMU patchset
changes since v3:
Addressed the following comments from Pankaj Dubey, Bartlomiej Zolnierkiewicz, Tomasz Figa and Alim Akhtar:
- Moved EXYNOS5420_USE_STANDBY_WFI_ALL define to regs-pmu.h.
- Merged exynos5420_set_core_flag function into powerdown_conf.
- Removed XXTI_DURATION3 register setting.
- Updated the commit message and ordered the clock registers in clock patch.
- Removed the code for SYS_DISP1_BLK_CFG handling.
- Modified SoC checks to A9 specific checks in PM code.
- Updated some comments in the code and added macros for register offsets.
- Fixed code which was changing pad retention code for older SoCs.
changes since v2:
- Addressed comments from Tomasz figa
- rebased on Pankaj's V3 patchset https://lkml.org/lkml/2014/5/2/612
- dropped patch "ARM: dts: Add node for GPIO keys on SMDK5420", will be sent separately.
changes since v1:
- Addressed comments from Tomasz figa.
- restructured/consolidated as per Tomasz figa's PM consolidations for exynos
Tested on Kukjin Kim's tree, master branch + http://www.spinics.net/lists/linux-samsung-soc/msg33750.html
on Exynos5420 based chromebook (peach-pit board)
PS : Not tested on exynos4 based boards.
Tested-by for exynos4 would be appreciated.
Below procedures were followed to test S2R:
Procedure A:
1. make multi_v7_defconfig
2 enable MCPM for 5420
3. enable S3C RTC
4. pass "no_console_suspend" in bootargs
5. echo +20 > /sys/class/rtc/rtc0/wakealarm && echo mem > /sys/power/state
Procedure B:
1. make exynos_defconfig
2 disable BL_SWITCHER
3. pass "no_console_suspend" in bootargs
4. echo +20 > /sys/class/rtc/rtc0/wakealarm && echo mem > /sys/power/state
Abhilash Kesavan (2):
ARM: exynos5: Add PMU support for 5420
ARM: exynos5: Add Suspend-to-RAM support for 5420
arch/arm/mach-exynos/pm.c | 149 +++++++++++++++++++- arch/arm/mach-exynos/pmu.c | 288 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-exynos/regs-pmu.h | 229 +++++++++++++++++++++++++++++++ 3 files changed, 665 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
PATCH v7 1/2 ARM: exynos5: Add PMU support for 5420
From: Abhilash Kesavan <[email protected]>
Add intial PMU settings for exynos5420. This is required for future S2R and Switching support.
--- arch/arm/mach-exynos/pmu.c | 288 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-exynos/regs-pmu.h | 229 +++++++++++++++++++++++++++++++ 2 files changed, 517 insertions(+)
arch/arm/mach-exynos/pmu.c +288 -0
@@ -14,6 +14,9 @@#include <linux/platform_device.h> #include <linux/regmap.h> #include <linux/mfd/syscon.h> +#include <linux/delay.h> + +#include <asm/cputype.h> #include "exynos-pmu.h" #include "regs-pmu.h"
@@ -350,6 +353,151 @@ static const struct exynos_pmu_conf exynos5250_pmu_config[] = { { PMU_TABLE_END,}, }; +static struct exynos_pmu_conf exynos5420_pmu_config[] = { +/* { .offset = offset, .val = { AFTR, LPA, SLEEP } */ + {EXYNOS5_ARM_CORE0_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_DIS_IRQ_ARM_CORE0_CENTRAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_ARM_CORE1_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_DIS_IRQ_ARM_CORE1_LOCAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_DIS_IRQ_ARM_CORE1_CENTRAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_ARM_CORE2_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_ARM_CORE2_LOCAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_ARM_CORE2_CENTRAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_ARM_CORE3_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_ARM_CORE3_LOCAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_ARM_CORE3_CENTRAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_KFC_CORE0_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_KFC_CORE0_LOCAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_KFC_CORE0_CENTRAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_KFC_CORE1_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_KFC_CORE1_LOCAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_KFC_CORE1_CENTRAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_KFC_CORE2_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_KFC_CORE2_LOCAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_DIS_IRQ_KFC_CORE2_CENTRAL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_KFC_CORE3_SYS_PWR_REG , {0x0 ,0x0 ,0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GIC_RESET_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_OSCCLK_GATE_SYS_PWR_REG , {0x1 ,0x0 ,0x1 } }, + {EXYNOS5_LOGIC_RESET_SYSMEM_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5_OSCCLK_GATE_SYSMEM_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_INTRAM_MEM_SYS_PWR_REG , {0x3 ,0x0 ,0x3 } }, + {EXYNOS5420_INTROM_MEM_SYS_PWR_REG , {0x3 ,0x0 ,0x3 } }, + {EXYNOS5_PAD_RETENTION_DRAM_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5_PAD_RETENTION_MAU_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_JTAG_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_DRAM_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_UART_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_MMC0_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_MMC1_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_MMC2_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_HSI_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_EBIA_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_EBIB_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_SPI_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5420_PAD_RETENTION_DRAM_COREBLK_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5_PAD_ISOLATION_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_PAD_ISOLATION_SYSMEM_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5_PAD_ALV_SEL_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5_XUSBXTI_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_XXTI_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_EXT_REGULATOR_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_GPIO_MODE_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5_GPIO_MODE_SYSMEM_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_GPIO_MODE_MAU_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_TOP_ASB_RESET_SYS_PWR_REG , {0x1 ,0x1 ,0x0 } }, + {EXYNOS5_TOP_ASB_ISOLATION_SYS_PWR_REG , {0x1 ,0x0 ,0x0 } }, + {EXYNOS5_GSCL_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {EXYNOS5_ISP_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {EXYNOS5_MFC_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {EXYNOS5_G3D_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {EXYNOS5420_DISP1_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {EXYNOS5420_MAU_SYS_PWR_REG , {0x7 ,0x7 ,0x0 } }, + {EXYNOS5420_G2D_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {EXYNOS5420_MSC_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {EXYNOS5420_FSYS_SYS_PWR_REG , {0x7 ,0x0 ,0x0 } }, + {E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SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_CMU_RESET_MFC_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG , {0x0 ,0x0 ,0x0 } }, + {PMU_TABLE_END ,}, +}; +static unsigned int const exynos5_list_both_cnt_feed[] = {EXYNOS5_ARM_CORE0_OPTION ,EXYNOS5_ARM_CORE1_OPTION ,
@@ -370,6 +518,75 @@ static unsigned int const exynos5_list_diable_wfi_wfe[] = { EXYNOS5_ISP_ARM_OPTION, }; +static unsigned int const exynos5420_list_disable_pmu_reg[] = { +EXYNOS5_CMU_CLKSTOP_GSCL_SYS_PWR_REG , +EXYNOS5_CMU_CLKSTOP_ISP_SYS_PWR_REG , +EXYNOS5_CMU_CLKSTOP_G3D_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_DISP1_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_MAU_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_G2D_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_MSC_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_FSYS_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_PSGEN_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_PERIC_SYS_PWR_REG , +EXYNOS5420_CMU_CLKSTOP_WCORE_SYS_PWR_REG , +EXYNOS5_CMU_SYSCLK_GSCL_SYS_PWR_REG , +EXYNOS5_CMU_SYSCLK_ISP_SYS_PWR_REG , +EXYNOS5_CMU_SYSCLK_G3D_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_DISP1_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_MAU_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_G2D_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_MSC_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_FSYS_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_FSYS2_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_PSGEN_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_PERIC_SYS_PWR_REG , +EXYNOS5420_CMU_SYSCLK_WCORE_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_FSYS2_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_PSGEN_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_PERIC_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_WCORE_SYS_PWR_REG , +EXYNOS5_CMU_RESET_GSCL_SYS_PWR_REG , +EXYNOS5_CMU_RESET_ISP_SYS_PWR_REG , +EXYNOS5_CMU_RESET_G3D_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_DISP1_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_MAU_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_G2D_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_MSC_SYS_PWR_REG , +EXYNOS5420_CMU_RESET_FSYS_SYS_PWR_REG , +}; + +static void exynos5_power_off (void ) +{ +unsigned int tmp; + +pr_info ("Power down.\n" ); + tmp =pmu_raw_readl (EXYNOS_PS_HOLD_CONTROL ); + tmp ^= (1 <<8 ); +pmu_raw_writel (tmp,EXYNOS_PS_HOLD_CONTROL ); + +/* Wait a little so we don't give a false warning below */ +mdelay (100 ); + +pr_err ("Power down failed, please power off system manually.\n" ); +while (1 ) + ; +} + +void exynos5420_powerdown_conf (enum sys_powerdown mode) +{ +u32 this_cluster; + + this_cluster =MPIDR_AFFINITY_LEVEL (read_cpuid_mpidr (),1 ); + +/* +* set the cluster id to IROM register to ensure that we wake +* up with the current cluster. +*/ +pmu_raw_writel (this_cluster,EXYNOS_IROM_DATA2 ); +} + +static void exynos5_powerdown_conf (enum sys_powerdown mode) {unsigned int i;
@@ -441,6 +658,68 @@ static void exynos5250_pmu_init(void)pmu_raw_writel (value,EXYNOS5_MASK_WDTRESET_REQUEST ); } +static void exynos5420_pmu_init (void ) +{ +unsigned int value; +int i; + +/* +* Set the CMU_RESET, CMU_SYSCLK and CMU_CLKSTOP registers +* for local power blocks to Low initially as per Table 8-4: +* "System-Level Power-Down Configuration Registers". +*/ +for (i =0 ; i <ARRAY_SIZE (exynos5420_list_disable_pmu_reg); i++) +pmu_raw_writel (0 , exynos5420_list_disable_pmu_reg[i]); + +/* Enable USE_STANDBY_WFI for all CORE */ +pmu_raw_writel (EXYNOS5420_USE_STANDBY_WFI_ALL ,S5P_CENTRAL_SEQ_OPTION ); + + value =pmu_raw_readl (EXYNOS_L2_OPTION (0 )); + value &= ~EXYNOS5_USE_RETENTION ; +pmu_raw_writel (value,EXYNOS_L2_OPTION (0 )); + + value =pmu_raw_readl (EXYNOS_L2_OPTION (1 )); + value &= ~EXYNOS5_USE_RETENTION ; +pmu_raw_writel (value,EXYNOS_L2_OPTION (1 )); + +/* +* If L2_COMMON is turned off, clocks related to ATB async +* bridge are gated. Thus, when ISP power is gated, LPI +* may get stuck. +*/ + value =pmu_raw_readl (EXYNOS5420_LPI_MASK ); + value |=EXYNOS5420_ATB_ISP_ARM ; +pmu_raw_writel (value,EXYNOS5420_LPI_MASK ); + + value =pmu_raw_readl (EXYNOS5420_LPI_MASK1 ); + value |=EXYNOS5420_ATB_KFC ; +pmu_raw_writel (value,EXYNOS5420_LPI_MASK1 ); + +/* Prevent issue of new bus request from L2 memory */ + value =pmu_raw_readl (EXYNOS5420_ARM_COMMON_OPTION ); + value |=EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN ; +pmu_raw_writel (value,EXYNOS5420_ARM_COMMON_OPTION ); + + value =pmu_raw_readl (EXYNOS5420_KFC_COMMON_OPTION ); + value |=EXYNOS5_SKIP_DEACTIVATE_ACEACP_IN_PWDN ; +pmu_raw_writel (value,EXYNOS5420_KFC_COMMON_OPTION ); + +/* This setting is to reduce suspend/resume time */ +pmu_raw_writel (DUR_WAIT_RESET ,EXYNOS5420_LOGIC_RESET_DURATION3 ); + +/* Serialized CPU wakeup of Eagle */ +pmu_raw_writel (SPREAD_ENABLE ,EXYNOS5420_ARM_INTR_SPREAD_ENABLE ); + +pmu_raw_writel (SPREAD_USE_STANDWFI , +EXYNOS5420_ARM_INTR_SPREAD_USE_STANDBYWFI ); + +pmu_raw_writel (0x1 ,EXYNOS5420_UP_SCHEDULER ); + + pm_power_off = exynos5_power_off; +pr_info ("EXYNOS5420 PMU initialized\n" ); +} + +static const struct exynos_pmu_data exynos4210_pmu_data = { .pmu_config = exynos4210_pmu_config, };
@@ -460,6 +739,12 @@ static const struct exynos_pmu_data exynos5250_pmu_data = { .powerdown_conf = exynos5_powerdown_conf, }; +static struct exynos_pmu_data exynos5420_pmu_data = { + .pmu_config = exynos5420_pmu_config, + .pmu_init = exynos5420_pmu_init, + .powerdown_conf = exynos5420_powerdown_conf, +}; +static const struct regmap_config pmu_regmap_config = { .reg_bits =32 , .val_bits =32 ,
@@ -482,6 +767,9 @@ static const struct of_device_id exynos_pmu_of_device_ids[] = { }, { .compatible = "samsung,exynos5250-pmu", .data = &exynos5250_pmu_data, + }, { + .compatible = "samsung,exynos5420-pmu", + .data = &exynos5420_pmu_data, }, { /*sentinel*/ }, };
arch/arm/mach-exynos/regs-pmu.h +229 -0
251 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v7 2/2 ARM: exynos5: Add Suspend-to-RAM support for 5420
In reply to Vikas SajjanFrom: Abhilash Kesavan <[email protected]>
Adds Suspend-to-RAM support for EXYNOS5420
--- arch/arm/mach-exynos/pm.c | 149 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 148 insertions(+), 1 deletion(-)
arch/arm/mach-exynos/pm.c +148 -1
@@ -39,6 +39,8 @@#define REG_TABLE_END (-1U) +#define EXYNOS5420_CPU_STATE 0x28 +/** * struct exynos_wkup_irq - Exynos GIC to PMU IRQ mapping * @hwirq: Hardware IRQ signal of the GIC
@@ -77,6 +79,9 @@ struct exynos_pm_data {struct exynos_pm_data *pm_data; +static int exynos5420_cpu_state; +static unsigned int exynos_pmu_spare3; +/* * GIC wake-up support */
@@ -106,6 +111,23 @@ unsigned int exynos_release_ret_regs[] = { REG_TABLE_END, }; +unsigned int exynos5420_release_ret_regs[] = { +EXYNOS_PAD_RET_DRAM_OPTION , +EXYNOS_PAD_RET_MAUDIO_OPTION , +EXYNOS_PAD_RET_JTAG_OPTION , +EXYNOS5420_PAD_RET_GPIO_OPTION , +EXYNOS5420_PAD_RET_UART_OPTION , +EXYNOS5420_PAD_RET_MMCA_OPTION , +EXYNOS5420_PAD_RET_MMCB_OPTION , +EXYNOS5420_PAD_RET_MMCC_OPTION , +EXYNOS5420_PAD_RET_HSI_OPTION , +EXYNOS_PAD_RET_EBIA_OPTION , +EXYNOS_PAD_RET_EBIB_OPTION , +EXYNOS5420_PAD_RET_SPI_OPTION , +EXYNOS5420_PAD_RET_DRAM_COREBLK_OPTION , +REG_TABLE_END , +}; +static int exynos_irq_set_wake (struct irq_data *data,unsigned int state) {const struct exynos_wkup_irq *wkup_irq;
@@ -266,10 +288,22 @@ static int exynos_cpu_do_idle(void)return 1 ;/* Aborting suspend */ } -static int exynos_cpu_suspend (unsigned long arg) +static void exynos_flush_cache_all (void ) {flush_cache_all ();outer_flush_all (); +} + +static int exynos_cpu_suspend (unsigned long arg) +{ +exynos_flush_cache_all (); +return exynos_cpu_do_idle (); +} + +static int exynos5420_cpu_suspend (unsigned long arg) +{ +exynos_flush_cache_all (); +__raw_writel (0x0 , sysram_base_addr +EXYNOS5420_CPU_STATE );return exynos_cpu_do_idle (); }
@@ -304,6 +338,49 @@ static void exynos_pm_prepare(void)exynos_pm_enter_sleep_mode (); } +static void exynos5420_pm_prepare (void ) +{ +unsigned int tmp; + +/* Set wake-up mask registers */ +exynos_pm_set_wakeup_mask (); + +s3c_pm_do_save (exynos_core_save,ARRAY_SIZE (exynos_core_save)); + + exynos_pmu_spare3 =pmu_raw_readl (S5P_PMU_SPARE3 ); +/* +* The cpu state needs to be saved and restored so that the +* secondary CPUs will enter low power start. Though the U-Boot +* is setting the cpu state with low power flag, the kernel +* needs to restore it back in case, the primary cpu fails to +* suspend for any reason. +*/ + exynos5420_cpu_state =__raw_readl (sysram_base_addr + +EXYNOS5420_CPU_STATE ); + +exynos_pm_enter_sleep_mode (); + + tmp =pmu_raw_readl (EXYNOS5_ARM_L2_OPTION ); + tmp &= ~EXYNOS5_USE_RETENTION ; +pmu_raw_writel (tmp,EXYNOS5_ARM_L2_OPTION ); + + tmp =pmu_raw_readl (EXYNOS5420_SFR_AXI_CGDIS1 ); + tmp |=EXYNOS5420_UFS ; +pmu_raw_writel (tmp,EXYNOS5420_SFR_AXI_CGDIS1 ); + + tmp =pmu_raw_readl (EXYNOS5420_ARM_COMMON_OPTION ); + tmp &= ~EXYNOS5420_L2RSTDISABLE_VALUE ; +pmu_raw_writel (tmp,EXYNOS5420_ARM_COMMON_OPTION ); + + tmp =pmu_raw_readl (EXYNOS5420_FSYS2_OPTION ); + tmp |=EXYNOS5420_EMULATION ; +pmu_raw_writel (tmp,EXYNOS5420_FSYS2_OPTION ); + + tmp =pmu_raw_readl (EXYNOS5420_PSGEN_OPTION ); + tmp |=EXYNOS5420_EMULATION ; +pmu_raw_writel (tmp,EXYNOS5420_PSGEN_OPTION ); +} +static int exynos_pm_suspend (void ) {unsigned long tmp;
@@ -321,6 +398,24 @@ static int exynos_pm_suspend(void)return 0 ; } +static int exynos5420_pm_suspend (void ) +{ +u32 this_cluster; + +exynos_pm_central_suspend (); + +/* Setting SEQ_OPTION register */ + + this_cluster =MPIDR_AFFINITY_LEVEL (read_cpuid_mpidr (),1 ); +if (!this_cluster) +pmu_raw_writel (EXYNOS5420_ARM_USE_STANDBY_WFI0 , +S5P_CENTRAL_SEQ_OPTION ); +else +pmu_raw_writel (EXYNOS5420_KFC_USE_STANDBY_WFI0 , +S5P_CENTRAL_SEQ_OPTION ); +return 0 ; +} +static void exynos_pm_release_retention (void ) {unsigned int i;
@@ -356,6 +451,45 @@ early_wakeup:pmu_raw_writel (0x0 ,S5P_INFORM1 ); } +static void exynos5420_pm_resume (void ) +{ +unsigned long tmp; + +/* Restore the sysram cpu state register */ +__raw_writel (exynos5420_cpu_state, + sysram_base_addr +EXYNOS5420_CPU_STATE ); + +pmu_raw_writel (EXYNOS5420_USE_STANDBY_WFI_ALL , +S5P_CENTRAL_SEQ_OPTION ); + +if (exynos_pm_central_resume ()) + goto early_wakeup; + +/* For release retention */ +exynos_pm_release_retention (); + +pmu_raw_writel (exynos_pmu_spare3,S5P_PMU_SPARE3 ); + +s3c_pm_do_restore_core (exynos_core_save,ARRAY_SIZE (exynos_core_save)); + +early_wakeup: + + tmp =pmu_raw_readl (EXYNOS5420_SFR_AXI_CGDIS1 ); + tmp &= ~EXYNOS5420_UFS ; +pmu_raw_writel (tmp,EXYNOS5420_SFR_AXI_CGDIS1 ); + + tmp =pmu_raw_readl (EXYNOS5420_FSYS2_OPTION ); + tmp &= ~EXYNOS5420_EMULATION ; +pmu_raw_writel (tmp,EXYNOS5420_FSYS2_OPTION ); + + tmp =pmu_raw_readl (EXYNOS5420_PSGEN_OPTION ); + tmp &= ~EXYNOS5420_EMULATION ; +pmu_raw_writel (tmp,EXYNOS5420_PSGEN_OPTION ); + +/* Clear SLEEP mode set in INFORM1 */ +pmu_raw_writel (0x0 ,S5P_INFORM1 ); +} +/* * Suspend Ops */
@@ -441,6 +575,16 @@ static const struct exynos_pm_data exynos5250_pm_data = { .cpu_suspend = exynos_cpu_suspend, }; +static struct exynos_pm_data exynos5420_pm_data = { + .wkup_irq = exynos5250_wkup_irq, + .wake_disable_mask = (0x7F <<7 ) | (0x1F <<1 ), + .release_ret_regs = exynos5420_release_ret_regs, + .pm_resume = exynos5420_pm_resume, + .pm_suspend = exynos5420_pm_suspend, + .pm_prepare = exynos5420_pm_prepare, + .cpu_suspend = exynos5420_cpu_suspend, +}; +static struct of_device_id exynos_pmu_of_device_ids[] = { { .compatible ="samsung,exynos4210-pmu" ,
@@ -454,6 +598,9 @@ static struct of_device_id exynos_pmu_of_device_ids[] = { }, { .compatible = "samsung,exynos5250-pmu", .data = &exynos5250_pm_data, + }, { + .compatible = "samsung,exynos5420-pmu", + .data = &exynos5420_pm_data, }, { /*sentinel*/ }, };
Signature · 1 line
1.7.9.5
v7 cover Adds PMU and S2R support for exynos5420
In reply to Vikas SajjanHi All,
Quoted 62 lines · Vikas Sajjan
Rebased on
1] Kukjin Kim's tree, master branch
http://git.kernel.org/cgit/linux/kernel/git/kgene/linux-samsung.git/log/
2] Pankaj Dubey's v7 PMU patchset
https://lkml.org/lkml/2014/7/9/2
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/270655.html
3] Mypm.crefactoring patchset
http://www.spinics.net/lists/linux-samsung-soc/msg35740.htmlchanges since v6:
- rebased on 3.17.rc1.changes since v5:
- Refactoredpm.cto use DT based lookup as suggested by Tomasz Figa.changes since v4:
- Adressed comments from Tomasz figa and rebased on Pankaj Dubey's v5 PMU patchsetchanges since v3:
Addressed the following comments from Pankaj Dubey, Bartlomiej Zolnierkiewicz, Tomasz Figa and Alim Akhtar:
- MovedEXYNOS5420_USE_STANDBY_WFI_ALLdefine toregs-pmu.h.
- Mergedexynos5420_set_core_flagfunction intopowerdown_conf.
- RemovedXXTI_DURATION3register setting.
- Updated the commit message and ordered the clock registers in clock patch.
- Removed the code forSYS_DISP1_BLK_CFGhandling.
- Modified SoC checks to A9 specific checks in PM code.
- Updated some comments in the code and added macros for register offsets.
- Fixed code which was changing pad retention code for older SoCs.changes since v2:
- Addressed comments from Tomasz figa
- rebased on Pankaj's V3 patchset https://lkml.org/lkml/2014/5/2/612
- dropped patch "ARM: dts: Add node for GPIO keys on SMDK5420", will be sent separately.changes since v1:
- Addressed comments from Tomasz figa.
- restructured/consolidated as per Tomasz figa's PM consolidations for exynosTested on Kukjin Kim's tree, master branch + http://www.spinics.net/lists/linux-samsung-soc/msg33750.html
on Exynos5420 based chromebook (peach-pit board)
PS : Not tested on exynos4 based boards.
Tested-by for exynos4 would be appreciated.
Below procedures were followed to test S2R:
Procedure A:
1. makemulti_v7_defconfig
2 enable MCPM for 5420
3. enable S3C RTC
4. pass "no_console_suspend" in bootargs
5. echo +20 >/sys/class/rtc/rtc0/wakealarm&& echo mem >/sys/power/state
Procedure B:
1. makeexynos_defconfig
2 disableBL_SWITCHER
3. pass "no_console_suspend" in bootargs
4. echo +20 >/sys/class/rtc/rtc0/wakealarm&& echo mem >/sys/power/state
Quoted 9 lines
Abhilash Kesavan (2):
ARM: exynos5: Add PMU support for 5420
ARM: exynos5: Add Suspend-to-RAM support for 5420arch/arm/mach-exynos/pm.c | 149 +++++++++++++++++++- arch/arm/mach-exynos/pmu.c | 288 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-exynos/regs-pmu.h | 229 +++++++++++++++++++++++++++++++ 3 files changed, 665 insertions(+), 1 deletion(-)
Anymore comments on this....
Quoted 3 lines
--
1.7.9.5
v7 cover Adds PMU and S2R support for exynos5420
[adding Pankaj Dubey to cc list]
Hello Vikas,
Quoted 10 lines · Vikas Sajjan
Hi All,
Quoted 6 lines · Vikas Sajjan
Rebased on
1] Kukjin Kim's tree, master branch
http://git.kernel.org/cgit/linux/kernel/git/kgene/linux-samsung.git/log/
2] Pankaj Dubey's v7 PMU patchset
https://lkml.org/lkml/2014/7/9/2
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/270655.html
The mentioned patches from the PMU series depend on the patch to decouple the syscon interface from syscon drivers. The latest version of that patch is Pankaj's "[PATCH v5] mfd: syscon: Decouple syscon interface from platform devices" [0].
There is still an ongoing discussion about the implementation details since errors were reported (debugfs regmap dir failing to be created due a NULL device name) so this won't be a definite version.
But I tested that patch on an Exynos5420 Peach Pit and it works so maybe Pankaj can re-spin his PMU series on top of his latest syscon patch so at least the dependencies for your series are sorted and people can try it?
Best regards,
Javier
v7 cover Adds PMU and S2R support for exynos5420
Hi Javier,
Quoted 16 lines · Javier Martinez Canillas
[adding Pankaj Dubey to cc list]
Hello Vikas,
Quoted 10 lines · Vikas Sajjan
Hi All,
Quoted 6 lines · Vikas Sajjan
Rebased on
1] Kukjin Kim's tree, master branch
http://git.kernel.org/cgit/linux/kernel/git/kgene/linux-samsung.git/log/
2] Pankaj Dubey's v7 PMU patchset
https://lkml.org/lkml/2014/7/9/2
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/270655.html
Quoted 5 lines
The mentioned patches from the PMU series depend on the patch to decouple the syscon interface from syscon drivers. The latest version of that patch is Pankaj's "[PATCH v5] mfd: syscon: Decouple syscon interface from platform devices" [0].
Since Arnd has given "Reviewed-by" to Pankaj's MFD syscon patch now,
Pankaj can rebase his PMU patchset [1], so that I can re-spin my 5420 S2R patchset on top his PMU patchset.
[1] https://lkml.org/lkml/2014/7/9/2
http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/270655.html
Quoted 9 lines
There is still an ongoing discussion about the implementation details since errors were reported (debugfs regmap dir failing to be created due a NULL device name) so this won't be a definite version.
But I tested that patch on an Exynos5420 Peach Pit and it works so maybe Pankaj can re-spin his PMU series on top of his latest syscon patch so at least the dependencies for your series are sorted and people can try it?
Quoted 4 lines
Best regards,
Javier
Regards
Vikas Sajjan
v7 cover Adds PMU and S2R support for exynos5420
Hello Vikas,
Quoted 11 lines · Vikas Sajjan
Hi Javier,
On Thu, Sep 25, 2014 at 10:45 PM, Javier Martinez Canillas
Quoted 6 lines
The mentioned patches from the PMU series depend on the patch to decouple the syscon interface from syscon drivers. The latest version of that patch is Pankaj's "[PATCH v5] mfd: syscon: Decouple syscon interface from platform devices" [0].
Quoted 4 lines
Since Arnd has given "Reviewed-by" to Pankaj's MFD syscon patch now,
Pankaj can rebase his PMU patchset [1], so that I can re-spin my 5420 S2R patchset on top his PMU patchset.
Indeed, that would be great. Thanks a lot!
Quoted 3 lines
Regards
Vikas Sajjan
Best regards,
Javier
v7 cover Adds PMU and S2R support for exynos5420
Hi Javier and Vikas,
Quoted 15 lines
Hello Vikas,
Quoted 11 lines · Vikas Sajjan
Hi Javier,
On Thu, Sep 25, 2014 at 10:45 PM, Javier Martinez Canillas
Quoted 6 lines
The mentioned patches from the PMU series depend on the patch to decouple the syscon interface from syscon drivers. The latest version of that patch is Pankaj's "[PATCH v5] mfd: syscon: Decouple syscon interface from platform devices" [0].
Quoted 7 lines
Quoted 4 lines
Since Arnd has given "Reviewed-by" to Pankaj's MFD syscon patch now,
Pankaj can rebase his PMU patchset [1], so that I can re-spin my 5420 S2R patchset on top his PMU patchset.Indeed, that would be great. Thanks a lot!
I was waiting for syscon patch to be finalized, now I will rebase my the PMU patches as almost all issues of syscon has been addressed, and I hope it's now ready to be taken in.
Thanks,
Pankaj Dubey
Quoted 6 lines
Quoted 3 lines
Regards
Vikas SajjanBest regards,
Javier