diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/Makefile | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gr_t19x.h | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 31 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.h | 30 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 45 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/hal_gv11b.h | 21 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/mc_gv11b.c | 26 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/mc_gv11b.h | 19 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c | 149 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h | 32 |
10 files changed, 381 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile new file mode 100644 index 00000000..d70a2787 --- /dev/null +++ b/drivers/gpu/nvgpu/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | nvgpu-t19x := ../../../../kernel-nvgpu-t19x/drivers/gpu/nvgpu | ||
2 | |||
3 | nvgpu-y += \ | ||
4 | $(nvgpu-t19x)/gv11b/mc_gv11b.o \ | ||
5 | $(nvgpu-t19x)/gv11b/hal_gv11b.o \ | ||
6 | $(nvgpu-t19x)/gv11b/gr_gv11b.o | ||
7 | |||
8 | nvgpu-$(CONFIG_TEGRA_GK20A) += $(nvgpu-t19x)/gv11b/platform_gv11b_tegra.o | ||
diff --git a/drivers/gpu/nvgpu/gr_t19x.h b/drivers/gpu/nvgpu/gr_t19x.h new file mode 100644 index 00000000..a4506f1c --- /dev/null +++ b/drivers/gpu/nvgpu/gr_t19x.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /* | ||
2 | * NVIDIA T19x GR | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | #ifndef _NVGPU_GR_T19X_H_ | ||
16 | #define _NVGPU_GR_T19X_H_ | ||
17 | |||
18 | #include "gv11b/gr_gv11b.h" | ||
19 | |||
20 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c new file mode 100644 index 00000000..d775aae8 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * GV11B GPU GR | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | |||
16 | #include "gk20a/gk20a.h" /* FERMI and MAXWELL classes defined here */ | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/tegra-fuse.h> | ||
19 | |||
20 | #include "gk20a/gr_gk20a.h" | ||
21 | #include "gk20a/semaphore_gk20a.h" | ||
22 | #include "gk20a/dbg_gpu_gk20a.h" | ||
23 | |||
24 | #include "gm20b/gr_gm20b.h" /* for MAXWELL classes */ | ||
25 | #include "gp10b/gr_gp10b.h" | ||
26 | #include "gv11b/gr_gv11b.h" | ||
27 | |||
28 | void gv11b_init_gr(struct gpu_ops *gops) | ||
29 | { | ||
30 | gp10b_init_gr(gops); | ||
31 | } | ||
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h new file mode 100644 index 00000000..c8912f91 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * GV11B GPU GR | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | |||
16 | #ifndef _NVGPU_GR_GV11B_H_ | ||
17 | #define _NVGPU_GR_GV11B_H_ | ||
18 | |||
19 | struct gpu_ops; | ||
20 | |||
21 | enum { | ||
22 | VOLTA_CHANNEL_GPFIFO_A = 0xC36F, | ||
23 | VOLTA_A = 0xC397, | ||
24 | VOLTA_COMPUTE_A = 0xC3C0, | ||
25 | VOLTA_DMA_COPY_A = 0xC3B5, | ||
26 | }; | ||
27 | |||
28 | void gv11b_init_gr(struct gpu_ops *ops); | ||
29 | |||
30 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c new file mode 100644 index 00000000..0debe7ce --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* | ||
2 | * GV11B Tegra HAL interface | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | |||
16 | #include <linux/types.h> | ||
17 | #include <linux/printk.h> | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | |||
21 | #include "gk20a/gk20a.h" | ||
22 | |||
23 | #include "gv11b/gr_gv11b.h" | ||
24 | #include "gv11b/mc_gv11b.h" | ||
25 | |||
26 | #include "gm20b/gr_gm20b.h" | ||
27 | |||
28 | int gv11b_init_hal(struct gk20a *g) | ||
29 | { | ||
30 | struct gpu_ops *gops = &g->ops; | ||
31 | struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; | ||
32 | |||
33 | gv11b_init_mc(gops); | ||
34 | gv11b_init_gr(gops); | ||
35 | gops->name = "gv11b"; | ||
36 | |||
37 | c->twod_class = FERMI_TWOD_A; | ||
38 | c->threed_class = VOLTA_A; | ||
39 | c->compute_class = VOLTA_COMPUTE_A; | ||
40 | c->gpfifo_class = VOLTA_CHANNEL_GPFIFO_A; | ||
41 | c->inline_to_memory_class = KEPLER_INLINE_TO_MEMORY_B; | ||
42 | c->dma_copy_class = VOLTA_DMA_COPY_A; | ||
43 | |||
44 | return 0; | ||
45 | } | ||
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.h b/drivers/gpu/nvgpu/gv11b/hal_gv11b.h new file mode 100644 index 00000000..7acbf03b --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.h | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * GV11B Tegra HAL interface | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | |||
16 | #ifndef _NVGPU_HAL_GV11B_H | ||
17 | #define _NVGPU_HAL_GV11B_H | ||
18 | struct gk20a; | ||
19 | |||
20 | int gv11b_init_hal(struct gk20a *gops); | ||
21 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gv11b/mc_gv11b.c b/drivers/gpu/nvgpu/gv11b/mc_gv11b.c new file mode 100644 index 00000000..bc0aee2e --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/mc_gv11b.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * GV11B master | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | #include "gk20a/gk20a.h" | ||
19 | #include "gp10b/mc_gp10b.h" | ||
20 | #include "gv11b/mc_gv11b.h" | ||
21 | #include "hw_mc_gv11b.h" | ||
22 | |||
23 | void gv11b_init_mc(struct gpu_ops *gops) | ||
24 | { | ||
25 | gp10b_init_mc(gops); | ||
26 | } | ||
diff --git a/drivers/gpu/nvgpu/gv11b/mc_gv11b.h b/drivers/gpu/nvgpu/gv11b/mc_gv11b.h new file mode 100644 index 00000000..6cb2cde0 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/mc_gv11b.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, 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 | |||
14 | #ifndef MC_GV11B_H | ||
15 | #define MC_GV11B_H | ||
16 | struct gk20a; | ||
17 | |||
18 | void gv11b_init_mc(struct gpu_ops *gops); | ||
19 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c new file mode 100644 index 00000000..322bebc8 --- /dev/null +++ b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * GV11B Tegra Platform Interface | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | |||
16 | #include <linux/of_platform.h> | ||
17 | #include <linux/nvhost.h> | ||
18 | #include <linux/debugfs.h> | ||
19 | #include <linux/tegra-powergate.h> | ||
20 | #include <linux/platform_data/tegra_edp.h> | ||
21 | #include <uapi/linux/nvgpu.h> | ||
22 | #include <linux/dma-buf.h> | ||
23 | #include <linux/nvmap.h> | ||
24 | #include <linux/tegra_pm_domains.h> | ||
25 | #include <linux/reset.h> | ||
26 | #include <linux/hashtable.h> | ||
27 | #include "gk20a/platform_gk20a.h" | ||
28 | #include "gk20a/gk20a.h" | ||
29 | #include "platform_tegra.h" | ||
30 | #include "gr_gv11b.h" | ||
31 | #include "hw_gr_gv11b.h" | ||
32 | |||
33 | /* | ||
34 | * gv11b_tegra_get_clocks() | ||
35 | * | ||
36 | * This function finds clocks in tegra platform and populates | ||
37 | * the clock information to gv11b platform data. | ||
38 | */ | ||
39 | |||
40 | static int gv11b_tegra_get_clocks(struct device *dev) | ||
41 | { | ||
42 | /* TODO */ | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static int gv11b_tegra_probe(struct device *dev) | ||
47 | { | ||
48 | struct gk20a_platform *platform = dev_get_drvdata(dev); | ||
49 | struct device_node *np = dev->of_node; | ||
50 | struct device_node *host1x_node; | ||
51 | struct platform_device *host1x_pdev; | ||
52 | const __be32 *host1x_ptr; | ||
53 | |||
54 | host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); | ||
55 | if (!host1x_ptr) { | ||
56 | gk20a_err(dev, "host1x device not available"); | ||
57 | return -ENOSYS; | ||
58 | } | ||
59 | |||
60 | host1x_node = of_find_node_by_phandle(be32_to_cpup(host1x_ptr)); | ||
61 | host1x_pdev = of_find_device_by_node(host1x_node); | ||
62 | if (!host1x_pdev) { | ||
63 | gk20a_err(dev, "host1x device not available"); | ||
64 | return -ENOSYS; | ||
65 | } | ||
66 | |||
67 | platform->g->host1x_dev = host1x_pdev; | ||
68 | platform->bypass_smmu = !device_is_iommuable(dev); | ||
69 | platform->disable_bigpage = platform->bypass_smmu; | ||
70 | |||
71 | platform->g->gr.t18x.ctx_vars.dump_ctxsw_stats_on_channel_close | ||
72 | = false; | ||
73 | platform->g->gr.t18x.ctx_vars.dump_ctxsw_stats_on_channel_close | ||
74 | = false; | ||
75 | |||
76 | platform->g->gr.t18x.ctx_vars.force_preemption_gfxp = false; | ||
77 | platform->g->gr.t18x.ctx_vars.force_preemption_cilp = false; | ||
78 | |||
79 | |||
80 | gv11b_tegra_get_clocks(dev); | ||
81 | |||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | static int gv11b_tegra_late_probe(struct device *dev) | ||
86 | { | ||
87 | /* Make gk20a power domain a subdomain of host1x */ | ||
88 | nvhost_register_client_domain(dev_to_genpd(dev)); | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | static int gv11b_tegra_remove(struct device *dev) | ||
93 | { | ||
94 | /* remove gk20a power subdomain from host1x */ | ||
95 | nvhost_unregister_client_domain(dev_to_genpd(dev)); | ||
96 | |||
97 | return 0; | ||
98 | |||
99 | } | ||
100 | |||
101 | static bool gv11b_tegra_is_railgated(struct device *dev) | ||
102 | { | ||
103 | bool ret = false; | ||
104 | |||
105 | return ret; | ||
106 | } | ||
107 | |||
108 | static int gv11b_tegra_railgate(struct device *dev) | ||
109 | { | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static int gv11b_tegra_unrailgate(struct device *dev) | ||
114 | { | ||
115 | int ret = 0; | ||
116 | return ret; | ||
117 | } | ||
118 | |||
119 | static int gv11b_tegra_suspend(struct device *dev) | ||
120 | { | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | struct gk20a_platform t19x_gpu_tegra_platform = { | ||
125 | .has_syncpoints = false, | ||
126 | |||
127 | /* power management configuration */ | ||
128 | |||
129 | /* ptimer src frequency in hz*/ | ||
130 | .ptimer_src_freq = 31250000, | ||
131 | |||
132 | .probe = gv11b_tegra_probe, | ||
133 | .late_probe = gv11b_tegra_late_probe, | ||
134 | .remove = gv11b_tegra_remove, | ||
135 | |||
136 | /* power management callbacks */ | ||
137 | .suspend = gv11b_tegra_suspend, | ||
138 | .railgate = gv11b_tegra_railgate, | ||
139 | .unrailgate = gv11b_tegra_unrailgate, | ||
140 | .is_railgated = gv11b_tegra_is_railgated, | ||
141 | |||
142 | .busy = gk20a_tegra_busy, | ||
143 | .idle = gk20a_tegra_idle, | ||
144 | |||
145 | .dump_platform_dependencies = gk20a_tegra_debug_dump, | ||
146 | |||
147 | .default_big_page_size = SZ_64K, | ||
148 | |||
149 | }; | ||
diff --git a/drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h b/drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h new file mode 100644 index 00000000..d376f3dd --- /dev/null +++ b/drivers/gpu/nvgpu/nvgpu_gpuid_t19x.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * NVIDIA GPU ID functions, definitions. | ||
3 | * | ||
4 | * Copyright (c) 2016, 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 | #ifndef _NVGPU_GPUID_T19X_H_ | ||
16 | #define _NVGPU_GPUID_T19X_H_ | ||
17 | |||
18 | #define NVGPU_GPUID_GV11B \ | ||
19 | GK20A_GPUID(NVGPU_GPU_ARCH_GV110, NVGPU_GPU_IMPL_GV11B) | ||
20 | |||
21 | #define NVGPU_COMPAT_TEGRA_GV11B "nvidia,g11b" | ||
22 | #define NVGPU_COMPAT_GENERIC_GV11B "nvidia,generic-gv11b" | ||
23 | |||
24 | #define TEGRA_19x_GPUID NVGPU_GPUID_GV11B | ||
25 | #define TEGRA_19x_GPUID_HAL gv11b_init_hal | ||
26 | #define TEGRA_19x_GPU_COMPAT_TEGRA NVGPU_COMPAT_TEGRA_GV11B | ||
27 | #define TEGRA_19x_GPU_COMPAT_GENERIC NVGPU_COMPAT_GENERIC_GV11B | ||
28 | struct gpu_ops; | ||
29 | extern int gv11b_init_hal(struct gk20a *); | ||
30 | extern struct gk20a_platform t19x_gpu_tegra_platform; | ||
31 | |||
32 | #endif | ||