diff options
author | Adeel Raza <araza@nvidia.com> | 2016-05-03 20:42:07 -0400 |
---|---|---|
committer | Deepak Nibade <dnibade@nvidia.com> | 2016-12-27 04:54:54 -0500 |
commit | 869b4dd2748263a4c88569973a17c787834427c2 (patch) | |
tree | b9599bb4723faa6c1d3880d1b4a6a2eee43bbc35 /drivers/gpu | |
parent | c09f0baf5bce8f2533c6df10ede5c1a40bf6d4e7 (diff) |
gpu: nvgpu: add code to handle DT fuse overrides
Add code for handling GP10B fuse overrides specified in the device tree.
Also add specific handling for the ECC fuse override.
Bug 1699676
Change-Id: Ifa07983054cd143f7f1745a6a6de36f4d4e08126
Signed-off-by: Adeel Raza <araza@nvidia.com>
Reviewed-on: http://git-master/r/1140893
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.c | 45 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/gr_gp10b.h | 2 |
2 files changed, 47 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c index 8ea9235d..b36eff8f 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/tegra-fuse.h> | 18 | #include <linux/tegra-fuse.h> |
19 | 19 | ||
20 | #include <dt-bindings/soc/gp10b-fuse.h> | ||
21 | |||
20 | #include "gk20a/gr_gk20a.h" | 22 | #include "gk20a/gr_gk20a.h" |
21 | #include "gk20a/semaphore_gk20a.h" | 23 | #include "gk20a/semaphore_gk20a.h" |
22 | #include "gk20a/dbg_gpu_gk20a.h" | 24 | #include "gk20a/dbg_gpu_gk20a.h" |
@@ -1390,6 +1392,12 @@ static int gr_gp10b_init_fs_state(struct gk20a *g) | |||
1390 | gr_gpcs_tpcs_sm_disp_ctrl_re_suppress_disable_f()); | 1392 | gr_gpcs_tpcs_sm_disp_ctrl_re_suppress_disable_f()); |
1391 | gk20a_writel(g, gr_gpcs_tpcs_sm_disp_ctrl_r(), data); | 1393 | gk20a_writel(g, gr_gpcs_tpcs_sm_disp_ctrl_r(), data); |
1392 | 1394 | ||
1395 | if (g->gr.t18x.fecs_feature_override_ecc_val != 0) { | ||
1396 | gk20a_writel(g, | ||
1397 | gr_fecs_feature_override_ecc_r(), | ||
1398 | g->gr.t18x.fecs_feature_override_ecc_val); | ||
1399 | } | ||
1400 | |||
1393 | return gr_gm20b_ctx_state_floorsweep(g); | 1401 | return gr_gm20b_ctx_state_floorsweep(g); |
1394 | } | 1402 | } |
1395 | 1403 | ||
@@ -1989,6 +1997,42 @@ static int gr_gp10b_get_preemption_mode_flags(struct gk20a *g, | |||
1989 | 1997 | ||
1990 | return 0; | 1998 | return 0; |
1991 | } | 1999 | } |
2000 | static int gp10b_gr_fuse_override(struct gk20a *g) | ||
2001 | { | ||
2002 | struct device_node *np = g->dev->of_node; | ||
2003 | u32 *fuses; | ||
2004 | int count, i; | ||
2005 | |||
2006 | if (!np) /* may be pcie device */ | ||
2007 | return 0; | ||
2008 | |||
2009 | count = of_property_count_elems_of_size(np, "fuse-overrides", 8); | ||
2010 | if (count <= 0) | ||
2011 | return count; | ||
2012 | |||
2013 | fuses = kmalloc(sizeof(u32) * count * 2, GFP_KERNEL); | ||
2014 | if (!fuses) | ||
2015 | return -ENOMEM; | ||
2016 | of_property_read_u32_array(np, "fuse-overrides", fuses, count * 2); | ||
2017 | for (i = 0; i < count; i++) { | ||
2018 | u32 fuse, value; | ||
2019 | |||
2020 | fuse = fuses[2 * i]; | ||
2021 | value = fuses[2 * i + 1]; | ||
2022 | switch (fuse) { | ||
2023 | case GP10B_FUSE_OPT_ECC_EN: | ||
2024 | g->gr.t18x.fecs_feature_override_ecc_val = value; | ||
2025 | break; | ||
2026 | default: | ||
2027 | gk20a_err(dev_from_gk20a(g), | ||
2028 | "ignore unknown fuse override %08x", fuse); | ||
2029 | break; | ||
2030 | } | ||
2031 | } | ||
2032 | |||
2033 | kfree(fuses); | ||
2034 | return 0; | ||
2035 | } | ||
1992 | 2036 | ||
1993 | void gp10b_init_gr(struct gpu_ops *gops) | 2037 | void gp10b_init_gr(struct gpu_ops *gops) |
1994 | { | 2038 | { |
@@ -2031,4 +2075,5 @@ void gp10b_init_gr(struct gpu_ops *gops) | |||
2031 | gops->gr.suspend_contexts = gr_gp10b_suspend_contexts; | 2075 | gops->gr.suspend_contexts = gr_gp10b_suspend_contexts; |
2032 | gops->gr.set_preemption_mode = gr_gp10b_set_preemption_mode; | 2076 | gops->gr.set_preemption_mode = gr_gp10b_set_preemption_mode; |
2033 | gops->gr.get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags; | 2077 | gops->gr.get_preemption_mode_flags = gr_gp10b_get_preemption_mode_flags; |
2078 | gops->gr.fuse_override = gp10b_gr_fuse_override; | ||
2034 | } | 2079 | } |
diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h index 8c544f14..eb361820 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/gr_gp10b.h | |||
@@ -83,6 +83,8 @@ struct gr_t18x { | |||
83 | struct ecc_stat l2_ded_count; | 83 | struct ecc_stat l2_ded_count; |
84 | } ecc_stats; | 84 | } ecc_stats; |
85 | 85 | ||
86 | u32 fecs_feature_override_ecc_val; | ||
87 | |||
86 | int cilp_preempt_pending_chid; | 88 | int cilp_preempt_pending_chid; |
87 | }; | 89 | }; |
88 | 90 | ||