diff options
author | Tom Warren <twarren@nvidia.com> | 2011-11-10 14:50:56 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2011-11-15 03:06:57 -0800 |
commit | 47d81fa441edaf8d142e0ac1e4c858f619b9a31d (patch) | |
tree | 80918364636beb6ccefce8d24ad2e71e0340619f /arch/arm/cpu/armv7/tegra-common | |
parent | 86e1bf03e7cc73a544ba114e4a589b4c2dc6eb87 (diff) |
arm: Tegra: power: make power.c/.h common for future Tegra3 LCD use
Signed-off-by: Tom Warren <twarren@nvidia.com>
BUG=none
TEST=built Seaboard and Waluigi OK. Booted Waluigi OK.
Change-Id: I1bfbe03945d7dae44e0840349b9698fc08cef07d
Reviewed-on: https://gerrit.chromium.org/gerrit/11504
Tested-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Diffstat (limited to 'arch/arm/cpu/armv7/tegra-common')
-rw-r--r-- | arch/arm/cpu/armv7/tegra-common/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/cpu/armv7/tegra-common/power.c | 55 |
2 files changed, 56 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv7/tegra-common/Makefile b/arch/arm/cpu/armv7/tegra-common/Makefile index 577a342694..226d190447 100644 --- a/arch/arm/cpu/armv7/tegra-common/Makefile +++ b/arch/arm/cpu/armv7/tegra-common/Makefile @@ -31,7 +31,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)libtegra-common.o SOBJS-y := lowlevel_init.o -COBJS-y := ap20.o board.o clock.o timer.o +COBJS-y := ap20.o board.o clock.o power.o timer.o SOBJS := $(SOBJS-y) COBJS := $(COBJS-y) diff --git a/arch/arm/cpu/armv7/tegra-common/power.c b/arch/arm/cpu/armv7/tegra-common/power.c new file mode 100644 index 0000000000..d337bf0955 --- /dev/null +++ b/arch/arm/cpu/armv7/tegra-common/power.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011 The Chromium OS Authors. + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +/* Tegra2 power control functions */ + +#include <asm/io.h> +#include <asm/arch-tegra/bitfield.h> +#include <asm/arch/clock.h> +#include <asm/arch-tegra/pmc.h> +#include <asm/arch-tegra/power.h> +#include <asm/arch/tegra.h> +#include <common.h> + +void power_enable_partition(enum power_partition_id id) +{ + struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; + enum power_partition_id clamp_id = id; + + /* The order of these operations is important */ + reset_set_enable(PERIPH_ID_3D, 1); + + /* Turn the power gate on if it's not on already */ + if (!(readl(&pmc->pmc_pwrgate_status) & (1 << id))) + writel(PWRGATE_ENABLE | id, &pmc->pmc_pwrgate_toggle); + + clock_enable(PERIPH_ID_3D); + udelay(10); + + /* The SOC switches these IDs for clamping */ + if (clamp_id == POWERP_PCI) + clamp_id = POWERP_VIDEO_DEC; + else if (clamp_id == POWERP_VIDEO_DEC) + clamp_id = POWERP_PCI; + writel(1 << clamp_id, &pmc->pmc_remove_clamping); + + reset_set_enable(PERIPH_ID_3D, 0); +} |