From: chenjh Date: Wed, 18 Mar 2015 07:30:32 +0000 (+0800) Subject: rk3368: support cpu suspend to wfi X-Git-Tag: firefly_0821_release~4158^2~338 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=commitdiff_plain;h=c066069b1d0ac71bf7cd8499e6faf94e664e756c rk3368: support cpu suspend to wfi Signed-off-by: chenjh --- diff --git a/arch/arm/mach-rockchip/rockchip_pm.c b/arch/arm/mach-rockchip/rockchip_pm.c index d3e8a1ead7f9..9a9ce3c64197 100755 --- a/arch/arm/mach-rockchip/rockchip_pm.c +++ b/arch/arm/mach-rockchip/rockchip_pm.c @@ -11,7 +11,6 @@ #include #include "pm.h" -#ifdef CONFIG_ARM /*************************dump reg********************************************/ void rkpm_ddr_reg_offset_dump(void __iomem * base_addr,u32 _offset) @@ -403,6 +402,8 @@ void rkpm_ddr_printhex(unsigned int hex) hex <<= 4; } } + +#ifdef CONFIG_ARM void rk_sram_suspend(void) { RKPM_DDR_FUN(regs_pread); @@ -438,6 +439,8 @@ static int rk_lpmode_enter(unsigned long arg) } int cpu_suspend(unsigned long arg, int (*fn)(unsigned long)); +#endif /* CONFIG_ARM */ + static int rkpm_enter(suspend_state_t state) { //static u32 test_count=0; @@ -478,6 +481,7 @@ static int rkpm_enter(suspend_state_t state) rkpm_ddr_printch('5'); +#ifdef CONFIG_ARM if(rkpm_chk_jdg_ctrbits(RKPM_CTRBITS_SOC_DLPMD)) { if(cpu_suspend(0,rk_lpmode_enter)==0) @@ -497,6 +501,10 @@ static int rkpm_enter(suspend_state_t state) dsb(); wfi(); } +#else + flush_cache_all(); + cpu_suspend(1); +#endif rkpm_ddr_printch('5'); @@ -568,6 +576,14 @@ void __init rockchip_suspend_init(void) suspend_set_ops(&rockchip_suspend_ops); return; } + +#ifndef CONFIG_ARM +static int __init rockchip_init_suspend(void) +{ + suspend_set_ops(&rockchip_suspend_ops); + return 0; +} +late_initcall_sync(rockchip_init_suspend); #endif /* CONFIG_ARM */ static enum rockchip_pm_policy pm_policy; diff --git a/arch/arm64/boot/dts/rk3368.dtsi b/arch/arm64/boot/dts/rk3368.dtsi index 151298c32238..8fb60ed7caa6 100755 --- a/arch/arm64/boot/dts/rk3368.dtsi +++ b/arch/arm64/boot/dts/rk3368.dtsi @@ -37,53 +37,72 @@ #address-cells = <2>; #size-cells = <0>; + idle-states { + entry-method = "arm,psci"; + CPU_SLEEP_0: cpu-sleep-0 { + compatible = "arm,idle-state"; + arm,psci-suspend-param = <0x0000000>; + entry-latency-us = <10000000>; + exit-latency-us = <10000000>; + min-residency-us = <25000>; + }; + }; + little0: cpu@100 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x100>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; little1: cpu@101 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x101>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; little2: cpu@102 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x102>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; little3: cpu@103 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x103>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; big0: cpu@0 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x0>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; big1: cpu@1 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x1>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; big2: cpu@2 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x2>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; big3: cpu@3 { device_type = "cpu"; compatible = "arm,cortex-a53", "arm,armv8"; reg = <0x0 0x3>; enable-method = "psci"; + cpu-idle-states = <&CPU_SLEEP_0>; }; cpu-map { @@ -122,6 +141,8 @@ compatible = "arm,psci"; method = "smc"; cpu_on = <0xC4000003>; + cpu_suspend = <0x84000001>; + cpu_off = <0x84000002>; }; gic: interrupt-controller@ffb70000 { @@ -582,6 +603,7 @@ <&clk_gates12 5>,/*aclk_intmem0*/ <&clk_gates12 4>,/*aclk_intmem*/ <&clk_gates13 9>,/*aclk_gic400*/ + <&clk_gates12 9>,/*hclk_rom*/ /*PD_ALIVE*/ <&clk_gates22 13>,/*pclk_timer1*/