diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2014-03-19 03:38:25 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:08:53 -0400 |
commit | a9785995d5f22aaeb659285f8aeb64d8b56982e0 (patch) | |
tree | cc75f75bcf43db316a002a7a240b81f299bf6d7f /drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c | |
parent | 61efaf843c22b85424036ec98015121c08f5f16c (diff) |
gpu: nvgpu: Add NVIDIA GPU Driver
This patch moves the NVIDIA GPU driver to a new location.
Bug 1482562
Change-Id: I24293810b9d0f1504fd9be00135e21dad656ccb6
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/383722
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c b/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c new file mode 100644 index 00000000..aea1a80b --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/priv_ring_gk20a.c | |||
@@ -0,0 +1,91 @@ | |||
1 | /* | ||
2 | * GK20A priv ring | ||
3 | * | ||
4 | * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | ||
18 | |||
19 | #include <linux/delay.h> /* for mdelay */ | ||
20 | |||
21 | #include "gk20a.h" | ||
22 | #include "hw_mc_gk20a.h" | ||
23 | #include "hw_pri_ringmaster_gk20a.h" | ||
24 | #include "hw_pri_ringstation_sys_gk20a.h" | ||
25 | #include "hw_trim_gk20a.h" | ||
26 | |||
27 | void gk20a_reset_priv_ring(struct gk20a *g) | ||
28 | { | ||
29 | u32 data; | ||
30 | |||
31 | if (tegra_platform_is_linsim()) | ||
32 | return; | ||
33 | |||
34 | data = gk20a_readl(g, trim_sys_gpc2clk_out_r()); | ||
35 | data = set_field(data, | ||
36 | trim_sys_gpc2clk_out_bypdiv_m(), | ||
37 | trim_sys_gpc2clk_out_bypdiv_f(0)); | ||
38 | gk20a_writel(g, trim_sys_gpc2clk_out_r(), data); | ||
39 | |||
40 | gk20a_reset(g, mc_enable_priv_ring_enabled_f()); | ||
41 | |||
42 | gk20a_writel(g,pri_ringmaster_command_r(), | ||
43 | 0x4); | ||
44 | |||
45 | gk20a_writel(g, pri_ringstation_sys_decode_config_r(), | ||
46 | 0x2); | ||
47 | |||
48 | gk20a_readl(g, pri_ringstation_sys_decode_config_r()); | ||
49 | } | ||
50 | |||
51 | void gk20a_priv_ring_isr(struct gk20a *g) | ||
52 | { | ||
53 | u32 status0, status1; | ||
54 | u32 cmd; | ||
55 | s32 retry = 100; | ||
56 | |||
57 | if (tegra_platform_is_linsim()) | ||
58 | return; | ||
59 | |||
60 | status0 = gk20a_readl(g, pri_ringmaster_intr_status0_r()); | ||
61 | status1 = gk20a_readl(g, pri_ringmaster_intr_status1_r()); | ||
62 | |||
63 | gk20a_dbg_info("ringmaster intr status0: 0x%08x," | ||
64 | "status1: 0x%08x", status0, status1); | ||
65 | |||
66 | if (status0 & (0x1 | 0x2 | 0x4)) { | ||
67 | gk20a_reset_priv_ring(g); | ||
68 | } | ||
69 | |||
70 | cmd = gk20a_readl(g, pri_ringmaster_command_r()); | ||
71 | cmd = set_field(cmd, pri_ringmaster_command_cmd_m(), | ||
72 | pri_ringmaster_command_cmd_ack_interrupt_f()); | ||
73 | gk20a_writel(g, pri_ringmaster_command_r(), cmd); | ||
74 | |||
75 | do { | ||
76 | cmd = pri_ringmaster_command_cmd_v( | ||
77 | gk20a_readl(g, pri_ringmaster_command_r())); | ||
78 | usleep_range(20, 40); | ||
79 | } while (cmd != pri_ringmaster_command_cmd_no_cmd_v() && --retry); | ||
80 | |||
81 | if (retry <= 0) | ||
82 | gk20a_warn(dev_from_gk20a(g), | ||
83 | "priv ringmaster cmd ack too many retries"); | ||
84 | |||
85 | status0 = gk20a_readl(g, pri_ringmaster_intr_status0_r()); | ||
86 | status1 = gk20a_readl(g, pri_ringmaster_intr_status1_r()); | ||
87 | |||
88 | gk20a_dbg_info("ringmaster intr status0: 0x%08x," | ||
89 | " status1: 0x%08x", status0, status1); | ||
90 | } | ||
91 | |||