-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARM: tegra30: cpuidle: add powered-down state for secondary CPUs
This supports power-gated idle on secondary CPUs for Tegra30. The secondary CPUs can go into powered-down state independently. When CPU goes into this state, it saves it's contexts and puts itself to flow controlled WFI state. After that, it will been power gated. Be aware of that, you may see the legacy power state "LP2" in the code which is exactly the same meaning of "CPU power down". Based on the work by: Scott Williams <scwilliams@nvidia.com> Signed-off-by: Joseph Lo <josephl@nvidia.com> Signed-off-by: Stephen Warren <swarren@nvidia.com>
- Loading branch information
Joseph Lo
authored and
Stephen Warren
committed
Nov 15, 2012
1 parent
d3f2936
commit d457ef3
Showing
8 changed files
with
253 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* CPU complex suspend & resume functions for Tegra SoCs | ||
* | ||
* Copyright (c) 2009-2012, NVIDIA Corporation. All rights reserved. | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/spinlock.h> | ||
#include <linux/io.h> | ||
#include <linux/cpumask.h> | ||
|
||
#include "iomap.h" | ||
#include "reset.h" | ||
|
||
#ifdef CONFIG_PM_SLEEP | ||
static unsigned int g_diag_reg; | ||
static DEFINE_SPINLOCK(tegra_lp2_lock); | ||
|
||
void save_cpu_arch_register(void) | ||
{ | ||
/* read diagnostic register */ | ||
asm("mrc p15, 0, %0, c15, c0, 1" : "=r"(g_diag_reg) : : "cc"); | ||
return; | ||
} | ||
|
||
void restore_cpu_arch_register(void) | ||
{ | ||
/* write diagnostic register */ | ||
asm("mcr p15, 0, %0, c15, c0, 1" : : "r"(g_diag_reg) : "cc"); | ||
return; | ||
} | ||
|
||
void __cpuinit tegra_clear_cpu_in_lp2(int phy_cpu_id) | ||
{ | ||
u32 *cpu_in_lp2 = tegra_cpu_lp2_mask; | ||
|
||
spin_lock(&tegra_lp2_lock); | ||
|
||
BUG_ON(!(*cpu_in_lp2 & BIT(phy_cpu_id))); | ||
*cpu_in_lp2 &= ~BIT(phy_cpu_id); | ||
|
||
spin_unlock(&tegra_lp2_lock); | ||
} | ||
|
||
bool __cpuinit tegra_set_cpu_in_lp2(int phy_cpu_id) | ||
{ | ||
bool last_cpu = false; | ||
cpumask_t *cpu_lp2_mask = tegra_cpu_lp2_mask; | ||
u32 *cpu_in_lp2 = tegra_cpu_lp2_mask; | ||
|
||
spin_lock(&tegra_lp2_lock); | ||
|
||
BUG_ON((*cpu_in_lp2 & BIT(phy_cpu_id))); | ||
*cpu_in_lp2 |= BIT(phy_cpu_id); | ||
|
||
if ((phy_cpu_id == 0) && cpumask_equal(cpu_lp2_mask, cpu_online_mask)) | ||
last_cpu = true; | ||
|
||
spin_unlock(&tegra_lp2_lock); | ||
return last_cpu; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2010 Google, Inc. | ||
* Copyright (c) 2010-2012 NVIDIA Corporation. All rights reserved. | ||
* | ||
* Author: | ||
* Colin Cross <ccross@google.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms and conditions of the GNU General Public License, | ||
* version 2, as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef _MACH_TEGRA_PM_H_ | ||
#define _MACH_TEGRA_PM_H_ | ||
|
||
void save_cpu_arch_register(void); | ||
void restore_cpu_arch_register(void); | ||
|
||
void tegra_clear_cpu_in_lp2(int phy_cpu_id); | ||
bool tegra_set_cpu_in_lp2(int phy_cpu_id); | ||
|
||
#endif /* _MACH_TEGRA_PM_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters