Skip to content

Commit 204ce75

Browse files
digetxthierryreding
authored andcommitted
clk: tegra: Optimize PLLX restore on Tegra20/30
There is no need to re-configure PLLX if its configuration in unchanged on return from suspend / cpuidle, this saves 300us if PLLX is already enabled (common case for cpuidle). Signed-off-by: Dmitry Osipenko <[email protected]> Acked-by: Peter De Schrijver <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 535f296 commit 204ce75

File tree

2 files changed

+32
-18
lines changed

2 files changed

+32
-18
lines changed

drivers/clk/tegra/clk-tegra20.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,7 @@ static void tegra20_cpu_clock_suspend(void)
955955
static void tegra20_cpu_clock_resume(void)
956956
{
957957
unsigned int reg, policy;
958+
u32 misc, base;
958959

959960
/* Is CPU complex already running on PLLX? */
960961
reg = readl(clk_base + CCLK_BURST_POLICY);
@@ -968,15 +969,21 @@ static void tegra20_cpu_clock_resume(void)
968969
BUG();
969970

970971
if (reg != CCLK_BURST_POLICY_PLLX) {
971-
/* restore PLLX settings if CPU is on different PLL */
972-
writel(tegra20_cpu_clk_sctx.pllx_misc,
973-
clk_base + PLLX_MISC);
974-
writel(tegra20_cpu_clk_sctx.pllx_base,
975-
clk_base + PLLX_BASE);
976-
977-
/* wait for PLL stabilization if PLLX was enabled */
978-
if (tegra20_cpu_clk_sctx.pllx_base & (1 << 30))
979-
udelay(300);
972+
misc = readl_relaxed(clk_base + PLLX_MISC);
973+
base = readl_relaxed(clk_base + PLLX_BASE);
974+
975+
if (misc != tegra20_cpu_clk_sctx.pllx_misc ||
976+
base != tegra20_cpu_clk_sctx.pllx_base) {
977+
/* restore PLLX settings if CPU is on different PLL */
978+
writel(tegra20_cpu_clk_sctx.pllx_misc,
979+
clk_base + PLLX_MISC);
980+
writel(tegra20_cpu_clk_sctx.pllx_base,
981+
clk_base + PLLX_BASE);
982+
983+
/* wait for PLL stabilization if PLLX was enabled */
984+
if (tegra20_cpu_clk_sctx.pllx_base & (1 << 30))
985+
udelay(300);
986+
}
980987
}
981988

982989
/*

drivers/clk/tegra/clk-tegra30.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,6 +1163,7 @@ static void tegra30_cpu_clock_suspend(void)
11631163
static void tegra30_cpu_clock_resume(void)
11641164
{
11651165
unsigned int reg, policy;
1166+
u32 misc, base;
11661167

11671168
/* Is CPU complex already running on PLLX? */
11681169
reg = readl(clk_base + CLK_RESET_CCLK_BURST);
@@ -1176,15 +1177,21 @@ static void tegra30_cpu_clock_resume(void)
11761177
BUG();
11771178

11781179
if (reg != CLK_RESET_CCLK_BURST_POLICY_PLLX) {
1179-
/* restore PLLX settings if CPU is on different PLL */
1180-
writel(tegra30_cpu_clk_sctx.pllx_misc,
1181-
clk_base + CLK_RESET_PLLX_MISC);
1182-
writel(tegra30_cpu_clk_sctx.pllx_base,
1183-
clk_base + CLK_RESET_PLLX_BASE);
1184-
1185-
/* wait for PLL stabilization if PLLX was enabled */
1186-
if (tegra30_cpu_clk_sctx.pllx_base & (1 << 30))
1187-
udelay(300);
1180+
misc = readl_relaxed(clk_base + CLK_RESET_PLLX_MISC);
1181+
base = readl_relaxed(clk_base + CLK_RESET_PLLX_BASE);
1182+
1183+
if (misc != tegra30_cpu_clk_sctx.pllx_misc ||
1184+
base != tegra30_cpu_clk_sctx.pllx_base) {
1185+
/* restore PLLX settings if CPU is on different PLL */
1186+
writel(tegra30_cpu_clk_sctx.pllx_misc,
1187+
clk_base + CLK_RESET_PLLX_MISC);
1188+
writel(tegra30_cpu_clk_sctx.pllx_base,
1189+
clk_base + CLK_RESET_PLLX_BASE);
1190+
1191+
/* wait for PLL stabilization if PLLX was enabled */
1192+
if (tegra30_cpu_clk_sctx.pllx_base & (1 << 30))
1193+
udelay(300);
1194+
}
11881195
}
11891196

11901197
/*

0 commit comments

Comments
 (0)