diff options
author | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
---|---|---|
committer | Joshua Bakita <bakitajoshua@gmail.com> | 2023-06-28 18:24:25 -0400 |
commit | 01e6fac4d61fdd7fff5433942ec93fc2ea1e4df1 (patch) | |
tree | 4ef34501728a087be24f4ba0af90f91486bf780b /include/os/linux/vgpu/gv11b | |
parent | 306a03d18b305e4e573be3b2931978fa10679eb9 (diff) |
Include nvgpu headers
These are needed to build on NVIDIA's Jetson boards for the time
being. Only a couple structs are required, so it should be fairly
easy to remove this dependency at some point in the future.
Diffstat (limited to 'include/os/linux/vgpu/gv11b')
-rw-r--r-- | include/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/include/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c b/include/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c new file mode 100644 index 0000000..0304bcc --- /dev/null +++ b/include/os/linux/vgpu/gv11b/platform_gv11b_vgpu_tegra.c | |||
@@ -0,0 +1,103 @@ | |||
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 | #include <nvgpu/gk20a.h> | ||
21 | |||
22 | #include "vgpu/clk_vgpu.h" | ||
23 | #include "os/linux/platform_gk20a.h" | ||
24 | #include "os/linux/os_linux.h" | ||
25 | #include "os/linux/vgpu/vgpu_linux.h" | ||
26 | #include "os/linux/vgpu/platform_vgpu_tegra.h" | ||
27 | |||
28 | static int gv11b_vgpu_probe(struct device *dev) | ||
29 | { | ||
30 | struct platform_device *pdev = to_platform_device(dev); | ||
31 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
32 | struct resource *r; | ||
33 | void __iomem *regs; | ||
34 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(platform->g); | ||
35 | struct gk20a *g = platform->g; | ||
36 | int ret; | ||
37 | |||
38 | r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "usermode"); | ||
39 | if (!r) { | ||
40 | nvgpu_err(g, "failed to get usermode regs"); | ||
41 | return -ENXIO; | ||
42 | } | ||
43 | regs = devm_ioremap_resource(dev, r); | ||
44 | if (IS_ERR(regs)) { | ||
45 | nvgpu_err(g, "failed to map usermode regs"); | ||
46 | return PTR_ERR(regs); | ||
47 | } | ||
48 | l->usermode_regs = regs; | ||
49 | |||
50 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | ||
51 | ret = nvgpu_get_nvhost_dev(g); | ||
52 | if (ret) { | ||
53 | l->usermode_regs = NULL; | ||
54 | return ret; | ||
55 | } | ||
56 | |||
57 | ret = nvgpu_nvhost_syncpt_unit_interface_get_aperture(g->nvhost_dev, | ||
58 | &g->syncpt_unit_base, | ||
59 | &g->syncpt_unit_size); | ||
60 | if (ret) { | ||
61 | nvgpu_err(g, "Failed to get syncpt interface"); | ||
62 | return -ENOSYS; | ||
63 | } | ||
64 | g->syncpt_size = nvgpu_nvhost_syncpt_unit_interface_get_byte_offset(1); | ||
65 | nvgpu_info(g, "syncpt_unit_base %llx syncpt_unit_size %zx size %x\n", | ||
66 | g->syncpt_unit_base, g->syncpt_unit_size, g->syncpt_size); | ||
67 | #endif | ||
68 | vgpu_init_clk_support(platform->g); | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | struct gk20a_platform gv11b_vgpu_tegra_platform = { | ||
74 | .has_syncpoints = true, | ||
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_plat_clk_round_rate, | ||
93 | .get_clk_freqs = vgpu_plat_clk_get_freqs, | ||
94 | |||
95 | /* frequency scaling configuration */ | ||
96 | .devfreq_governor = "userspace", | ||
97 | |||
98 | .virtual_dev = true, | ||
99 | |||
100 | /* power management callbacks */ | ||
101 | .suspend = vgpu_tegra_suspend, | ||
102 | .resume = vgpu_tegra_resume, | ||
103 | }; | ||