Skip to contentSkip to conversation

ARM: tegra: Don't enable unused PLLs on resume from suspend

PATCH Applied Dmitry Osipenko 2 participants 3 messages Jan 12, 2021 – Jan 19, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: tegra: Don't enable unused PLLs on resume from suspend

PLLC and PLLM are usually disabled on system suspend because all devices which use these PLLs are either suspended or switched away to other clock source. Don't enable unused PLLs on resume from suspend by keeping track of the enable-state of the PLLs across suspend-resume.

---
 arch/arm/mach-tegra/sleep-tegra20.S | 38 ++++++++++--
 arch/arm/mach-tegra/sleep-tegra30.S | 94 +++++++++++++++++++++++------
 2 files changed, 108 insertions(+), 24 deletions(-)
arch/arm/mach-tegra/sleep-tegra20.S +34 -4
index 0e00ba8cf646..a5a36cce142a 100644
@@ -43,11 +43,34 @@
 #define APB_MISC_XM2CFGCPADCTRL2	0x8e4
 #define APB_MISC_XM2CFGDPADCTRL2	0x8e8
 
-.macro pll_enable, rd, r_car_base, pll_base
+#define PLLC_STORE_MASK			(1 << 0)
+#define PLLM_STORE_MASK			(1 << 1)
+#define PLLP_STORE_MASK			(1 << 2)
+
+.macro test_pll_state, rd, test_mask
+	ldr	\rd, tegra_pll_state
+	tst	\rd, #\test_mask
+.endm
+
+.macro store_pll_state, rd, tmp, r_car_base, pll_base, pll_mask
+	ldr	\rd, [\r_car_base, #\pll_base]
+	tst	\rd, #(1 << 30)
+	ldr	\rd, tegra_pll_state
+	biceq	\rd, \rd, #\pll_mask
+	orrne	\rd, \rd, #\pll_mask
+	adr	\tmp, tegra_pll_state
+	str	\rd, [\tmp]
+.endm
+
+.macro pll_enable, rd, r_car_base, pll_base, test_mask
+	test_pll_state \rd, \test_mask
+	beq	1f
+
 	ldr	\rd, [\r_car_base, #\pll_base]
 	tst	\rd, #(1 << 30)
 	orreq	\rd, \rd, #(1 << 30)
 	streq	\rd, [\r_car_base, #\pll_base]
+1:
 .endm
 
 .macro emc_device_mask, rd, base
@@ -177,9 +200,9 @@ ENTRY(tegra20_lp1_reset)
 	str	r1, [r0, #CLK_RESET_CCLK_DIVIDER]
 	str	r1, [r0, #CLK_RESET_SCLK_DIVIDER]
 
-	pll_enable r1, r0, CLK_RESET_PLLM_BASE
-	pll_enable r1, r0, CLK_RESET_PLLP_BASE
-	pll_enable r1, r0, CLK_RESET_PLLC_BASE
+	pll_enable r1, r0, CLK_RESET_PLLM_BASE, PLLM_STORE_MASK
+	pll_enable r1, r0, CLK_RESET_PLLP_BASE, PLLP_STORE_MASK
+	pll_enable r1, r0, CLK_RESET_PLLC_BASE, PLLC_STORE_MASK
 
 	adr	r2, tegra20_sdram_pad_address
 	adr	r4, tegra20_sdram_pad_save
@@ -270,6 +293,10 @@ tegra20_switch_cpu_to_clk32k:
 	add	r1, r1, #2
 	wait_until r1, r7, r9
 
+	store_pll_state r0, r1, r5, CLK_RESET_PLLC_BASE, PLLC_STORE_MASK
+	store_pll_state r0, r1, r5, CLK_RESET_PLLM_BASE, PLLM_STORE_MASK
+	store_pll_state r0, r1, r5, CLK_RESET_PLLP_BASE, PLLP_STORE_MASK
+
 	/* disable PLLM, PLLP and PLLC */
 	ldr	r0, [r5, #CLK_RESET_PLLM_BASE]
 	bic	r0, r0, #(1 << 30)
@@ -396,6 +423,9 @@ tegra20_sdram_pad_save:
 	.long	0
 	.endr
 
+tegra_pll_state:
+	.word	0x0
+
 	.ltorg
 /* dummy symbol for end of IRAM */
 	.align L1_CACHE_SHIFT
arch/arm/mach-tegra/sleep-tegra30.S +74 -20

153 lines not on this page · raw message

Signature · 1 line
2.29.2
Tested-by Name on v1 1/1 Applied
#1 lore raw
Quoted 5 lines · Dmitry Osipenko

PLLC and PLLM are usually disabled on system suspend because all devices which use these PLLs are either suspended or switched away to other clock source. Don't enable unused PLLs on resume from suspend by keeping track of the enable-state of the PLLs across suspend-resume.

Quoted 8 lines
---
 arch/arm/mach-tegra/sleep-tegra20.S | 38 ++++++++++--
 arch/arm/mach-tegra/sleep-tegra30.S | 94 +++++++++++++++++++++++------
 2 files changed, 108 insertions(+), 24 deletions(-)

For future patches with this many tested-bys, can you collect a bit of information about where these were tested? That'd be a good way to get a better understanding of the coverage and a good way to collect a bit of information about what devices are being used.

I've seen a pattern like this used sometimes:

Tested-by Name <email> # Board that was tested on

So perhaps we can adopt this for these cases?

Applied, thanks.

Thierry

author Tested-by Peter Geis Tested-by Nicolas Chauvet Tested-by Matt Merhar
#2 lore raw

19.01.2021 20:24, Thierry Reding пишет:

Quoted 20 lines · Dmitry Osipenko
Quoted 5 lines

PLLC and PLLM are usually disabled on system suspend because all devices which use these PLLs are either suspended or switched away to other clock source. Don't enable unused PLLs on resume from suspend by keeping track of the enable-state of the PLLs across suspend-resume.

Quoted 8 lines
---
 arch/arm/mach-tegra/sleep-tegra20.S | 38 ++++++++++--
 arch/arm/mach-tegra/sleep-tegra30.S | 94 +++++++++++++++++++++++------
 2 files changed, 108 insertions(+), 24 deletions(-)

For future patches with this many tested-bys, can you collect a bit of information about where these were tested? That'd be a good way to get a better understanding of the coverage and a good way to collect a bit of information about what devices are being used.

Quoted 7 lines

I've seen a pattern like this used sometimes:

Tested-by Name <email> # Board that was tested on

So perhaps we can adopt this for these cases?

Applied, thanks.

Okay, for this patch it should be: