summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorKevin Huang <kevinh@nvidia.com>2014-01-16 15:00:52 -0800
committerTerje Bergstrom <tbergstrom@nvidia.com>2014-02-02 23:58:33 -0800
commit06e45103c705fae25c0089791543a05ab4b2acd4 (patch)
tree585a7a0cc447a8c82336e80f0af891ddc4cb07c5 /drivers
parentb3b26d461552b9304af6d79e9966bdbb8b993713 (diff)
video: tegra: host: utilize gr to init sw bundle
Software bundle initilization needs to involve gr engine. We can finish it when 1st channel is created as golden image init. Bug 1387211 Change-Id: I6c7bc7466984c40ef7243c1d3a5b5f03cfd38c76 Signed-off-by: Kevin Huang <kevinh@nvidia.com> Reviewed-on: http://git-master/r/356771 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tegra/host/gk20a/gr_gk20a.c86
1 files changed, 43 insertions, 43 deletions
diff --git a/drivers/video/tegra/host/gk20a/gr_gk20a.c b/drivers/video/tegra/host/gk20a/gr_gk20a.c
index 35b8d7f3f70b..d3c9e21eac83 100644
--- a/drivers/video/tegra/host/gk20a/gr_gk20a.c
+++ b/drivers/video/tegra/host/gk20a/gr_gk20a.c
@@ -1462,6 +1462,45 @@ static int gr_gk20a_fecs_ctx_image_save(struct channel_gk20a *c, u32 save_type)
return ret;
}
+static u32 gk20a_init_sw_bundle(struct gk20a *g)
+{
+ struct av_list_gk20a *sw_bundle_init = &g->gr.ctx_vars.sw_bundle_init;
+ struct av_list_gk20a *sw_method_init = &g->gr.ctx_vars.sw_method_init;
+ u32 last_bundle_data = 0;
+ u32 err = 0;
+ int i;
+ unsigned long end_jiffies = jiffies +
+ msecs_to_jiffies(gk20a_get_gr_idle_timeout(g));
+
+ /* enable pipe mode override */
+ gk20a_writel(g, gr_pipe_bundle_config_r(),
+ gr_pipe_bundle_config_override_pipe_mode_enabled_f());
+
+ /* load bundle init */
+ for (i = 0; i < sw_bundle_init->count; i++) {
+
+ if (i == 0 || last_bundle_data != sw_bundle_init->l[i].value) {
+ gk20a_writel(g, gr_pipe_bundle_data_r(),
+ sw_bundle_init->l[i].value);
+ last_bundle_data = sw_bundle_init->l[i].value;
+ }
+
+ gk20a_writel(g, gr_pipe_bundle_address_r(),
+ sw_bundle_init->l[i].addr);
+
+ if (gr_pipe_bundle_address_value_v(sw_bundle_init->l[i].addr) ==
+ GR_GO_IDLE_BUNDLE)
+ err |= gr_gk20a_wait_idle(g, end_jiffies,
+ GR_IDLE_CHECK_DEFAULT);
+ }
+
+ /* disable pipe mode override */
+ gk20a_writel(g, gr_pipe_bundle_config_r(),
+ gr_pipe_bundle_config_override_pipe_mode_disabled_f());
+
+ return err;
+}
+
/* init global golden image from a fresh gr_ctx in channel ctx.
save a copy in local_golden_image in ctx_vars */
static int gr_gk20a_init_golden_ctx_image(struct gk20a *g,
@@ -1491,6 +1530,10 @@ static int gr_gk20a_init_golden_ctx_image(struct gk20a *g,
if (err)
goto clean_up;
+ err = gk20a_init_sw_bundle(g);
+ if (err)
+ goto clean_up;
+
err = gr_gk20a_elpg_protected_call(g,
gr_gk20a_commit_global_ctx_buffers(g, c, false));
if (err)
@@ -4301,49 +4344,6 @@ static int gk20a_init_gr_setup_hw(struct gk20a *g)
if (err)
goto restore_fe_go_idle;
- /* enable pipe mode override */
- gk20a_writel(g, gr_pipe_bundle_config_r(),
- gr_pipe_bundle_config_override_pipe_mode_enabled_f());
-
- /* load bundle init */
- err = 0;
- for (i = 0; i < sw_bundle_init->count; i++) {
-
- if (i == 0 || last_bundle_data != sw_bundle_init->l[i].value) {
- gk20a_writel(g, gr_pipe_bundle_data_r(),
- sw_bundle_init->l[i].value);
- last_bundle_data = sw_bundle_init->l[i].value;
- }
-
- gk20a_writel(g, gr_pipe_bundle_address_r(),
- sw_bundle_init->l[i].addr);
-
- if (gr_pipe_bundle_address_value_v(sw_bundle_init->l[i].addr) ==
- GR_GO_IDLE_BUNDLE)
- err |= gr_gk20a_wait_idle(g, end_jiffies,
- GR_IDLE_CHECK_DEFAULT);
- else if (0) { /* IS_SILICON */
- u32 delay = GR_IDLE_CHECK_DEFAULT;
- do {
- u32 gr_status = gk20a_readl(g, gr_status_r());
-
- if (gr_status_fe_method_lower_v(gr_status) ==
- gr_status_fe_method_lower_idle_v())
- break;
-
- usleep_range(delay, delay * 2);
- delay = min_t(u32, delay << 1,
- GR_IDLE_CHECK_MAX);
-
- } while (time_before(jiffies, end_jiffies) |
- !tegra_platform_is_silicon());
- }
- }
-
- /* disable pipe mode override */
- gk20a_writel(g, gr_pipe_bundle_config_r(),
- gr_pipe_bundle_config_override_pipe_mode_disabled_f());
-
restore_fe_go_idle:
/* restore fe_go_idle */
gk20a_writel(g, gr_fe_go_idle_timeout_r(), fe_go_idle_timeout_save);