summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2011-04-29 10:45:50 +0300
committerNiket Sirsi <nsirsi@nvidia.com>2011-06-14 16:18:55 -0700
commit83272b227d51b45df6e376d733e1878b035fb505 (patch)
tree3bbef5469fbe6d0e63bde05c324a7fb3442ea804 /arch/arm
parent1e2518ad3e5d36026257a18986e9821e11c89aa9 (diff)
nvhost: Add checks for # of GPU register sets.
Checks from a fuse whether we have one or two register sets. - fuse.h/fuse.c: Implement tegra_register_sets() - nvhost_3dctx.c: Use tegra_register_sets() to determine number of sets to save. - dev.c: Create entry /sys/module/nvhost/parameters/register_sets to return to user space the number of sets. Change-Id: Ibd9a50cfe77a642335bd85b5814e8fdd8d2c35e6 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/29786 Reviewed-by: Niket Sirsi <nsirsi@nvidia.com> Tested-by: Niket Sirsi <nsirsi@nvidia.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-tegra/fuse.c17
-rw-r--r--arch/arm/mach-tegra/include/mach/gpufuse.h19
2 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index 44107448e310..a628880f403f 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -48,6 +48,8 @@
#define FUSE_X_COORDINATE_MASK 0x1ff
#define FUSE_Y_COORDINATE 0x218
#define FUSE_Y_COORDINATE_MASK 0x1ff
+#define FUSE_GPU_INFO 0x390
+#define FUSE_GPU_INFO_MASK (1<<2)
#define FUSE_SPARE_BIT 0x244
#endif
@@ -209,6 +211,21 @@ int tegra_sku_id(void)
return sku_id;
}
+int tegra_gpu_register_sets(void)
+{
+#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
+ return 1;
+#elif defined(CONFIG_ARCH_TEGRA_3x_SOC)
+ u32 reg = readl(IO_TO_VIRT(TEGRA_CLK_RESET_BASE + FUSE_GPU_INFO));
+ if (reg & FUSE_GPU_INFO_MASK)
+ return 1;
+ else
+ return 2;
+#else
+#error ERROR! Neither 2x or 3x Tegra present
+#endif
+}
+
static enum tegra_revision tegra_decode_revision(const struct tegra_id *id)
{
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
diff --git a/arch/arm/mach-tegra/include/mach/gpufuse.h b/arch/arm/mach-tegra/include/mach/gpufuse.h
new file mode 100644
index 000000000000..4aa6cb66d5d9
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/gpufuse.h
@@ -0,0 +1,19 @@
+/*
+ * arch/arm/mach-tegra/include/mach/gpufuse.h
+ *
+ * Copyright (C) 2010-2011 NVIDIA Corporation.
+ *
+ * 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.
+ *
+ */
+
+/* Number of register sets to handle in host context switching */
+int tegra_gpu_register_sets(void);
+