-
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: tegra: functions to access the flowcontroller
Introduce some functions to write to the flowcontroller registers. The flowcontroller controls CPU sleepstates and wakeup. Signed-off-by: Peter De Schrijver <pdeschrijver@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Olof Johansson <olof@lixom.net>
- Loading branch information
Peter De Schrijver
authored and
Olof Johansson
committed
Feb 26, 2012
1 parent
cec6006
commit 26fe681
Showing
3 changed files
with
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* arch/arm/mach-tegra/flowctrl.c | ||
* | ||
* functions and macros to control the flowcontroller | ||
* | ||
* Copyright (c) 2010-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 that 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/init.h> | ||
#include <linux/kernel.h> | ||
#include <linux/io.h> | ||
|
||
#include <mach/iomap.h> | ||
|
||
#include "flowctrl.h" | ||
|
||
u8 flowctrl_offset_halt_cpu[] = { | ||
FLOW_CTRL_HALT_CPU0_EVENTS, | ||
FLOW_CTRL_HALT_CPU1_EVENTS, | ||
FLOW_CTRL_HALT_CPU1_EVENTS + 8, | ||
FLOW_CTRL_HALT_CPU1_EVENTS + 16, | ||
}; | ||
|
||
u8 flowctrl_offset_cpu_csr[] = { | ||
FLOW_CTRL_CPU0_CSR, | ||
FLOW_CTRL_CPU1_CSR, | ||
FLOW_CTRL_CPU1_CSR + 8, | ||
FLOW_CTRL_CPU1_CSR + 16, | ||
}; | ||
|
||
static void flowctrl_update(u8 offset, u32 value) | ||
{ | ||
void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset; | ||
|
||
writel(value, addr); | ||
|
||
/* ensure the update has reached the flow controller */ | ||
wmb(); | ||
readl_relaxed(addr); | ||
} | ||
|
||
void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value) | ||
{ | ||
return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value); | ||
} | ||
|
||
void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value) | ||
{ | ||
return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value); | ||
} |
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