diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c new file mode 100644 index 00000000..3b9d63e8 --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, 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 "gk20a/gk20a.h" | ||
18 | #include "common/linux/vgpu/clk_vgpu.h" | ||
19 | #include "common/linux/platform_gk20a.h" | ||
20 | #include "common/linux/os_linux.h" | ||
21 | |||
22 | #include <nvgpu/nvhost.h> | ||
23 | #include <nvgpu/nvhost_t19x.h> | ||
24 | |||
25 | #include <linux/platform_device.h> | ||
26 | |||
27 | static int gv11b_vgpu_probe(struct device *dev) | ||
28 | { | ||
29 | struct platform_device *pdev = to_platform_device(dev); | ||
30 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
31 | struct resource *r; | ||
32 | void __iomem *regs; | ||
33 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(platform->g); | ||
34 | struct gk20a *g = platform->g; | ||
35 | int ret; | ||
36 | |||
37 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "usermode"); | ||
38 | if (!r) { | ||
39 | dev_err(dev, "failed to get usermode regs\n"); | ||
40 | return -ENXIO; | ||
41 | } | ||
42 | regs = devm_ioremap_resource(dev, r); | ||
43 | if (IS_ERR(regs)) { | ||
44 | dev_err(dev, "failed to map usermode regs\n"); | ||
45 | return PTR_ERR(regs); | ||
46 | } | ||
47 | l->t19x.usermode_regs = regs; | ||
48 | |||
49 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | ||
50 | ret = nvgpu_get_nvhost_dev(g); | ||
51 | if (ret) { | ||
52 | l->t19x.usermode_regs = NULL; | ||
53 | return ret; | ||
54 | } | ||
55 | |||
56 | ret = nvgpu_nvhost_syncpt_unit_interface_get_aperture(g->nvhost_dev, | ||
57 | &g->syncpt_unit_base, | ||
58 | &g->syncpt_unit_size); | ||
59 | if (ret) { | ||
60 | dev_err(dev, "Failed to get syncpt interface"); | ||
61 | return -ENOSYS; | ||
62 | } | ||
63 | g->syncpt_size = nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); | ||
64 | nvgpu_info(g, "syncpt_unit_base %llx syncpt_unit_size %zx size %x\n", | ||
65 | g->syncpt_unit_base, g->syncpt_unit_size, g->syncpt_size); | ||
66 | #endif | ||
67 | vgpu_init_clk_support(platform->g); | ||
68 | |||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | struct gk20a_platform gv11b_vgpu_tegra_platform = { | ||
73 | .has_syncpoints = true, | ||
74 | .aggressive_sync_destroy_thresh = 64, | ||
75 | |||
76 | /* power management configuration */ | ||
77 | .can_railgate_init = false, | ||
78 | .can_elpg_init = false, | ||
79 | .enable_slcg = false, | ||
80 | .enable_blcg = false, | ||
81 | .enable_elcg = false, | ||
82 | .enable_elpg = false, | ||
83 | .enable_aelpg = false, | ||
84 | .can_slcg = false, | ||
85 | .can_blcg = false, | ||
86 | .can_elcg = false, | ||
87 | |||
88 | .ch_wdt_timeout_ms = 5000, | ||
89 | |||
90 | .probe = gv11b_vgpu_probe, | ||
91 | |||
92 | .clk_round_rate = vgpu_clk_round_rate, | ||
93 | .get_clk_freqs = vgpu_clk_get_freqs, | ||
94 | |||
95 | /* frequency scaling configuration */ | ||
96 | .devfreq_governor = "userspace", | ||
97 | |||
98 | .virtual_dev = true, | ||
99 | }; | ||