summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c')
-rw-r--r--drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c b/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
new file mode 100644
index 00000000..66911626
--- /dev/null
+++ b/drivers/gpu/nvgpu/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c
@@ -0,0 +1,97 @@
1/*
2 * Copyright (c) 2017-2018, 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
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/platform_device.h>
18
19#include <nvgpu/nvhost.h>
20
21#include "gk20a/gk20a.h"
22#include "os/linux/vgpu/clk_vgpu.h"
23#include "os/linux/platform_gk20a.h"
24#include "os/linux/os_linux.h"
25
26static int gv11b_vgpu_probe(struct device *dev)
27{
28 struct platform_device *pdev = to_platform_device(dev);
29 struct gk20a_platform *platform = dev_get_drvdata(dev);
30 struct resource *r;
31 void __iomem *regs;
32 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(platform->g);
33 struct gk20a *g = platform->g;
34 int ret;
35
36 r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "usermode");
37 if (!r) {
38 nvgpu_err(g, "failed to get usermode regs");
39 return -ENXIO;
40 }
41 regs = devm_ioremap_resource(dev, r);
42 if (IS_ERR(regs)) {
43 nvgpu_err(g, "failed to map usermode regs");
44 return PTR_ERR(regs);
45 }
46 l->usermode_regs = regs;
47
48#ifdef CONFIG_TEGRA_GK20A_NVHOST
49 ret = nvgpu_get_nvhost_dev(g);
50 if (ret) {
51 l->usermode_regs = NULL;
52 return ret;
53 }
54
55 ret = nvgpu_nvhost_syncpt_unit_interface_get_aperture(g->nvhost_dev,
56 &g->syncpt_unit_base,
57 &g->syncpt_unit_size);
58 if (ret) {
59 nvgpu_err(g, "Failed to get syncpt interface");
60 return -ENOSYS;
61 }
62 g->syncpt_size = nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1);
63 nvgpu_info(g, "syncpt_unit_base %llx syncpt_unit_size %zx size %x\n",
64 g->syncpt_unit_base, g->syncpt_unit_size, g->syncpt_size);
65#endif
66 vgpu_init_clk_support(platform->g);
67
68 return 0;
69}
70
71struct gk20a_platform gv11b_vgpu_tegra_platform = {
72 .has_syncpoints = true,
73
74 /* power management configuration */
75 .can_railgate_init = false,
76 .can_elpg_init = false,
77 .enable_slcg = false,
78 .enable_blcg = false,
79 .enable_elcg = false,
80 .enable_elpg = false,
81 .enable_aelpg = false,
82 .can_slcg = false,
83 .can_blcg = false,
84 .can_elcg = false,
85
86 .ch_wdt_timeout_ms = 5000,
87
88 .probe = gv11b_vgpu_probe,
89
90 .clk_round_rate = vgpu_clk_round_rate,
91 .get_clk_freqs = vgpu_clk_get_freqs,
92
93 /* frequency scaling configuration */
94 .devfreq_governor = "userspace",
95
96 .virtual_dev = true,
97};