diff options
author | Simon Glass <sjg@chromium.org> | 2011-05-19 18:08:10 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:15 -0700 |
commit | bdcabf5894788e258c7449b0f44e759e943b262b (patch) | |
tree | 792e8dbf54f5f997080e7d36fcea66c0dc8e089e /arch/arm/cpu/armv7 | |
parent | 282901f58cef5136db58b1f35214e33eeaea966f (diff) |
tegra2: Add power control functions
WIP: needs clean-up
BUG=chromium-os:13228
TEST=Build, boot on Seaboard
Change-Id: I901015da144991e93a1f3d8d3c74011e755e0565
Reviewed-on: http://gerrit.chromium.org/gerrit/1291
Reviewed-by: Tom Warren <twarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/arm/cpu/armv7')
-rw-r--r-- | arch/arm/cpu/armv7/tegra2/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/cpu/armv7/tegra2/power.c | 54 |
2 files changed, 55 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv7/tegra2/Makefile b/arch/arm/cpu/armv7/tegra2/Makefile index e23b8e87bf2..1be67d7f5e5 100644 --- a/arch/arm/cpu/armv7/tegra2/Makefile +++ b/arch/arm/cpu/armv7/tegra2/Makefile @@ -33,7 +33,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o SOBJS := lowlevel_init.o -COBJS := ap20.o board.o clock.o pinmux.o pwfm.o sys_info.o timer.o +COBJS := ap20.o board.o clock.o pinmux.o power.o pwfm.o sys_info.o timer.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/arch/arm/cpu/armv7/tegra2/power.c b/arch/arm/cpu/armv7/tegra2/power.c new file mode 100644 index 00000000000..60821d4108f --- /dev/null +++ b/arch/arm/cpu/armv7/tegra2/power.c @@ -0,0 +1,54 @@ +/* + * 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/bitfield.h> +#include <asm/arch/clock.h> +#include <asm/arch/pmc.h> +#include <asm/arch/power.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(id, 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(id); + 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(id, 0); +} |