diff options
author | Erik Gilling <konkers@android.com> | 2010-10-29 17:59:33 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:36:35 -0800 |
commit | e3718ddbdb23aa32cf9d09592ac1896faab58790 (patch) | |
tree | ba5d071cce02c082b25723a78dfc7ada853beb04 /arch/arm/mach-tegra/mc.c | |
parent | 032c6effbcbaf54e37e4fb380cebea6cfa956200 (diff) |
[ARM] tegra: add API to set memory client priority
Change-Id: Id9b157004f7364fb1f7aaffa925b710dcfb90e86
Signed-off-by: Erik Gilling <konkers@android.com>
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); +} |