[PATCH V2 0/4]
Subsystems (6)
v2 cover [PATCH V2 0/4]
This series adds the LP1 support for Tegra124. (suspend to LP2 also supported in this series)
Note:
This patch series depends on the patch series below.
* [PATCH 0/5] Tegra124 clock support
* [PATCH V2 0/6] ARM: tegra: basic support for Tegra124 SoC
* [PATCH] ARM: tegra: add clock properties for devices of Tegra124
* [PATCH] ARM: tegra: enable Tegra RTC as default for Tegra124
* [PATCH 0/4] ARM: tegra: add CPU hot-plug and idle support for Tegra124
Verified on Cardhu, Dalmore and Venice2 and with THUMB2_KERNEL as well.
V2:
* remove the patch of "enable Tegra RTC for Venice2"
* add new patch of "re-calculate the LP1 data for Tegra30/114"
* squash the 2 to 5 into patch 3/4 of this series
Joseph Lo (4):
clk: tegra124: add suspend/resume function for tegra_cpu_car_ops
ARM: tegra: re-calculate the LP1 data for Tegra30/114
ARM: tegra: add LP1 support code for Tegra124
ARM: tegra: enable LP1 suspend mode for Venice2
arch/arm/boot/dts/tegra124-venice2.dts | 7 +++++ arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/flowctrl.c | 2 ++ arch/arm/mach-tegra/iomap.h | 3 +++ arch/arm/mach-tegra/pm.c | 12 ++++++--- arch/arm/mach-tegra/sleep-tegra30.S | 49 +++++++++++++++++++++++++--------- drivers/clk/tegra/clk-tegra124.c | 27 +++++++++++++++++++ 7 files changed, 86 insertions(+), 15 deletions(-)
Signature · 1 line
1.8.4
PATCH v2 1/4 clk: tegra124: add suspend/resume function for tegra_cpu_car_ops
Adding suspend/resume function for tegra_cpu_car_ops. We only save and restore the setting of the clock of CoreSight. Other clocks still need to be taken care by clock driver.
---
V2:
* no change
--- drivers/clk/tegra/clk-tegra124.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/clk/tegra/clk-tegra124.c +27 -0
@@ -28,6 +28,7 @@#include "clk.h" #include "clk-id.h" +#define CLK_SOURCE_CSITE 0x1d4#define CLK_SOURCE_EMC 0x19c#define CLK_SOURCE_XUSB_SS_SRC 0x610
@@ -109,6 +110,12 @@/* Tegra CPU clock and reset control regs */ #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470 +#ifdef CONFIG_PM_SLEEP +static struct cpu_clk_suspend_context { +u32 clk_csite_src; +} tegra124_cpu_clk_sctx; +#endif +static void __iomem *clk_base;static void __iomem *pmc_base;
@@ -1139,9 +1146,29 @@ static void tegra124_disable_cpu_clock(u32 cpu)/* flow controller would take care in the power sequence. */ } +#ifdef CONFIG_PM_SLEEP +static void tegra124_cpu_clock_suspend (void ) +{ +/* switch coresite to clk_m, save off original source */ + tegra124_cpu_clk_sctx.clk_csite_src = +readl (clk_base +CLK_SOURCE_CSITE ); +writel (3 <<30 , clk_base +CLK_SOURCE_CSITE ); +} + +static void tegra124_cpu_clock_resume (void ) +{ +writel (tegra124_cpu_clk_sctx.clk_csite_src, + clk_base +CLK_SOURCE_CSITE ); +} +#endif +static struct tegra_cpu_car_ops tegra124_cpu_car_ops = { .wait_for_reset = tegra124_wait_cpu_in_reset, .disable_clock = tegra124_disable_cpu_clock, +#ifdef CONFIG_PM_SLEEP + .suspend = tegra124_cpu_clock_suspend, + .resume = tegra124_cpu_clock_resume, +#endif };static const struct of_device_id pmc_match[]__initconst = {
Signature · 1 line
1.8.4
PATCH v2 2/4 ARM: tegra: re-calculate the LP1 data for Tegra30/114
In reply to Joseph LoThis patch re-calculates the LP1 data of tegra30/114_sdram_pad_address to base on its label not rely on others. This can make easier to maintain if some other Tegra chips keep re-using these codes in the future. And change the name of tegra30_sdram_pad_save to tegra_sdram_pad_save to make it more common to other chips.
---
V2:
* new in this series
--- arch/arm/mach-tegra/sleep-tegra30.S | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
arch/arm/mach-tegra/sleep-tegra30.S +9 -7
@@ -383,7 +383,7 @@ _pll_m_c_x_done: add r1, r1, #LOCK_DELAY wait_until r1, r7, r3 - adr r5, tegra30_sdram_pad_save + adr r5, tegra_sdram_pad_save ldr r4, [r5, #0x18] @ restore CLK_SOURCE_MSELECT str r4, [r0, #CLK_RESET_CLK_SOURCE_MSELECT]
@@ -538,6 +538,7 @@ tegra30_sdram_pad_address: .word TEGRA_PMC_BASE + PMC_IO_DPD_STATUS @0x14 .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18 .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c +tegra30_sdram_pad_address_end: tegra114_sdram_pad_address: .word TEGRA_EMC0_BASE + EMC_CFG @0x0
@@ -553,16 +554,17 @@ tegra114_sdram_pad_address: .word TEGRA_EMC1_BASE + EMC_AUTO_CAL_INTERVAL @0x28 .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL @0x2c .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL2 @0x30 +tegra114_sdram_pad_adress_end: tegra30_sdram_pad_size: - .word tegra114_sdram_pad_address - tegra30_sdram_pad_address + .word tegra30_sdram_pad_address_end - tegra30_sdram_pad_address tegra114_sdram_pad_size: - .word tegra30_sdram_pad_size - tegra114_sdram_pad_address + .word tegra114_sdram_pad_adress_end - tegra114_sdram_pad_address - .type tegra30_sdram_pad_save, %object -tegra30_sdram_pad_save: - .rept (tegra30_sdram_pad_size - tegra114_sdram_pad_address) / 4 + .type tegra_sdram_pad_save, %object +tegra_sdram_pad_save: + .rept (tegra114_sdram_pad_adress_end - tegra114_sdram_pad_address) / 4 .long 0 .endr
@@ -693,7 +695,7 @@ halted: */ tegra30_sdram_self_refresh: - adr r8, tegra30_sdram_pad_save + adr r8, tegra_sdram_pad_save tegra_get_soc_id TEGRA_APB_MISC_BASE, r10 cmp r10, #TEGRA30 adreq r2, tegra30_sdram_pad_address
Signature · 1 line
1.8.4
PATCH v2 3/4 ARM: tegra: add LP1 support code for Tegra124
In reply to Joseph LoThe LP1 suspend procedure is the same with Tegra30 and Tegra114. Just need to update the difference of the register address, then we can continue to share the code.
---
V2:
* squash from 2/7 to 5/7 in V1
--- arch/arm/mach-tegra/Makefile | 1 + arch/arm/mach-tegra/flowctrl.c | 2 ++ arch/arm/mach-tegra/iomap.h | 3 +++ arch/arm/mach-tegra/pm.c | 12 +++++++++--- arch/arm/mach-tegra/sleep-tegra30.S | 33 ++++++++++++++++++++++++++++----- 5 files changed, 43 insertions(+), 8 deletions(-)
arch/arm/mach-tegra/Makefile +1 -0
@@ -36,6 +36,7 @@ ifeq ($(CONFIG_CPU_IDLE),y) obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o endif obj-$(CONFIG_ARCH_TEGRA_124_SOC) += sleep-tegra30.o +obj-$(CONFIG_ARCH_TEGRA_124_SOC) += pm-tegra30.o ifeq ($(CONFIG_CPU_IDLE),y) obj-$(CONFIG_ARCH_TEGRA_124_SOC) += cpuidle-tegra114.o endif
arch/arm/mach-tegra/flowctrl.c +2 -0
@@ -87,6 +87,7 @@ void flowctrl_cpu_suspend_enter(unsigned int cpuid)break ;case TEGRA30 :case TEGRA114 : +case TEGRA124 :/* clear wfe bitmap */ reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP ;/* clear wfi bitmap */
@@ -125,6 +126,7 @@ void flowctrl_cpu_suspend_exit(unsigned int cpuid)break ;case TEGRA30 :case TEGRA114 : +case TEGRA124 :/* clear wfe bitmap */ reg &= ~TEGRA30_FLOW_CTRL_CSR_WFE_BITMAP ;/* clear wfi bitmap */
arch/arm/mach-tegra/iomap.h +3 -0
@@ -105,6 +105,9 @@#define TEGRA_EMC1_BASE 0x7001A800#define TEGRA_EMC1_SIZE SZ_2K +#define TEGRA124_EMC_BASE 0x7001B000 +#define TEGRA124_EMC_SIZE SZ_2K +#define TEGRA_CSITE_BASE 0x70040000#define TEGRA_CSITE_SIZE SZ_256K
arch/arm/mach-tegra/pm.c +9 -3
@@ -59,8 +59,10 @@ static void tegra_tear_down_cpu_init(void)break ;case TEGRA30 :case TEGRA114 : +case TEGRA124 :if (IS_ENABLED (CONFIG_ARCH_TEGRA_3x_SOC) || -IS_ENABLED (CONFIG_ARCH_TEGRA_114_SOC )) +IS_ENABLED (CONFIG_ARCH_TEGRA_114_SOC ) || +IS_ENABLED (CONFIG_ARCH_TEGRA_124_SOC )) tegra_tear_down_cpu = tegra30_tear_down_cpu;break ; }
@@ -216,8 +218,10 @@ static bool tegra_lp1_iram_hook(void)break ;case TEGRA30 :case TEGRA114 : +case TEGRA124 :if (IS_ENABLED (CONFIG_ARCH_TEGRA_3x_SOC) || -IS_ENABLED (CONFIG_ARCH_TEGRA_114_SOC )) +IS_ENABLED (CONFIG_ARCH_TEGRA_114_SOC ) || +IS_ENABLED (CONFIG_ARCH_TEGRA_124_SOC ))tegra30_lp1_iram_hook ();break ;default :
@@ -244,8 +248,10 @@ static bool tegra_sleep_core_init(void)break ;case TEGRA30 :case TEGRA114 : +case TEGRA124 :if (IS_ENABLED (CONFIG_ARCH_TEGRA_3x_SOC) || -IS_ENABLED (CONFIG_ARCH_TEGRA_114_SOC )) +IS_ENABLED (CONFIG_ARCH_TEGRA_114_SOC ) || +IS_ENABLED (CONFIG_ARCH_TEGRA_124_SOC ))tegra30_sleep_core_init ();break ;default :
arch/arm/mach-tegra/sleep-tegra30.S +28 -5
@@ -408,8 +408,12 @@ _pll_m_c_x_done: cmp r10, #TEGRA30 movweq r0, #:lower16:TEGRA_EMC_BASE @ r0 reserved for emc base movteq r0, #:upper16:TEGRA_EMC_BASE - movwne r0, #:lower16:TEGRA_EMC0_BASE - movtne r0, #:upper16:TEGRA_EMC0_BASE + cmp r10, #TEGRA114 + movweq r0, #:lower16:TEGRA_EMC0_BASE + movteq r0, #:upper16:TEGRA_EMC0_BASE + cmp r10, #TEGRA124 + movweq r0, #:lower16:TEGRA124_EMC_BASE + movteq r0, #:upper16:TEGRA124_EMC_BASE exit_self_refresh: ldr r1, [r5, #0xC] @ restore EMC_XM2VTTGENPADCTRL
@@ -556,6 +560,17 @@ tegra114_sdram_pad_address: .word TEGRA_EMC1_BASE + EMC_XM2VTTGENPADCTRL2 @0x30 tegra114_sdram_pad_adress_end: +tegra124_sdram_pad_address: + .word TEGRA124_EMC_BASE + EMC_CFG @0x0 + .word TEGRA124_EMC_BASE + EMC_ZCAL_INTERVAL @0x4 + .word TEGRA124_EMC_BASE + EMC_AUTO_CAL_INTERVAL @0x8 + .word TEGRA124_EMC_BASE + EMC_XM2VTTGENPADCTRL @0xc + .word TEGRA124_EMC_BASE + EMC_XM2VTTGENPADCTRL2 @0x10 + .word TEGRA_PMC_BASE + PMC_IO_DPD_STATUS @0x14 + .word TEGRA_CLK_RESET_BASE + CLK_RESET_CLK_SOURCE_MSELECT @0x18 + .word TEGRA_CLK_RESET_BASE + CLK_RESET_SCLK_BURST @0x1c +tegra124_sdram_pad_address_end: + tegra30_sdram_pad_size: .word tegra30_sdram_pad_address_end - tegra30_sdram_pad_address
@@ -700,8 +715,13 @@ tegra30_sdram_self_refresh: cmp r10, #TEGRA30 adreq r2, tegra30_sdram_pad_address ldreq r3, tegra30_sdram_pad_size - adrne r2, tegra114_sdram_pad_address - ldrne r3, tegra114_sdram_pad_size + cmp r10, #TEGRA114 + adreq r2, tegra114_sdram_pad_address + ldreq r3, tegra114_sdram_pad_size + cmp r10, #TEGRA124 + adreq r2, tegra124_sdram_pad_address + ldreq r3, tegra30_sdram_pad_size + mov r9, #0 padsave:
@@ -719,7 +739,10 @@ padsave_done: cmp r10, #TEGRA30 ldreq r0, =TEGRA_EMC_BASE @ r0 reserved for emc base addr - ldrne r0, =TEGRA_EMC0_BASE + cmp r10, #TEGRA114 + ldreq r0, =TEGRA_EMC0_BASE + cmp r10, #TEGRA124 + ldreq r0, =TEGRA124_EMC_BASE enter_self_refresh: cmp r10, #TEGRA30
Signature · 1 line
1.8.4
PATCH v2 4/4 ARM: tegra: enable LP1 suspend mode for Venice2
In reply to Joseph LoEnable LP1 suspend mode for Tegra124 Venice2 board.
---
V2:
* no change
--- arch/arm/boot/dts/tegra124-venice2.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/tegra124-venice2.dts +7 -0
@@ -16,6 +16,13 @@ pmc at 7000e400 { nvidia,invert-interrupt; + nvidia,suspend-mode = <1>; + nvidia,cpu-pwr-good-time = <500>; + nvidia,cpu-pwr-off-time = <300>; + nvidia,core-pwr-good-time = <641 3845>; + nvidia,core-pwr-off-time = <61036>; + nvidia,core-power-req-active-high; + nvidia,sys-clock-req-active-high; }; clocks {
Signature · 1 line
1.8.4
v2 cover [PATCH V2 0/4]
In reply to Joseph LoQuoted 11 lines · Joseph Lo
This series adds the LP1 support for Tegra124. (suspend to LP2 also supported in this series)
Note:
This patch series depends on the patch series below.
* [PATCH 0/5] Tegra124 clock support
* [PATCH V2 0/6] ARM: tegra: basic support for Tegra124 SoC
* [PATCH] ARM: tegra: add clock properties for devices of Tegra124
* [PATCH] ARM: tegra: enable Tegra RTC as default for Tegra124
* [PATCH 0/4] ARM: tegra: add CPU hot-plug and idle support for Tegra124
Quoted 1 line
Verified on Cardhu, Dalmore and Venice2 and with
THUMB2_KERNELas well.
I have applied patches 2-3 to Tegra's for-3.13/soc branch, and patch 4 to Tegra's for-3.13/dt branch.
I have not applied patch 1, since that's a clock driver change. Please work with Mike and/or Peter to send that patch through the clock tree. In general, if there aren't any compile-time or run-time dependencies (for existing features, not new ones) between patches, patches for different subsystems should be sent separately, rather than as a combined series.
Note that "[PATCH] ARM: tegra: add clock properties for devices of Tegra124" is not yet applied; I'm waiting for Peter's Tegra124 clock series to be finalized before applying that. There's no compile-time dependency here, and the patch only enables new features without breaking existing ones, so there's no bisection issue here.