summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-02-09 11:17:47 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-02-17 16:46:32 -0500
commit53465def649b813987ca0d4a7ced744305204b82 (patch)
treecdff16681cb0442de3b1a8bd151b2a38c0bc5311 /drivers/gpu/nvgpu/clk
parent29a79e6b80c6a0da489d8b0a470c86e2fec9c355 (diff)
gpu: nvgpu: Generalize BIOS code
Most of BIOS parsing code is not specific to any particular GPU. Move most of the code to generic files, and leave only chip specific parts dealing with microcontroller boot into chip specific files. As most of the parsing is generic, they do not need to be called via HALs so remove the HALs and change the calls into direct function calls. All definitions meant to be used outside BIOS code itself are now in <nvgpu/bios.h> Change-Id: Id48e94c74511d6e95645e90e5bba5c12ef8da45d Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1302222 GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/clk')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_domain.c9
-rw-r--r--drivers/gpu/nvgpu/clk/clk_fll.c9
-rw-r--r--drivers/gpu/nvgpu/clk/clk_freq_controller.c19
-rw-r--r--drivers/gpu/nvgpu/clk/clk_mclk.c21
-rw-r--r--drivers/gpu/nvgpu/clk/clk_prog.c10
-rw-r--r--drivers/gpu/nvgpu/clk/clk_vf_point.c2
-rw-r--r--drivers/gpu/nvgpu/clk/clk_vin.c10
7 files changed, 26 insertions, 54 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_domain.c b/drivers/gpu/nvgpu/clk/clk_domain.c
index b53d3708..2a614f55 100644
--- a/drivers/gpu/nvgpu/clk/clk_domain.c
+++ b/drivers/gpu/nvgpu/clk/clk_domain.c
@@ -11,14 +11,14 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include <nvgpu/bios.h>
15
14#include "gk20a/gk20a.h" 16#include "gk20a/gk20a.h"
15#include "clk.h" 17#include "clk.h"
16#include "clk_fll.h" 18#include "clk_fll.h"
17#include "clk_domain.h" 19#include "clk_domain.h"
18#include "include/bios.h"
19#include "boardobj/boardobjgrp.h" 20#include "boardobj/boardobjgrp.h"
20#include "boardobj/boardobjgrp_e32.h" 21#include "boardobj/boardobjgrp_e32.h"
21#include "gm206/bios_gm206.h"
22#include "ctrl/ctrlclk.h" 22#include "ctrl/ctrlclk.h"
23#include "ctrl/ctrlvolt.h" 23#include "ctrl/ctrlvolt.h"
24#include "gk20a/pmu_gk20a.h" 24#include "gk20a/pmu_gk20a.h"
@@ -261,10 +261,7 @@ static u32 devinit_get_clocks_table(struct gk20a *g,
261 261
262 gk20a_dbg_info(""); 262 gk20a_dbg_info("");
263 263
264 if (!g->ops.bios.get_perf_table_ptrs) 264 clocks_table_ptr = (u8 *)nvgpu_bios_get_perf_table_ptrs(g,
265 return -EINVAL;
266
267 clocks_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
268 g->bios.clock_token, CLOCKS_TABLE); 265 g->bios.clock_token, CLOCKS_TABLE);
269 if (clocks_table_ptr == NULL) { 266 if (clocks_table_ptr == NULL) {
270 status = -EINVAL; 267 status = -EINVAL;
diff --git a/drivers/gpu/nvgpu/clk/clk_fll.c b/drivers/gpu/nvgpu/clk/clk_fll.c
index 91cd0e20..7694e720 100644
--- a/drivers/gpu/nvgpu/clk/clk_fll.c
+++ b/drivers/gpu/nvgpu/clk/clk_fll.c
@@ -11,13 +11,13 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include <nvgpu/bios.h>
15
14#include "gk20a/gk20a.h" 16#include "gk20a/gk20a.h"
15#include "clk.h" 17#include "clk.h"
16#include "clk_fll.h" 18#include "clk_fll.h"
17#include "include/bios.h"
18#include "boardobj/boardobjgrp.h" 19#include "boardobj/boardobjgrp.h"
19#include "boardobj/boardobjgrp_e32.h" 20#include "boardobj/boardobjgrp_e32.h"
20#include "gm206/bios_gm206.h"
21#include "ctrl/ctrlclk.h" 21#include "ctrl/ctrlclk.h"
22#include "ctrl/ctrlvolt.h" 22#include "ctrl/ctrlvolt.h"
23#include "gk20a/pmu_gk20a.h" 23#include "gk20a/pmu_gk20a.h"
@@ -234,10 +234,7 @@ static u32 devinit_get_fll_device_table(struct gk20a *g,
234 234
235 gk20a_dbg_info(""); 235 gk20a_dbg_info("");
236 236
237 if (!g->ops.bios.get_perf_table_ptrs) 237 fll_table_ptr = (u8 *)nvgpu_bios_get_perf_table_ptrs(g,
238 return -EINVAL;
239
240 fll_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
241 g->bios.clock_token, FLL_TABLE); 238 g->bios.clock_token, FLL_TABLE);
242 if (fll_table_ptr == NULL) { 239 if (fll_table_ptr == NULL) {
243 status = -1; 240 status = -1;
diff --git a/drivers/gpu/nvgpu/clk/clk_freq_controller.c b/drivers/gpu/nvgpu/clk/clk_freq_controller.c
index 6fa2db5a..4b47d978 100644
--- a/drivers/gpu/nvgpu/clk/clk_freq_controller.c
+++ b/drivers/gpu/nvgpu/clk/clk_freq_controller.c
@@ -11,15 +11,15 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include <nvgpu/bios.h>
15
14#include "gk20a/gk20a.h" 16#include "gk20a/gk20a.h"
15#include "clk.h" 17#include "clk.h"
16#include "clk_fll.h" 18#include "clk_fll.h"
17#include "clk_domain.h" 19#include "clk_domain.h"
18#include "clk_freq_controller.h" 20#include "clk_freq_controller.h"
19#include "include/bios.h"
20#include "boardobj/boardobjgrp.h" 21#include "boardobj/boardobjgrp.h"
21#include "boardobj/boardobjgrp_e32.h" 22#include "boardobj/boardobjgrp_e32.h"
22#include "gm206/bios_gm206.h"
23#include "ctrl/ctrlclk.h" 23#include "ctrl/ctrlclk.h"
24#include "ctrl/ctrlvolt.h" 24#include "ctrl/ctrlvolt.h"
25#include "gk20a/pmu_gk20a.h" 25#include "gk20a/pmu_gk20a.h"
@@ -185,16 +185,11 @@ static u32 clk_get_freq_controller_table(struct gk20a *g,
185 }; 185 };
186 } freq_controller_data; 186 } freq_controller_data;
187 187
188 if (g->ops.bios.get_perf_table_ptrs) { 188 pfreq_controller_table_ptr =
189 pfreq_controller_table_ptr = 189 (u8 *)nvgpu_bios_get_perf_table_ptrs(g,
190 (u8 *)g->ops.bios.get_perf_table_ptrs(g, 190 g->bios.clock_token,
191 g->bios.clock_token, 191 FREQUENCY_CONTROLLER_TABLE);
192 FREQUENCY_CONTROLLER_TABLE); 192 if (pfreq_controller_table_ptr == NULL) {
193 if (pfreq_controller_table_ptr == NULL) {
194 status = -EINVAL;
195 goto done;
196 }
197 } else {
198 status = -EINVAL; 193 status = -EINVAL;
199 goto done; 194 goto done;
200 } 195 }
diff --git a/drivers/gpu/nvgpu/clk/clk_mclk.c b/drivers/gpu/nvgpu/clk/clk_mclk.c
index 479fbb0e..815f55ba 100644
--- a/drivers/gpu/nvgpu/clk/clk_mclk.c
+++ b/drivers/gpu/nvgpu/clk/clk_mclk.c
@@ -13,12 +13,10 @@
13 13
14#include <linux/delay.h> 14#include <linux/delay.h>
15 15
16#include <nvgpu/bios.h>
17
16#include "gk20a/gk20a.h" 18#include "gk20a/gk20a.h"
17#include "gk20a/pmu_gk20a.h" 19#include "gk20a/pmu_gk20a.h"
18#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h>
19#include "gm206/bios_gm206.h"
20
21#include "include/bios.h"
22 20
23#include <nvgpu/hw/gk20a/hw_pwr_gk20a.h> 21#include <nvgpu/hw/gk20a/hw_pwr_gk20a.h>
24#include <nvgpu/hw/gp106/hw_fb_gp106.h> 22#include <nvgpu/hw/gp106/hw_fb_gp106.h>
@@ -2022,12 +2020,7 @@ static int mclk_get_memclk_table(struct gk20a *g)
2022 2020
2023 gk20a_dbg_info(""); 2021 gk20a_dbg_info("");
2024 2022
2025 if (!(g->ops.bios.get_perf_table_ptrs && 2023 mem_table_ptr = (u8 *)nvgpu_bios_get_perf_table_ptrs(g,
2026 g->ops.bios.execute_script)) {
2027 goto done;
2028 }
2029
2030 mem_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
2031 g->bios.perf_token, 2024 g->bios.perf_token,
2032 MEMORY_CLOCK_TABLE); 2025 MEMORY_CLOCK_TABLE);
2033 if (mem_table_ptr == NULL) { 2026 if (mem_table_ptr == NULL) {
@@ -2067,7 +2060,7 @@ static int mclk_get_memclk_table(struct gk20a *g)
2067 script_index = BIOS_GET_FIELD(memclock_base_entry.flags1, 2060 script_index = BIOS_GET_FIELD(memclock_base_entry.flags1,
2068 VBIOS_MEMORY_CLOCK_BASE_ENTRY_11_FLAGS1_SCRIPT_INDEX); 2061 VBIOS_MEMORY_CLOCK_BASE_ENTRY_11_FLAGS1_SCRIPT_INDEX);
2069 2062
2070 script_ptr = gm206_bios_read_u32(g, 2063 script_ptr = nvgpu_bios_read_u32(g,
2071 memclock_table_header.script_list_ptr + 2064 memclock_table_header.script_list_ptr +
2072 script_index * sizeof(u32)); 2065 script_index * sizeof(u32));
2073 2066
@@ -2107,7 +2100,7 @@ static int mclk_get_memclk_table(struct gk20a *g)
2107 fb_fbpa_fbio_delay_priv_m(), 2100 fb_fbpa_fbio_delay_priv_m(),
2108 fb_fbpa_fbio_delay_priv_f(shadow_idx))); 2101 fb_fbpa_fbio_delay_priv_f(shadow_idx)));
2109 2102
2110 status = g->ops.bios.execute_script(g, script_ptr); 2103 status = nvgpu_bios_execute_script(g, script_ptr);
2111 if (status < 0) { 2104 if (status < 0) {
2112 gk20a_writel(g, fb_fbpa_fbio_delay_r(), 2105 gk20a_writel(g, fb_fbpa_fbio_delay_r(),
2113 old_fbio_delay); 2106 old_fbio_delay);
@@ -2121,7 +2114,7 @@ static int mclk_get_memclk_table(struct gk20a *g)
2121 cmd_script_index = BIOS_GET_FIELD(memclock_base_entry.flags2, 2114 cmd_script_index = BIOS_GET_FIELD(memclock_base_entry.flags2,
2122 VBIOS_MEMORY_CLOCK_BASE_ENTRY_12_FLAGS2_CMD_SCRIPT_INDEX); 2115 VBIOS_MEMORY_CLOCK_BASE_ENTRY_12_FLAGS2_CMD_SCRIPT_INDEX);
2123 2116
2124 cmd_script_ptr = gm206_bios_read_u32(g, 2117 cmd_script_ptr = nvgpu_bios_read_u32(g,
2125 memclock_table_header.cmd_script_list_ptr + 2118 memclock_table_header.cmd_script_list_ptr +
2126 cmd_script_index * sizeof(u32)); 2119 cmd_script_index * sizeof(u32));
2127 2120
@@ -2159,7 +2152,7 @@ static int mclk_get_memclk_table(struct gk20a *g)
2159 fb_fbpa_fbio_cmd_delay_cmd_priv_f( 2152 fb_fbpa_fbio_cmd_delay_cmd_priv_f(
2160 cmd_idx))); 2153 cmd_idx)));
2161 2154
2162 status = g->ops.bios.execute_script(g, cmd_script_ptr); 2155 status = nvgpu_bios_execute_script(g, cmd_script_ptr);
2163 if (status < 0) { 2156 if (status < 0) {
2164 gk20a_writel(g, fb_fbpa_fbio_cmd_delay_r(), 2157 gk20a_writel(g, fb_fbpa_fbio_cmd_delay_r(),
2165 old_fbio_cmd_delay); 2158 old_fbio_cmd_delay);
diff --git a/drivers/gpu/nvgpu/clk/clk_prog.c b/drivers/gpu/nvgpu/clk/clk_prog.c
index 38654b66..b4f6a464 100644
--- a/drivers/gpu/nvgpu/clk/clk_prog.c
+++ b/drivers/gpu/nvgpu/clk/clk_prog.c
@@ -11,11 +11,12 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include <nvgpu/bios.h>
15
14#include "gk20a/gk20a.h" 16#include "gk20a/gk20a.h"
15#include "clk.h" 17#include "clk.h"
16#include "clk_prog.h" 18#include "clk_prog.h"
17#include "clk_vf_point.h" 19#include "clk_vf_point.h"
18#include "include/bios.h"
19#include "boardobj/boardobjgrp.h" 20#include "boardobj/boardobjgrp.h"
20#include "boardobj/boardobjgrp_e32.h" 21#include "boardobj/boardobjgrp_e32.h"
21#include "gm206/bios_gm206.h" 22#include "gm206/bios_gm206.h"
@@ -180,12 +181,7 @@ static u32 devinit_get_clk_prog_table(struct gk20a *g,
180 181
181 gk20a_dbg_info(""); 182 gk20a_dbg_info("");
182 183
183 if (!g->ops.bios.get_perf_table_ptrs) { 184 clkprogs_tbl_ptr = (u8 *)nvgpu_bios_get_perf_table_ptrs(g,
184 status = -EINVAL;
185 goto done;
186 }
187
188 clkprogs_tbl_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
189 g->bios.clock_token, CLOCK_PROGRAMMING_TABLE); 185 g->bios.clock_token, CLOCK_PROGRAMMING_TABLE);
190 if (clkprogs_tbl_ptr == NULL) { 186 if (clkprogs_tbl_ptr == NULL) {
191 status = -EINVAL; 187 status = -EINVAL;
diff --git a/drivers/gpu/nvgpu/clk/clk_vf_point.c b/drivers/gpu/nvgpu/clk/clk_vf_point.c
index 58eeb6c2..f4019f9d 100644
--- a/drivers/gpu/nvgpu/clk/clk_vf_point.c
+++ b/drivers/gpu/nvgpu/clk/clk_vf_point.c
@@ -14,10 +14,8 @@
14#include "gk20a/gk20a.h" 14#include "gk20a/gk20a.h"
15#include "clk.h" 15#include "clk.h"
16#include "clk_vf_point.h" 16#include "clk_vf_point.h"
17#include "include/bios.h"
18#include "boardobj/boardobjgrp.h" 17#include "boardobj/boardobjgrp.h"
19#include "boardobj/boardobjgrp_e32.h" 18#include "boardobj/boardobjgrp_e32.h"
20#include "gm206/bios_gm206.h"
21#include "ctrl/ctrlclk.h" 19#include "ctrl/ctrlclk.h"
22#include "ctrl/ctrlvolt.h" 20#include "ctrl/ctrlvolt.h"
23#include "gk20a/pmu_gk20a.h" 21#include "gk20a/pmu_gk20a.h"
diff --git a/drivers/gpu/nvgpu/clk/clk_vin.c b/drivers/gpu/nvgpu/clk/clk_vin.c
index 13358335..af388671 100644
--- a/drivers/gpu/nvgpu/clk/clk_vin.c
+++ b/drivers/gpu/nvgpu/clk/clk_vin.c
@@ -11,9 +11,9 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#include "gk20a/gk20a.h" 14#include <nvgpu/bios.h>
15 15
16#include "include/bios.h" 16#include "gk20a/gk20a.h"
17 17
18#include "boardobj/boardobjgrp.h" 18#include "boardobj/boardobjgrp.h"
19#include "boardobj/boardobjgrp_e32.h" 19#include "boardobj/boardobjgrp_e32.h"
@@ -28,7 +28,6 @@
28#include "clk.h" 28#include "clk.h"
29#include "clk_vin.h" 29#include "clk_vin.h"
30 30
31
32#include <nvgpu/hw/gp106/hw_fuse_gp106.h> 31#include <nvgpu/hw/gp106/hw_fuse_gp106.h>
33 32
34static u32 devinit_get_vin_device_table(struct gk20a *g, 33static u32 devinit_get_vin_device_table(struct gk20a *g,
@@ -349,10 +348,7 @@ static u32 devinit_get_vin_device_table(struct gk20a *g,
349 348
350 gk20a_dbg_info(""); 349 gk20a_dbg_info("");
351 350
352 if (!g->ops.bios.get_perf_table_ptrs) 351 vin_table_ptr = (u8 *)nvgpu_bios_get_perf_table_ptrs(g,
353 return -EINVAL;
354
355 vin_table_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
356 g->bios.clock_token, VIN_TABLE); 352 g->bios.clock_token, VIN_TABLE);
357 if (vin_table_ptr == NULL) { 353 if (vin_table_ptr == NULL) {
358 status = -1; 354 status = -1;