diff options
author | Erik Gilling <konkers@android.com> | 2010-10-29 17:59:33 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2012-03-21 22:12:20 -0700 |
commit | 146270c185e45ba8450ab8452104ff67dcc62d89 (patch) | |
tree | 66b0c9ffda181cb9355e2c819dff7910eeb20894 /arch/arm/mach-tegra/mc.c | |
parent | 10b7ae06709acea5bc2541e5a45d88e5fde6565d (diff) |
[ARM] tegra: add API to set memory client priority
Change-Id: Id9b157004f7364fb1f7aaffa925b710dcfb90e86
Signed-off-by: Erik Gilling <konkers@android.com>
Rebase-Id: R788e2f689e5ed38698e31993fb88de59f19eb7f9
Diffstat (limited to 'arch/arm/mach-tegra/mc.c')
-rw-r--r-- | arch/arm/mach-tegra/mc.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/mc.c b/arch/arm/mach-tegra/mc.c new file mode 100644 index 000000000000..513ac3f5cf4d --- /dev/null +++ b/arch/arm/mach-tegra/mc.c @@ -0,0 +1,42 @@ +/* + * arch/arm/mach-tegra/mc.c + * + * Copyright (C) 2010 Google, Inc. + * + * Author: + * Erik Gilling <konkers@google.com> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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. + * + */ + +#include <linux/io.h> +#include <linux/spinlock.h> + +#include <mach/iomap.h> +#include <mach/mc.h> + +static DEFINE_SPINLOCK(tegra_mc_lock); + +void tegra_mc_set_priority(unsigned long client, unsigned long prio) +{ + unsigned long mc_base = IO_TO_VIRT(TEGRA_MC_BASE); + unsigned long reg = client >> 8; + int field = client & 0xff; + unsigned long val; + unsigned long flags; + + spin_lock_irqsave(&tegra_mc_lock, flags); + val = readl(mc_base + reg); + val &= ~(TEGRA_MC_PRIO_MASK << field); + val |= prio << field; + writel(val, mc_base + reg); + spin_unlock_irqrestore(&tegra_mc_lock, flags); +} |