diff options
Diffstat (limited to 'drivers/gpu/host1x/dev.c')
-rw-r--r-- | drivers/gpu/host1x/dev.c | 82 |
1 files changed, 34 insertions, 48 deletions
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 471630299878..80da003d63de 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c | |||
@@ -27,24 +27,13 @@ | |||
27 | #define CREATE_TRACE_POINTS | 27 | #define CREATE_TRACE_POINTS |
28 | #include <trace/events/host1x.h> | 28 | #include <trace/events/host1x.h> |
29 | 29 | ||
30 | #include "bus.h" | ||
30 | #include "dev.h" | 31 | #include "dev.h" |
31 | #include "intr.h" | 32 | #include "intr.h" |
32 | #include "channel.h" | 33 | #include "channel.h" |
33 | #include "debug.h" | 34 | #include "debug.h" |
34 | #include "hw/host1x01.h" | 35 | #include "hw/host1x01.h" |
35 | #include "host1x_client.h" | 36 | #include "hw/host1x02.h" |
36 | |||
37 | void host1x_set_drm_data(struct device *dev, void *data) | ||
38 | { | ||
39 | struct host1x *host1x = dev_get_drvdata(dev); | ||
40 | host1x->drm_data = data; | ||
41 | } | ||
42 | |||
43 | void *host1x_get_drm_data(struct device *dev) | ||
44 | { | ||
45 | struct host1x *host1x = dev_get_drvdata(dev); | ||
46 | return host1x ? host1x->drm_data : NULL; | ||
47 | } | ||
48 | 37 | ||
49 | void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r) | 38 | void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r) |
50 | { | 39 | { |
@@ -79,7 +68,17 @@ static const struct host1x_info host1x01_info = { | |||
79 | .sync_offset = 0x3000, | 68 | .sync_offset = 0x3000, |
80 | }; | 69 | }; |
81 | 70 | ||
71 | static const struct host1x_info host1x02_info = { | ||
72 | .nb_channels = 9, | ||
73 | .nb_pts = 32, | ||
74 | .nb_mlocks = 16, | ||
75 | .nb_bases = 12, | ||
76 | .init = host1x02_init, | ||
77 | .sync_offset = 0x3000, | ||
78 | }; | ||
79 | |||
82 | static struct of_device_id host1x_of_match[] = { | 80 | static struct of_device_id host1x_of_match[] = { |
81 | { .compatible = "nvidia,tegra114-host1x", .data = &host1x02_info, }, | ||
83 | { .compatible = "nvidia,tegra30-host1x", .data = &host1x01_info, }, | 82 | { .compatible = "nvidia,tegra30-host1x", .data = &host1x01_info, }, |
84 | { .compatible = "nvidia,tegra20-host1x", .data = &host1x01_info, }, | 83 | { .compatible = "nvidia,tegra20-host1x", .data = &host1x01_info, }, |
85 | { }, | 84 | { }, |
@@ -114,6 +113,9 @@ static int host1x_probe(struct platform_device *pdev) | |||
114 | if (!host) | 113 | if (!host) |
115 | return -ENOMEM; | 114 | return -ENOMEM; |
116 | 115 | ||
116 | mutex_init(&host->devices_lock); | ||
117 | INIT_LIST_HEAD(&host->devices); | ||
118 | INIT_LIST_HEAD(&host->list); | ||
117 | host->dev = &pdev->dev; | 119 | host->dev = &pdev->dev; |
118 | host->info = id->data; | 120 | host->info = id->data; |
119 | 121 | ||
@@ -152,7 +154,7 @@ static int host1x_probe(struct platform_device *pdev) | |||
152 | err = host1x_syncpt_init(host); | 154 | err = host1x_syncpt_init(host); |
153 | if (err) { | 155 | if (err) { |
154 | dev_err(&pdev->dev, "failed to initialize syncpts\n"); | 156 | dev_err(&pdev->dev, "failed to initialize syncpts\n"); |
155 | return err; | 157 | goto fail_unprepare_disable; |
156 | } | 158 | } |
157 | 159 | ||
158 | err = host1x_intr_init(host, syncpt_irq); | 160 | err = host1x_intr_init(host, syncpt_irq); |
@@ -163,19 +165,26 @@ static int host1x_probe(struct platform_device *pdev) | |||
163 | 165 | ||
164 | host1x_debug_init(host); | 166 | host1x_debug_init(host); |
165 | 167 | ||
166 | host1x_drm_alloc(pdev); | 168 | err = host1x_register(host); |
169 | if (err < 0) | ||
170 | goto fail_deinit_intr; | ||
167 | 171 | ||
168 | return 0; | 172 | return 0; |
169 | 173 | ||
174 | fail_deinit_intr: | ||
175 | host1x_intr_deinit(host); | ||
170 | fail_deinit_syncpt: | 176 | fail_deinit_syncpt: |
171 | host1x_syncpt_deinit(host); | 177 | host1x_syncpt_deinit(host); |
178 | fail_unprepare_disable: | ||
179 | clk_disable_unprepare(host->clk); | ||
172 | return err; | 180 | return err; |
173 | } | 181 | } |
174 | 182 | ||
175 | static int __exit host1x_remove(struct platform_device *pdev) | 183 | static int host1x_remove(struct platform_device *pdev) |
176 | { | 184 | { |
177 | struct host1x *host = platform_get_drvdata(pdev); | 185 | struct host1x *host = platform_get_drvdata(pdev); |
178 | 186 | ||
187 | host1x_unregister(host); | ||
179 | host1x_intr_deinit(host); | 188 | host1x_intr_deinit(host); |
180 | host1x_syncpt_deinit(host); | 189 | host1x_syncpt_deinit(host); |
181 | clk_disable_unprepare(host->clk); | 190 | clk_disable_unprepare(host->clk); |
@@ -184,59 +193,36 @@ static int __exit host1x_remove(struct platform_device *pdev) | |||
184 | } | 193 | } |
185 | 194 | ||
186 | static struct platform_driver tegra_host1x_driver = { | 195 | static struct platform_driver tegra_host1x_driver = { |
187 | .probe = host1x_probe, | ||
188 | .remove = __exit_p(host1x_remove), | ||
189 | .driver = { | 196 | .driver = { |
190 | .owner = THIS_MODULE, | ||
191 | .name = "tegra-host1x", | 197 | .name = "tegra-host1x", |
192 | .of_match_table = host1x_of_match, | 198 | .of_match_table = host1x_of_match, |
193 | }, | 199 | }, |
200 | .probe = host1x_probe, | ||
201 | .remove = host1x_remove, | ||
194 | }; | 202 | }; |
195 | 203 | ||
196 | static int __init tegra_host1x_init(void) | 204 | static int __init tegra_host1x_init(void) |
197 | { | 205 | { |
198 | int err; | 206 | int err; |
199 | 207 | ||
200 | err = platform_driver_register(&tegra_host1x_driver); | 208 | err = host1x_bus_init(); |
201 | if (err < 0) | 209 | if (err < 0) |
202 | return err; | 210 | return err; |
203 | 211 | ||
204 | #ifdef CONFIG_DRM_TEGRA | 212 | err = platform_driver_register(&tegra_host1x_driver); |
205 | err = platform_driver_register(&tegra_dc_driver); | 213 | if (err < 0) { |
206 | if (err < 0) | 214 | host1x_bus_exit(); |
207 | goto unregister_host1x; | 215 | return err; |
208 | 216 | } | |
209 | err = platform_driver_register(&tegra_hdmi_driver); | ||
210 | if (err < 0) | ||
211 | goto unregister_dc; | ||
212 | |||
213 | err = platform_driver_register(&tegra_gr2d_driver); | ||
214 | if (err < 0) | ||
215 | goto unregister_hdmi; | ||
216 | #endif | ||
217 | 217 | ||
218 | return 0; | 218 | return 0; |
219 | |||
220 | #ifdef CONFIG_DRM_TEGRA | ||
221 | unregister_hdmi: | ||
222 | platform_driver_unregister(&tegra_hdmi_driver); | ||
223 | unregister_dc: | ||
224 | platform_driver_unregister(&tegra_dc_driver); | ||
225 | unregister_host1x: | ||
226 | platform_driver_unregister(&tegra_host1x_driver); | ||
227 | return err; | ||
228 | #endif | ||
229 | } | 219 | } |
230 | module_init(tegra_host1x_init); | 220 | module_init(tegra_host1x_init); |
231 | 221 | ||
232 | static void __exit tegra_host1x_exit(void) | 222 | static void __exit tegra_host1x_exit(void) |
233 | { | 223 | { |
234 | #ifdef CONFIG_DRM_TEGRA | ||
235 | platform_driver_unregister(&tegra_gr2d_driver); | ||
236 | platform_driver_unregister(&tegra_hdmi_driver); | ||
237 | platform_driver_unregister(&tegra_dc_driver); | ||
238 | #endif | ||
239 | platform_driver_unregister(&tegra_host1x_driver); | 224 | platform_driver_unregister(&tegra_host1x_driver); |
225 | host1x_bus_exit(); | ||
240 | } | 226 | } |
241 | module_exit(tegra_host1x_exit); | 227 | module_exit(tegra_host1x_exit); |
242 | 228 | ||