diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c | 66 |
1 files changed, 64 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c index 2f81378d..fbca62b0 100644 --- a/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c | |||
@@ -28,6 +28,49 @@ | |||
28 | #include "gk20a/gk20a.h" | 28 | #include "gk20a/gk20a.h" |
29 | #include "platform_tegra.h" | 29 | #include "platform_tegra.h" |
30 | 30 | ||
31 | static struct { | ||
32 | char *name; | ||
33 | unsigned long default_rate; | ||
34 | } tegra_gp10b_clocks[] = { | ||
35 | {"gpu", 1900000000}, | ||
36 | {"gpu_sys", 204000000} }; | ||
37 | |||
38 | /* | ||
39 | * gp10b_tegra_get_clocks() | ||
40 | * | ||
41 | * This function finds clocks in tegra platform and populates | ||
42 | * the clock information to gp10b platform data. | ||
43 | */ | ||
44 | |||
45 | static int gp10b_tegra_get_clocks(struct platform_device *pdev) | ||
46 | { | ||
47 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | ||
48 | struct gk20a *g = get_gk20a(pdev); | ||
49 | struct device *dev = dev_from_gk20a(g); | ||
50 | int i; | ||
51 | |||
52 | if (tegra_platform_is_linsim()) | ||
53 | return 0; | ||
54 | |||
55 | platform->num_clks = 0; | ||
56 | for (i = 0; i < ARRAY_SIZE(tegra_gp10b_clocks); i++) { | ||
57 | long rate = tegra_gp10b_clocks[i].default_rate; | ||
58 | struct clk *c; | ||
59 | |||
60 | c = clk_get(dev, tegra_gp10b_clocks[i].name); | ||
61 | if (IS_ERR(c)) { | ||
62 | gk20a_err(&pdev->dev, "cannot get clock %s", | ||
63 | tegra_gp10b_clocks[i].name); | ||
64 | } else { | ||
65 | clk_set_rate(c, rate); | ||
66 | platform->clk[i] = c; | ||
67 | } | ||
68 | } | ||
69 | platform->num_clks = i; | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
31 | static int gp10b_tegra_probe(struct platform_device *pdev) | 74 | static int gp10b_tegra_probe(struct platform_device *pdev) |
32 | { | 75 | { |
33 | struct gk20a_platform *platform = gk20a_get_platform(pdev); | 76 | struct gk20a_platform *platform = gk20a_get_platform(pdev); |
@@ -77,6 +120,9 @@ static int gp10b_tegra_probe(struct platform_device *pdev) | |||
77 | platform->debugfs, | 120 | platform->debugfs, |
78 | &platform->g->gr.t18x. | 121 | &platform->g->gr.t18x. |
79 | ctx_vars.dump_ctxsw_stats_on_channel_close); | 122 | ctx_vars.dump_ctxsw_stats_on_channel_close); |
123 | |||
124 | gp10b_tegra_get_clocks(pdev); | ||
125 | |||
80 | return 0; | 126 | return 0; |
81 | } | 127 | } |
82 | 128 | ||
@@ -97,17 +143,33 @@ static bool gp10b_tegra_is_railgated(struct platform_device *pdev) | |||
97 | 143 | ||
98 | static int gp10b_tegra_railgate(struct platform_device *pdev) | 144 | static int gp10b_tegra_railgate(struct platform_device *pdev) |
99 | { | 145 | { |
146 | struct gk20a_platform *platform = gk20a_get_platform(pdev); | ||
147 | |||
100 | if (!tegra_platform_is_linsim() && | 148 | if (!tegra_platform_is_linsim() && |
101 | tegra_powergate_is_powered(TEGRA_POWERGATE_GPU)) | 149 | tegra_powergate_is_powered(TEGRA_POWERGATE_GPU)) { |
150 | int i; | ||
151 | for (i = 0; i < platform->num_clks; i++) { | ||
152 | if (platform->clk[i]) | ||
153 | clk_disable_unprepare(platform->clk[i]); | ||
154 | } | ||
102 | tegra_powergate_partition(TEGRA_POWERGATE_GPU); | 155 | tegra_powergate_partition(TEGRA_POWERGATE_GPU); |
156 | } | ||
103 | return 0; | 157 | return 0; |
104 | } | 158 | } |
105 | 159 | ||
106 | static int gp10b_tegra_unrailgate(struct platform_device *pdev) | 160 | static int gp10b_tegra_unrailgate(struct platform_device *pdev) |
107 | { | 161 | { |
108 | int ret = 0; | 162 | int ret = 0; |
109 | if (!tegra_platform_is_linsim()) | 163 | struct gk20a_platform *platform = gk20a_get_platform(pdev); |
164 | |||
165 | if (!tegra_platform_is_linsim()) { | ||
166 | int i; | ||
110 | ret = tegra_unpowergate_partition(TEGRA_POWERGATE_GPU); | 167 | ret = tegra_unpowergate_partition(TEGRA_POWERGATE_GPU); |
168 | for (i = 0; i < platform->num_clks; i++) { | ||
169 | if (platform->clk[i]) | ||
170 | clk_prepare_enable(platform->clk[i]); | ||
171 | } | ||
172 | } | ||
111 | return ret; | 173 | return ret; |
112 | } | 174 | } |
113 | 175 | ||