summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-10-31 09:11:57 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-02 13:26:21 -0400
commit25440e63d2dfd329ba35aec48f11f0c20b18cdbd (patch)
treed66fe69181c8d54dd3fb0deefa018558e4359e0b /drivers/gpu/nvgpu/common
parent2d71b3efaebb9807cb039979f1ce7dc621fb658f (diff)
gpu: nvgpu: move platform_gk20a.h to linux
Move gk20a/platform_gk20a.h to linux specific directory as common/linux/platform_gk20a.h since this file includes all linux specific stuff Fix #includes in all the files to include this file with correct path Remove #include of this file where it is no more needed Fix gk20a_init_sim_support() to receive struct gk20a as parameter instead of receiving linux specific struct platform_device NVGPU-316 Change-Id: I5ec08e776b753af4d39d11c11f6f068be2ac236f Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1589938 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r--drivers/gpu/nvgpu/common/as.c1
-rw-r--r--drivers/gpu/nvgpu/common/linux/clk.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ctxsw_trace.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_cde.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug_clk.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/dma.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/dmabuf.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/firmware.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_as.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_dbg.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_tsg.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/log.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/pci.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gk20a.h302
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/scale.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/sysfs.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/timers.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/vm.c2
26 files changed, 328 insertions, 26 deletions
diff --git a/drivers/gpu/nvgpu/common/as.c b/drivers/gpu/nvgpu/common/as.c
index 3fcc65fa..31cdd0b6 100644
--- a/drivers/gpu/nvgpu/common/as.c
+++ b/drivers/gpu/nvgpu/common/as.c
@@ -28,7 +28,6 @@
28#include <nvgpu/vm.h> 28#include <nvgpu/vm.h>
29 29
30#include "gk20a/gk20a.h" 30#include "gk20a/gk20a.h"
31#include "gk20a/platform_gk20a.h"
32 31
33/* dumb allocator... */ 32/* dumb allocator... */
34static int generate_as_share_id(struct gk20a_as *as) 33static int generate_as_share_id(struct gk20a_as *as)
diff --git a/drivers/gpu/nvgpu/common/linux/clk.c b/drivers/gpu/nvgpu/common/linux/clk.c
index 3f768867..a9888590 100644
--- a/drivers/gpu/nvgpu/common/linux/clk.c
+++ b/drivers/gpu/nvgpu/common/linux/clk.c
@@ -22,9 +22,9 @@
22 22
23#include "clk.h" 23#include "clk.h"
24#include "os_linux.h" 24#include "os_linux.h"
25#include "platform_gk20a.h"
25 26
26#include "gk20a/gk20a.h" 27#include "gk20a/gk20a.h"
27#include "gk20a/platform_gk20a.h"
28 28
29static unsigned long nvgpu_linux_clk_get_rate(struct gk20a *g, u32 api_domain) 29static unsigned long nvgpu_linux_clk_get_rate(struct gk20a *g, u32 api_domain)
30{ 30{
diff --git a/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c
index a4a07a4c..8268bf60 100644
--- a/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c
+++ b/drivers/gpu/nvgpu/common/linux/ctxsw_trace.c
@@ -23,13 +23,13 @@
23 23
24#include "gk20a/gk20a.h" 24#include "gk20a/gk20a.h"
25#include "gk20a/gr_gk20a.h" 25#include "gk20a/gr_gk20a.h"
26#include "gk20a/platform_gk20a.h"
27 26
28#include <nvgpu/kmem.h> 27#include <nvgpu/kmem.h>
29#include <nvgpu/log.h> 28#include <nvgpu/log.h>
30#include <nvgpu/atomic.h> 29#include <nvgpu/atomic.h>
31#include <nvgpu/barrier.h> 30#include <nvgpu/barrier.h>
32 31
32#include "platform_gk20a.h"
33#include "os_linux.h" 33#include "os_linux.h"
34#include "ctxsw_trace.h" 34#include "ctxsw_trace.h"
35 35
diff --git a/drivers/gpu/nvgpu/common/linux/debug.c b/drivers/gpu/nvgpu/common/linux/debug.c
index 08d0e679..7a4e4e9f 100644
--- a/drivers/gpu/nvgpu/common/linux/debug.c
+++ b/drivers/gpu/nvgpu/common/linux/debug.c
@@ -24,9 +24,9 @@
24#include "debug_hal.h" 24#include "debug_hal.h"
25#include "debug_xve.h" 25#include "debug_xve.h"
26#include "os_linux.h" 26#include "os_linux.h"
27#include "platform_gk20a.h"
27 28
28#include "gk20a/gk20a.h" 29#include "gk20a/gk20a.h"
29#include "gk20a/platform_gk20a.h"
30 30
31#include <linux/debugfs.h> 31#include <linux/debugfs.h>
32#include <linux/seq_file.h> 32#include <linux/seq_file.h>
diff --git a/drivers/gpu/nvgpu/common/linux/debug_cde.c b/drivers/gpu/nvgpu/common/linux/debug_cde.c
index cbea83b9..f0afa6ee 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_cde.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_cde.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "debug_cde.h" 15#include "debug_cde.h"
16#include "gk20a/platform_gk20a.h" 16#include "platform_gk20a.h"
17#include "os_linux.h" 17#include "os_linux.h"
18 18
19#include <linux/debugfs.h> 19#include <linux/debugfs.h>
diff --git a/drivers/gpu/nvgpu/common/linux/debug_clk.c b/drivers/gpu/nvgpu/common/linux/debug_clk.c
index 81839de7..2484d44b 100644
--- a/drivers/gpu/nvgpu/common/linux/debug_clk.c
+++ b/drivers/gpu/nvgpu/common/linux/debug_clk.c
@@ -16,9 +16,9 @@
16#include <linux/debugfs.h> 16#include <linux/debugfs.h>
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18 18
19#include "gk20a/platform_gk20a.h"
20#include "gm20b/clk_gm20b.h" 19#include "gm20b/clk_gm20b.h"
21#include "os_linux.h" 20#include "os_linux.h"
21#include "platform_gk20a.h"
22 22
23static int rate_get(void *data, u64 *val) 23static int rate_get(void *data, u64 *val)
24{ 24{
diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c
index 9e9d1007..5bac42e3 100644
--- a/drivers/gpu/nvgpu/common/linux/dma.c
+++ b/drivers/gpu/nvgpu/common/linux/dma.c
@@ -31,8 +31,8 @@
31#include <nvgpu/linux/vidmem.h> 31#include <nvgpu/linux/vidmem.h>
32 32
33#include "gk20a/gk20a.h" 33#include "gk20a/gk20a.h"
34#include "gk20a/platform_gk20a.h"
35 34
35#include "platform_gk20a.h"
36#include "os_linux.h" 36#include "os_linux.h"
37 37
38/* 38/*
diff --git a/drivers/gpu/nvgpu/common/linux/dmabuf.c b/drivers/gpu/nvgpu/common/linux/dmabuf.c
index 2415b7c2..6b44ff55 100644
--- a/drivers/gpu/nvgpu/common/linux/dmabuf.c
+++ b/drivers/gpu/nvgpu/common/linux/dmabuf.c
@@ -25,8 +25,8 @@
25#include <nvgpu/linux/vidmem.h> 25#include <nvgpu/linux/vidmem.h>
26 26
27#include "gk20a/gk20a.h" 27#include "gk20a/gk20a.h"
28#include "gk20a/platform_gk20a.h"
29 28
29#include "platform_gk20a.h"
30#include "dmabuf.h" 30#include "dmabuf.h"
31#include "os_linux.h" 31#include "os_linux.h"
32 32
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index 759607a2..cdb28eaf 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -25,7 +25,7 @@
25 25
26#include "scale.h" 26#include "scale.h"
27#include "gk20a/gk20a.h" 27#include "gk20a/gk20a.h"
28#include "gk20a/platform_gk20a.h" 28#include "platform_gk20a.h"
29#include "module.h" 29#include "module.h"
30#include "os_linux.h" 30#include "os_linux.h"
31#include "sysfs.h" 31#include "sysfs.h"
diff --git a/drivers/gpu/nvgpu/common/linux/firmware.c b/drivers/gpu/nvgpu/common/linux/firmware.c
index 44ff1507..a76165ff 100644
--- a/drivers/gpu/nvgpu/common/linux/firmware.c
+++ b/drivers/gpu/nvgpu/common/linux/firmware.c
@@ -21,7 +21,7 @@
21#include <nvgpu/firmware.h> 21#include <nvgpu/firmware.h>
22 22
23#include "gk20a/gk20a.h" 23#include "gk20a/gk20a.h"
24#include "gk20a/platform_gk20a.h" 24#include "platform_gk20a.h"
25#include "os_linux.h" 25#include "os_linux.h"
26 26
27static const struct firmware *do_request_firmware(struct device *dev, 27static const struct firmware *do_request_firmware(struct device *dev,
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl.c b/drivers/gpu/nvgpu/common/linux/ioctl.c
index c1053268..0aa7f6a3 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl.c
@@ -22,7 +22,6 @@
22#include <nvgpu/ctxsw_trace.h> 22#include <nvgpu/ctxsw_trace.h>
23 23
24#include "gk20a/gk20a.h" 24#include "gk20a/gk20a.h"
25#include "gk20a/platform_gk20a.h"
26#include "gk20a/dbg_gpu_gk20a.h" 25#include "gk20a/dbg_gpu_gk20a.h"
27 26
28#include "ioctl_channel.h" 27#include "ioctl_channel.h"
@@ -33,6 +32,7 @@
33#include "module.h" 32#include "module.h"
34#include "os_linux.h" 33#include "os_linux.h"
35#include "ctxsw_trace.h" 34#include "ctxsw_trace.h"
35#include "platform_gk20a.h"
36 36
37#define GK20A_NUM_CDEVS 7 37#define GK20A_NUM_CDEVS 7
38 38
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_as.c b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
index 18d0dd07..e566bfb4 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_as.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
@@ -28,7 +28,7 @@
28#include <nvgpu/linux/vm.h> 28#include <nvgpu/linux/vm.h>
29 29
30#include "gk20a/gk20a.h" 30#include "gk20a/gk20a.h"
31#include "gk20a/platform_gk20a.h" 31#include "platform_gk20a.h"
32#include "ioctl_as.h" 32#include "ioctl_as.h"
33#include "os_linux.h" 33#include "os_linux.h"
34 34
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 5b0c4a50..44f662cb 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -33,8 +33,8 @@
33#include "gk20a/gk20a.h" 33#include "gk20a/gk20a.h"
34#include "gk20a/dbg_gpu_gk20a.h" 34#include "gk20a/dbg_gpu_gk20a.h"
35#include "gk20a/fence_gk20a.h" 35#include "gk20a/fence_gk20a.h"
36#include "gk20a/platform_gk20a.h"
37 36
37#include "platform_gk20a.h"
38#include "ioctl_channel.h" 38#include "ioctl_channel.h"
39#include "channel.h" 39#include "channel.h"
40#include "os_linux.h" 40#include "os_linux.h"
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index 1442c19a..73911717 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -39,9 +39,9 @@
39#include "ioctl_tsg.h" 39#include "ioctl_tsg.h"
40#include "ioctl_channel.h" 40#include "ioctl_channel.h"
41#include "gk20a/gk20a.h" 41#include "gk20a/gk20a.h"
42#include "gk20a/platform_gk20a.h"
43#include "gk20a/fence_gk20a.h" 42#include "gk20a/fence_gk20a.h"
44 43
44#include "platform_gk20a.h"
45#include "os_linux.h" 45#include "os_linux.h"
46#include "dmabuf.h" 46#include "dmabuf.h"
47 47
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c b/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c
index 24bf813a..f8bdd19b 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_dbg.c
@@ -33,11 +33,11 @@
33#include <nvgpu/linux/vm.h> 33#include <nvgpu/linux/vm.h>
34 34
35#include "gk20a/gk20a.h" 35#include "gk20a/gk20a.h"
36#include "gk20a/platform_gk20a.h"
37#include "gk20a/gr_gk20a.h" 36#include "gk20a/gr_gk20a.h"
38#include "gk20a/regops_gk20a.h" 37#include "gk20a/regops_gk20a.h"
39#include "gk20a/dbg_gpu_gk20a.h" 38#include "gk20a/dbg_gpu_gk20a.h"
40#include "os_linux.h" 39#include "os_linux.h"
40#include "platform_gk20a.h"
41#include "ioctl_dbg.h" 41#include "ioctl_dbg.h"
42 42
43 43
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
index 7eea636e..2570886d 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c
@@ -25,8 +25,8 @@
25#include <nvgpu/log.h> 25#include <nvgpu/log.h>
26 26
27#include "gk20a/gk20a.h" 27#include "gk20a/gk20a.h"
28#include "gk20a/platform_gk20a.h"
29#include "gk20a/tsg_gk20a.h" 28#include "gk20a/tsg_gk20a.h"
29#include "platform_gk20a.h"
30#include "ioctl_tsg.h" 30#include "ioctl_tsg.h"
31#include "ioctl_channel.h" 31#include "ioctl_channel.h"
32#include "os_linux.h" 32#include "os_linux.h"
diff --git a/drivers/gpu/nvgpu/common/linux/log.c b/drivers/gpu/nvgpu/common/linux/log.c
index f371bb77..e120a3de 100644
--- a/drivers/gpu/nvgpu/common/linux/log.c
+++ b/drivers/gpu/nvgpu/common/linux/log.c
@@ -20,7 +20,7 @@
20#include <nvgpu/log.h> 20#include <nvgpu/log.h>
21 21
22#include "gk20a/gk20a.h" 22#include "gk20a/gk20a.h"
23#include "gk20a/platform_gk20a.h" 23#include "platform_gk20a.h"
24#include "os_linux.h" 24#include "os_linux.h"
25 25
26/* 26/*
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index 7706d826..4aff6a2d 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -33,7 +33,7 @@
33#include <nvgpu/debug.h> 33#include <nvgpu/debug.h>
34#include <nvgpu/ctxsw_trace.h> 34#include <nvgpu/ctxsw_trace.h>
35 35
36#include "gk20a/platform_gk20a.h" 36#include "platform_gk20a.h"
37#include "sysfs.h" 37#include "sysfs.h"
38#include "vgpu/vgpu.h" 38#include "vgpu/vgpu.h"
39#include "scale.h" 39#include "scale.h"
@@ -661,7 +661,7 @@ static int gk20a_init_support(struct platform_device *dev)
661 goto fail; 661 goto fail;
662 } 662 }
663 663
664 err = gk20a_init_sim_support(dev); 664 err = gk20a_init_sim_support(g);
665 if (err) 665 if (err)
666 goto fail; 666 goto fail;
667 } 667 }
diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c
index 19483f86..118567e5 100644
--- a/drivers/gpu/nvgpu/common/linux/pci.c
+++ b/drivers/gpu/nvgpu/common/linux/pci.c
@@ -23,13 +23,13 @@
23#include <nvgpu/enabled.h> 23#include <nvgpu/enabled.h>
24 24
25#include "gk20a/gk20a.h" 25#include "gk20a/gk20a.h"
26#include "gk20a/platform_gk20a.h"
27#include "clk/clk.h" 26#include "clk/clk.h"
28#include "clk/clk_mclk.h" 27#include "clk/clk_mclk.h"
29#include "module.h" 28#include "module.h"
30#include "intr.h" 29#include "intr.h"
31#include "sysfs.h" 30#include "sysfs.h"
32#include "os_linux.h" 31#include "os_linux.h"
32#include "platform_gk20a.h"
33 33
34#include "pci.h" 34#include "pci.h"
35#ifdef CONFIG_TEGRA_19x_GPU 35#ifdef CONFIG_TEGRA_19x_GPU
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
new file mode 100644
index 00000000..348c9e24
--- /dev/null
+++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
@@ -0,0 +1,302 @@
1/*
2 * GK20A Platform (SoC) Interface
3 *
4 * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef _GK20A_PLATFORM_H_
26#define _GK20A_PLATFORM_H_
27
28#include <linux/device.h>
29
30#include <nvgpu/lock.h>
31
32#include "gk20a/gk20a.h"
33
34#define GK20A_CLKS_MAX 4
35
36struct gk20a;
37struct channel_gk20a;
38struct gr_ctx_buffer_desc;
39struct gk20a_scale_profile;
40
41struct secure_page_buffer {
42 void (*destroy)(struct gk20a *, struct secure_page_buffer *);
43 size_t size;
44 u64 iova;
45};
46
47struct gk20a_platform {
48 /* Populated by the gk20a driver before probing the platform. */
49 struct gk20a *g;
50
51 /* Should be populated at probe. */
52 bool can_railgate_init;
53
54 /* Should be populated at probe. */
55 bool can_elpg_init;
56
57 /* Should be populated at probe. */
58 bool has_syncpoints;
59
60 /* channel limit after which to start aggressive sync destroy */
61 unsigned int aggressive_sync_destroy_thresh;
62
63 /* flag to set sync destroy aggressiveness */
64 bool aggressive_sync_destroy;
65
66 /* set if ASPM should be disabled on boot; only makes sense for PCI */
67 bool disable_aspm;
68
69 /* Set if the platform can unify the small/large address spaces. */
70 bool unify_address_spaces;
71
72 /* Clock configuration is stored here. Platform probe is responsible
73 * for filling this data. */
74 struct clk *clk[GK20A_CLKS_MAX];
75 int num_clks;
76
77#ifdef CONFIG_RESET_CONTROLLER
78 /* Reset control for device */
79 struct reset_control *reset_control;
80#endif
81
82 /* Delay before rail gated */
83 int railgate_delay_init;
84
85 /* Second Level Clock Gating: true = enable false = disable */
86 bool enable_slcg;
87
88 /* Block Level Clock Gating: true = enable flase = disable */
89 bool enable_blcg;
90
91 /* Engine Level Clock Gating: true = enable flase = disable */
92 bool enable_elcg;
93
94 /* Should be populated at probe. */
95 bool can_slcg;
96
97 /* Should be populated at probe. */
98 bool can_blcg;
99
100 /* Should be populated at probe. */
101 bool can_elcg;
102
103 /* Engine Level Power Gating: true = enable flase = disable */
104 bool enable_elpg;
105
106 /* Adaptative ELPG: true = enable flase = disable */
107 bool enable_aelpg;
108
109 /* PMU Perfmon: true = enable false = disable */
110 bool enable_perfmon;
111
112 /* Memory System Clock Gating: true = enable flase = disable*/
113 bool enable_mscg;
114
115 /* Timeout for per-channel watchdog (in mS) */
116 u32 ch_wdt_timeout_ms;
117
118 /* Enable SMMU bypass by default */
119 bool bypass_smmu;
120
121 /* Disable big page support */
122 bool disable_bigpage;
123
124 /*
125 * gk20a_do_idle() API can take GPU either into rail gate or CAR reset
126 * This flag can be used to force CAR reset case instead of rail gate
127 */
128 bool force_reset_in_do_idle;
129
130 /* default pri timeout, on PCIe it should be lower than timeout
131 * detection
132 */
133 u32 default_pri_timeout;
134
135 /* Initialize the platform interface of the gk20a driver.
136 *
137 * The platform implementation of this function must
138 * - set the power and clocks of the gk20a device to a known
139 * state, and
140 * - populate the gk20a_platform structure (a pointer to the
141 * structure can be obtained by calling gk20a_get_platform).
142 *
143 * After this function is finished, the driver will initialise
144 * pm runtime and genpd based on the platform configuration.
145 */
146 int (*probe)(struct device *dev);
147
148 /* Second stage initialisation - called once all power management
149 * initialisations are done.
150 */
151 int (*late_probe)(struct device *dev);
152
153 /* Remove device after power management has been done
154 */
155 int (*remove)(struct device *dev);
156
157 /* Poweron platform dependencies */
158 int (*busy)(struct device *dev);
159
160 /* Powerdown platform dependencies */
161 void (*idle)(struct device *dev);
162
163 struct secure_page_buffer secure_buffer;
164
165 /* Device is going to be suspended */
166 int (*suspend)(struct device *);
167
168 /* Called to turn off the device */
169 int (*railgate)(struct device *dev);
170
171 /* Called to turn on the device */
172 int (*unrailgate)(struct device *dev);
173 struct nvgpu_mutex railgate_lock;
174
175 /* Called to check state of device */
176 bool (*is_railgated)(struct device *dev);
177
178 /* get supported frequency list */
179 int (*get_clk_freqs)(struct device *pdev,
180 unsigned long **freqs, int *num_freqs);
181
182 /* clk related supported functions */
183 long (*clk_round_rate)(struct device *dev,
184 unsigned long rate);
185
186 /* Called to register GPCPLL with common clk framework */
187 int (*clk_register)(struct gk20a *g);
188
189 /* Postscale callback is called after frequency change */
190 void (*postscale)(struct device *dev,
191 unsigned long freq);
192
193 /* Pre callback is called before frequency change */
194 void (*prescale)(struct device *dev);
195
196 /* Devfreq governor name. If scaling is enabled, we request
197 * this governor to be used in scaling */
198 const char *devfreq_governor;
199
200 /* Quality of service notifier callback. If this is set, the scaling
201 * routines will register a callback to Qos. Each time we receive
202 * a new value, this callback gets called. */
203 int (*qos_notify)(struct notifier_block *nb,
204 unsigned long n, void *p);
205
206 /* Called as part of debug dump. If the gpu gets hung, this function
207 * is responsible for delivering all necessary debug data of other
208 * hw units which may interact with the gpu without direct supervision
209 * of the CPU.
210 */
211 void (*dump_platform_dependencies)(struct device *dev);
212
213 /* Callbacks to assert/deassert GPU reset */
214 int (*reset_assert)(struct device *dev);
215 int (*reset_deassert)(struct device *dev);
216 struct clk *clk_reset;
217 struct dvfs_rail *gpu_rail;
218
219 bool virtual_dev;
220#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
221 void *vgpu_priv;
222#endif
223 /* source frequency for ptimer in hz */
224 u32 ptimer_src_freq;
225
226 bool has_cde;
227
228 /* soc name for finding firmware files */
229 const char *soc_name;
230
231 /* false if vidmem aperture actually points to sysmem */
232 bool honors_aperture;
233 /* unified or split memory with separate vidmem? */
234 bool unified_memory;
235
236 /* true if all channels must be in TSG */
237 bool tsg_required;
238
239 /* minimum supported VBIOS version */
240 u32 vbios_min_version;
241
242 /* true if we run preos microcode on this board */
243 bool run_preos;
244
245 /* true if we need to program sw threshold for
246 * power limits
247 */
248 bool hardcode_sw_threshold;
249
250 /* i2c device index, port and address for INA3221 */
251 u32 ina3221_dcb_index;
252 u32 ina3221_i2c_address;
253 u32 ina3221_i2c_port;
254};
255
256static inline struct gk20a_platform *gk20a_get_platform(
257 struct device *dev)
258{
259 return (struct gk20a_platform *)dev_get_drvdata(dev);
260}
261
262#ifdef CONFIG_TEGRA_GK20A
263extern struct gk20a_platform gm20b_tegra_platform;
264extern struct gk20a_platform gp10b_tegra_platform;
265#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
266extern struct gk20a_platform vgpu_tegra_platform;
267#endif
268#endif
269
270int gk20a_tegra_busy(struct device *dev);
271void gk20a_tegra_idle(struct device *dev);
272void gk20a_tegra_debug_dump(struct device *pdev);
273
274static inline struct gk20a *get_gk20a(struct device *dev)
275{
276 return gk20a_get_platform(dev)->g;
277}
278static inline struct gk20a *gk20a_from_dev(struct device *dev)
279{
280 if (!dev)
281 return NULL;
282
283 return ((struct gk20a_platform *)dev_get_drvdata(dev))->g;
284}
285static inline bool gk20a_gpu_is_virtual(struct device *dev)
286{
287 struct gk20a_platform *platform = dev_get_drvdata(dev);
288
289 return platform->virtual_dev;
290}
291
292static inline int support_gk20a_pmu(struct device *dev)
293{
294 if (IS_ENABLED(CONFIG_GK20A_PMU)) {
295 /* gPMU is not supported for vgpu */
296 return !gk20a_gpu_is_virtual(dev);
297 }
298
299 return 0;
300}
301
302#endif
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
index 2d6d156c..c40eafe4 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
@@ -47,10 +47,10 @@
47#include <nvgpu/linux/dma.h> 47#include <nvgpu/linux/dma.h>
48 48
49#include "gk20a/gk20a.h" 49#include "gk20a/gk20a.h"
50#include "gk20a/platform_gk20a.h"
51#include "gm20b/clk_gm20b.h" 50#include "gm20b/clk_gm20b.h"
52 51
53#include "scale.h" 52#include "scale.h"
53#include "platform_gk20a.h"
54#include "clk.h" 54#include "clk.h"
55#include "os_linux.h" 55#include "os_linux.h"
56 56
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
index 1f7a7694..b944844e 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
@@ -35,9 +35,9 @@
35 35
36#include "clk.h" 36#include "clk.h"
37 37
38#include "gk20a/platform_gk20a.h"
39#include "gk20a/gk20a.h" 38#include "gk20a/gk20a.h"
40 39
40#include "platform_gk20a.h"
41#include "platform_gk20a_tegra.h" 41#include "platform_gk20a_tegra.h"
42#include "gp10b/platform_gp10b.h" 42#include "gp10b/platform_gp10b.h"
43#include "platform_gp10b_tegra.h" 43#include "platform_gp10b_tegra.h"
diff --git a/drivers/gpu/nvgpu/common/linux/scale.c b/drivers/gpu/nvgpu/common/linux/scale.c
index 05f09dcc..84ac1cfd 100644
--- a/drivers/gpu/nvgpu/common/linux/scale.c
+++ b/drivers/gpu/nvgpu/common/linux/scale.c
@@ -27,7 +27,7 @@
27#include <nvgpu/log.h> 27#include <nvgpu/log.h>
28 28
29#include "gk20a/gk20a.h" 29#include "gk20a/gk20a.h"
30#include "gk20a/platform_gk20a.h" 30#include "platform_gk20a.h"
31#include "scale.h" 31#include "scale.h"
32#include "os_linux.h" 32#include "os_linux.h"
33 33
diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c
index 6897fae8..b1e7d1ed 100644
--- a/drivers/gpu/nvgpu/common/linux/sysfs.c
+++ b/drivers/gpu/nvgpu/common/linux/sysfs.c
@@ -23,7 +23,7 @@
23#include <nvgpu/nvhost.h> 23#include <nvgpu/nvhost.h>
24 24
25#include "sysfs.h" 25#include "sysfs.h"
26#include "gk20a/platform_gk20a.h" 26#include "platform_gk20a.h"
27#include "gk20a/pmu_gk20a.h" 27#include "gk20a/pmu_gk20a.h"
28#include "gk20a/gr_gk20a.h" 28#include "gk20a/gr_gk20a.h"
29 29
diff --git a/drivers/gpu/nvgpu/common/linux/timers.c b/drivers/gpu/nvgpu/common/linux/timers.c
index 5786b240..d0004aa5 100644
--- a/drivers/gpu/nvgpu/common/linux/timers.c
+++ b/drivers/gpu/nvgpu/common/linux/timers.c
@@ -21,7 +21,8 @@
21#include <nvgpu/soc.h> 21#include <nvgpu/soc.h>
22 22
23#include "gk20a/gk20a.h" 23#include "gk20a/gk20a.h"
24#include "gk20a/platform_gk20a.h" 24
25#include "platform_gk20a.h"
25 26
26/* 27/*
27 * Returns 1 if the platform is pre-Si and should ignore the timeout checking. 28 * Returns 1 if the platform is pre-Si and should ignore the timeout checking.
diff --git a/drivers/gpu/nvgpu/common/linux/vm.c b/drivers/gpu/nvgpu/common/linux/vm.c
index bb337d97..d04ed5ed 100644
--- a/drivers/gpu/nvgpu/common/linux/vm.c
+++ b/drivers/gpu/nvgpu/common/linux/vm.c
@@ -32,8 +32,8 @@
32#include "gk20a/gk20a.h" 32#include "gk20a/gk20a.h"
33#include "gk20a/mm_gk20a.h" 33#include "gk20a/mm_gk20a.h"
34#include "gk20a/kind_gk20a.h" 34#include "gk20a/kind_gk20a.h"
35#include "gk20a/platform_gk20a.h"
36 35
36#include "platform_gk20a.h"
37#include "os_linux.h" 37#include "os_linux.h"
38#include "dmabuf.h" 38#include "dmabuf.h"
39 39