diff options
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/nvlink.c')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/nvlink.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/nvlink.c b/drivers/gpu/nvgpu/os/linux/nvlink.c index c93514c0..0db483d6 100644 --- a/drivers/gpu/nvgpu/os/linux/nvlink.c +++ b/drivers/gpu/nvgpu/os/linux/nvlink.c | |||
@@ -14,6 +14,10 @@ | |||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifdef CONFIG_TEGRA_NVLINK | ||
18 | #include <linux/platform/tegra/tegra-nvlink.h> | ||
19 | #endif | ||
20 | |||
17 | #include <gk20a/gk20a.h> | 21 | #include <gk20a/gk20a.h> |
18 | #include <nvgpu/nvlink.h> | 22 | #include <nvgpu/nvlink.h> |
19 | #include <nvgpu/enabled.h> | 23 | #include <nvgpu/enabled.h> |
@@ -104,3 +108,25 @@ void nvgpu_mss_nvlink_init_credits(struct gk20a *g) | |||
104 | val = readl_relaxed(soc4 + 4); | 108 | val = readl_relaxed(soc4 + 4); |
105 | writel_relaxed(val, soc4 + 4); | 109 | writel_relaxed(val, soc4 + 4); |
106 | } | 110 | } |
111 | |||
112 | int nvgpu_nvlink_deinit(struct gk20a *g) | ||
113 | { | ||
114 | #ifdef CONFIG_TEGRA_NVLINK | ||
115 | struct nvlink_device *ndev = g->nvlink.priv; | ||
116 | int err; | ||
117 | |||
118 | if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_NVLINK)) | ||
119 | return -ENODEV; | ||
120 | |||
121 | err = nvlink_shutdown(ndev); | ||
122 | if (err) { | ||
123 | nvgpu_err(g, "failed to shut down nvlink"); | ||
124 | return err; | ||
125 | } | ||
126 | |||
127 | nvgpu_nvlink_remove(g); | ||
128 | |||
129 | return 0; | ||
130 | #endif | ||
131 | return -ENODEV; | ||
132 | } | ||