speedo-tegra114.c (a02001086bbfb4da35d1228bebc2f1b442db455f) speedo-tegra114.c (7e939de1b2bb26496e4967e5346619700245e7c0)
1/*
2 * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT

--- 60 unchanged lines hidden (view full) ---

69 pr_err("Tegra Unknown SKU %d\n", sku);
70 sku_info->cpu_speedo_id = 0;
71 sku_info->soc_speedo_id = 0;
72 *threshold = THRESHOLD_INDEX_0;
73 break;
74 }
75
76 if (rev == TEGRA_REVISION_A01) {
1/*
2 * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT

--- 60 unchanged lines hidden (view full) ---

69 pr_err("Tegra Unknown SKU %d\n", sku);
70 sku_info->cpu_speedo_id = 0;
71 sku_info->soc_speedo_id = 0;
72 *threshold = THRESHOLD_INDEX_0;
73 break;
74 }
75
76 if (rev == TEGRA_REVISION_A01) {
77 tmp = tegra30_fuse_readl(0x270) << 1;
78 tmp |= tegra30_fuse_readl(0x26c);
77 tmp = tegra_fuse_read_early(0x270) << 1;
78 tmp |= tegra_fuse_read_early(0x26c);
79 if (!tmp)
80 sku_info->cpu_speedo_id = 0;
81 }
82}
83
84void __init tegra114_init_speedo_data(struct tegra_sku_info *sku_info)
85{
86 u32 cpu_speedo_val;
87 u32 core_speedo_val;
88 int threshold;
89 int i;
90
91 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) !=
92 THRESHOLD_INDEX_COUNT);
93 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) !=
94 THRESHOLD_INDEX_COUNT);
95
96 rev_sku_to_speedo_ids(sku_info, &threshold);
97
79 if (!tmp)
80 sku_info->cpu_speedo_id = 0;
81 }
82}
83
84void __init tegra114_init_speedo_data(struct tegra_sku_info *sku_info)
85{
86 u32 cpu_speedo_val;
87 u32 core_speedo_val;
88 int threshold;
89 int i;
90
91 BUILD_BUG_ON(ARRAY_SIZE(cpu_process_speedos) !=
92 THRESHOLD_INDEX_COUNT);
93 BUILD_BUG_ON(ARRAY_SIZE(core_process_speedos) !=
94 THRESHOLD_INDEX_COUNT);
95
96 rev_sku_to_speedo_ids(sku_info, &threshold);
97
98 cpu_speedo_val = tegra30_fuse_readl(0x12c) + 1024;
99 core_speedo_val = tegra30_fuse_readl(0x134);
98 cpu_speedo_val = tegra_fuse_read_early(0x12c) + 1024;
99 core_speedo_val = tegra_fuse_read_early(0x134);
100
101 for (i = 0; i < CPU_PROCESS_CORNERS; i++)
102 if (cpu_speedo_val < cpu_process_speedos[threshold][i])
103 break;
104 sku_info->cpu_process_id = i;
105
106 for (i = 0; i < CORE_PROCESS_CORNERS; i++)
107 if (core_speedo_val < core_process_speedos[threshold][i])
108 break;
109 sku_info->core_process_id = i;
110}
100
101 for (i = 0; i < CPU_PROCESS_CORNERS; i++)
102 if (cpu_speedo_val < cpu_process_speedos[threshold][i])
103 break;
104 sku_info->cpu_process_id = i;
105
106 for (i = 0; i < CORE_PROCESS_CORNERS; i++)
107 if (core_speedo_val < core_process_speedos[threshold][i])
108 break;
109 sku_info->core_process_id = i;
110}