diff options
Diffstat (limited to '')
-rw-r--r-- | drivers/soc/tegra/fuse/speedo-tegra114.c (renamed from arch/arm/mach-tegra/tegra114_speedo.c) | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/arch/arm/mach-tegra/tegra114_speedo.c b/drivers/soc/tegra/fuse/speedo-tegra114.c index 5218d4853cd3..2a6ca036f09f 100644 --- a/arch/arm/mach-tegra/tegra114_speedo.c +++ b/drivers/soc/tegra/fuse/speedo-tegra114.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -14,13 +14,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <linux/kernel.h> #include <linux/bug.h> +#include <linux/device.h> +#include <linux/kernel.h> + +#include <soc/tegra/fuse.h> #include "fuse.h" -#define CORE_PROCESS_CORNERS_NUM 2 -#define CPU_PROCESS_CORNERS_NUM 2 +#define CORE_PROCESS_CORNERS 2 +#define CPU_PROCESS_CORNERS 2 enum { THRESHOLD_INDEX_0, @@ -28,54 +31,57 @@ enum { THRESHOLD_INDEX_COUNT, }; -static const u32 core_process_speedos[][CORE_PROCESS_CORNERS_NUM] = { +static const u32 __initconst core_process_speedos[][CORE_PROCESS_CORNERS] = { {1123, UINT_MAX}, {0, UINT_MAX}, }; -static const u32 cpu_process_speedos[][CPU_PROCESS_CORNERS_NUM] = { +static const u32 __initconst cpu_process_speedos[][CPU_PROCESS_CORNERS] = { {1695, UINT_MAX}, {0, UINT_MAX}, }; -static void rev_sku_to_speedo_ids(int rev, int sku, int *threshold) +static void __init rev_sku_to_speedo_ids(struct tegra_sku_info *sku_info, + int *threshold) { u32 tmp; + u32 sku = sku_info->sku_id; + enum tegra_revision rev = sku_info->revision; switch (sku) { case 0x00: case 0x10: case 0x05: case 0x06: - tegra_cpu_speedo_id = 1; - tegra_soc_speedo_id = 0; + sku_info->cpu_speedo_id = 1; + sku_info->soc_speedo_id = 0; *threshold = THRESHOLD_INDEX_0; break; case 0x03: case 0x04: - tegra_cpu_speedo_id = 2; - tegra_soc_speedo_id = 1; + sku_info->cpu_speedo_id = 2; + sku_info->soc_speedo_id = 1; *threshold = THRESHOLD_INDEX_1; break; default: - pr_err("Tegra114 Unknown SKU %d\n", sku); - tegra_cpu_speedo_id = 0; - tegra_soc_speedo_id = 0; + pr_err("Tegra Unknown SKU %d\n", sku); + sku_info->cpu_speedo_id = 0; + sku_info->soc_speedo_id = 0; *threshold = THRESHOLD_INDEX_0; break; } if (rev == TEGRA_REVISION_A01) { - tmp = tegra_fuse_readl(0x270) << 1; - tmp |= tegra_fuse_readl(0x26c); + tmp = tegra30_fuse_readl(0x270) << 1; + tmp |= tegra30_fuse_readl(0x26c); if (!tmp) - tegra_cpu_speedo_id = 0; + sku_info->cpu_speedo_id = 0; } } -void tegra114_init_speedo_data(void) +void __init tegra114_init_speedo_data(struct tegra_sku_info *sku_info) { u32 cpu_speedo_val; u32 core_speedo_val; @@ -87,18 +93,18 @@ void tegra114_init_speedo_data(void) BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) != THRESHOLD_INDEX_COUNT); - rev_sku_to_speedo_ids(tegra_revision, tegra_sku_id, &threshold); + rev_sku_to_speedo_ids(sku_info, &threshold); - cpu_speedo_val = tegra_fuse_readl(0x12c) + 1024; - core_speedo_val = tegra_fuse_readl(0x134); + cpu_speedo_val = tegra30_fuse_readl(0x12c) + 1024; + core_speedo_val = tegra30_fuse_readl(0x134); - for (i = 0; i < CPU_PROCESS_CORNERS_NUM; i++) + for (i = 0; i < CPU_PROCESS_CORNERS; i++) if (cpu_speedo_val < cpu_process_speedos[threshold][i]) break; - tegra_cpu_process_id = i; + sku_info->cpu_process_id = i; - for (i = 0; i < CORE_PROCESS_CORNERS_NUM; i++) + for (i = 0; i < CORE_PROCESS_CORNERS; i++) if (core_speedo_val < core_process_speedos[threshold][i]) break; - tegra_core_process_id = i; + sku_info->core_process_id = i; } |