diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c index ca346d97..95d82254 100644 --- a/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c +++ b/drivers/gpu/nvgpu/gv11b/platform_gv11b_tegra.c | |||
@@ -28,11 +28,15 @@ | |||
28 | #include <linux/nvmap.h> | 28 | #include <linux/nvmap.h> |
29 | #include <linux/reset.h> | 29 | #include <linux/reset.h> |
30 | #include <linux/hashtable.h> | 30 | #include <linux/hashtable.h> |
31 | #include <linux/clk.h> | ||
31 | #include <nvgpu/nvhost.h> | 32 | #include <nvgpu/nvhost.h> |
32 | #include <nvgpu/nvhost_t19x.h> | 33 | #include <nvgpu/nvhost_t19x.h> |
33 | 34 | ||
34 | #include <uapi/linux/nvgpu.h> | 35 | #include <uapi/linux/nvgpu.h> |
35 | 36 | ||
37 | #include <soc/tegra/tegra_bpmp.h> | ||
38 | #include <soc/tegra/tegra_powergate.h> | ||
39 | |||
36 | #include "gk20a/gk20a.h" | 40 | #include "gk20a/gk20a.h" |
37 | #include "common/linux/platform_gk20a.h" | 41 | #include "common/linux/platform_gk20a.h" |
38 | #include "common/linux/clk.h" | 42 | #include "common/linux/clk.h" |
@@ -103,18 +107,73 @@ static int gv11b_tegra_remove(struct device *dev) | |||
103 | static bool gv11b_tegra_is_railgated(struct device *dev) | 107 | static bool gv11b_tegra_is_railgated(struct device *dev) |
104 | { | 108 | { |
105 | bool ret = false; | 109 | bool ret = false; |
110 | #ifdef TEGRA194_POWER_DOMAIN_GPU | ||
111 | struct gk20a *g = get_gk20a(dev); | ||
112 | |||
113 | if (tegra_bpmp_running()) { | ||
114 | nvgpu_log(g, gpu_dbg_info, "bpmp running"); | ||
115 | ret = !tegra_powergate_is_powered(TEGRA194_POWER_DOMAIN_GPU); | ||
106 | 116 | ||
117 | nvgpu_log(g, gpu_dbg_info, "railgated? %s", ret ? "yes" : "no"); | ||
118 | } else { | ||
119 | nvgpu_log(g, gpu_dbg_info, "bpmp not running"); | ||
120 | } | ||
121 | #endif | ||
107 | return ret; | 122 | return ret; |
108 | } | 123 | } |
109 | 124 | ||
110 | static int gv11b_tegra_railgate(struct device *dev) | 125 | static int gv11b_tegra_railgate(struct device *dev) |
111 | { | 126 | { |
127 | #ifdef TEGRA194_POWER_DOMAIN_GPU | ||
128 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
129 | struct gk20a *g = get_gk20a(dev); | ||
130 | int i; | ||
131 | |||
132 | if (tegra_bpmp_running()) { | ||
133 | nvgpu_log(g, gpu_dbg_info, "bpmp running"); | ||
134 | if (!tegra_powergate_is_powered(TEGRA194_POWER_DOMAIN_GPU)) { | ||
135 | nvgpu_log(g, gpu_dbg_info, "powergate is not powered"); | ||
136 | return 0; | ||
137 | } | ||
138 | nvgpu_log(g, gpu_dbg_info, "clk_disable_unprepare"); | ||
139 | for (i = 0; i < platform->num_clks; i++) { | ||
140 | if (platform->clk[i]) | ||
141 | clk_disable_unprepare(platform->clk[i]); | ||
142 | } | ||
143 | nvgpu_log(g, gpu_dbg_info, "powergate_partition"); | ||
144 | tegra_powergate_partition(TEGRA194_POWER_DOMAIN_GPU); | ||
145 | } else { | ||
146 | nvgpu_log(g, gpu_dbg_info, "bpmp not running"); | ||
147 | } | ||
148 | #endif | ||
112 | return 0; | 149 | return 0; |
113 | } | 150 | } |
114 | 151 | ||
115 | static int gv11b_tegra_unrailgate(struct device *dev) | 152 | static int gv11b_tegra_unrailgate(struct device *dev) |
116 | { | 153 | { |
117 | int ret = 0; | 154 | int ret = 0; |
155 | #ifdef TEGRA194_POWER_DOMAIN_GPU | ||
156 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
157 | struct gk20a *g = get_gk20a(dev); | ||
158 | int i; | ||
159 | |||
160 | if (tegra_bpmp_running()) { | ||
161 | nvgpu_log(g, gpu_dbg_info, "bpmp running"); | ||
162 | ret = tegra_unpowergate_partition(TEGRA194_POWER_DOMAIN_GPU); | ||
163 | if (ret) { | ||
164 | nvgpu_log(g, gpu_dbg_info, | ||
165 | "unpowergate partition failed"); | ||
166 | return ret; | ||
167 | } | ||
168 | nvgpu_log(g, gpu_dbg_info, "clk_prepare_enable"); | ||
169 | for (i = 0; i < platform->num_clks; i++) { | ||
170 | if (platform->clk[i]) | ||
171 | clk_prepare_enable(platform->clk[i]); | ||
172 | } | ||
173 | } else { | ||
174 | nvgpu_log(g, gpu_dbg_info, "bpmp not running"); | ||
175 | } | ||
176 | #endif | ||
118 | return ret; | 177 | return ret; |
119 | } | 178 | } |
120 | 179 | ||