summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorArto Merilainen <amerilainen@nvidia.com>2014-04-11 10:46:07 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:46 -0400
commitd224ca20089a9f05bd72d83990c190ad0c1e73c8 (patch)
treea33fce050a9c0d0bfd9c6d43af40b82b668d58a0 /drivers/gpu
parent596aa6e592eef797770575833811303d5a5a65dd (diff)
gpu: nvgpu: Get host1x device from DTS
Currently the gpu driver assumes that the GPU is a child of host1x. This is an invalid assumption and therefore we need to get the host1x device from device tree based on nvidia,host1x property. Bug 1311528 Bug 1434573 Change-Id: I097e39369aaa15ab6652cd23f353f88f7c2b9c48 Signed-off-by: Arto Merilainen <amerilainen@nvidia.com> Reviewed-on: http://git-master/r/395664 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/debug_gk20a.c3
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c24
4 files changed, 27 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 8122d213..55ee5181 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -343,8 +343,8 @@ gk20a_channel_syncpt_create(struct channel_gk20a *c)
343 return NULL; 343 return NULL;
344 344
345 sp->c = c; 345 sp->c = c;
346 sp->host1x_pdev = to_platform_device(c->g->dev->dev.parent); 346 sp->host1x_pdev = c->g->host1x_dev;
347 sp->id = nvhost_get_syncpt_host_managed(c->g->dev, c->hw_chid); 347 sp->id = nvhost_get_syncpt_host_managed(sp->host1x_pdev, c->hw_chid);
348 348
349 sp->ops.wait_cpu = gk20a_channel_syncpt_wait_cpu; 349 sp->ops.wait_cpu = gk20a_channel_syncpt_wait_cpu;
350 sp->ops.is_expired = gk20a_channel_syncpt_is_expired; 350 sp->ops.is_expired = gk20a_channel_syncpt_is_expired;
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
index 3f1f4f0a..f5e0b73d 100644
--- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
@@ -147,8 +147,7 @@ static void gk20a_debug_show_channel(struct gk20a *g,
147 gk20a_debug_output(o, "%s on syncpt %u (%s) val %u\n", 147 gk20a_debug_output(o, "%s on syncpt %u (%s) val %u\n",
148 (status == 3 || status == 8) ? "Waiting" : "Waited", 148 (status == 3 || status == 8) ? "Waiting" : "Waited",
149 pbdma_syncpointb_syncpt_index_v(syncpointb), 149 pbdma_syncpointb_syncpt_index_v(syncpointb),
150 nvhost_syncpt_get_name( 150 nvhost_syncpt_get_name(g->host1x_dev,
151 to_platform_device(g->dev->dev.parent),
152 pbdma_syncpointb_syncpt_index_v(syncpointb)), 151 pbdma_syncpointb_syncpt_index_v(syncpointb)),
153 pbdma_syncpointa_payload_v(syncpointa)); 152 pbdma_syncpointa_payload_v(syncpointa));
154 153
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index b8de8744..fc488a28 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -209,6 +209,7 @@ struct gpu_ops {
209 209
210struct gk20a { 210struct gk20a {
211 struct platform_device *dev; 211 struct platform_device *dev;
212 struct platform_device *host1x_dev;
212 213
213 struct resource *reg_mem; 214 struct resource *reg_mem;
214 void __iomem *regs; 215 void __iomem *regs;
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c
index 05aec1a7..7af801f8 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c
@@ -15,6 +15,7 @@
15 * more details. 15 * more details.
16 */ 16 */
17 17
18#include <linux/of_platform.h>
18#include <linux/debugfs.h> 19#include <linux/debugfs.h>
19#include <linux/tegra-powergate.h> 20#include <linux/tegra-powergate.h>
20#include <linux/platform_data/tegra_edp.h> 21#include <linux/platform_data/tegra_edp.h>
@@ -403,12 +404,33 @@ static void gk20a_tegra_debug_dump(struct platform_device *pdev)
403{ 404{
404 struct gk20a_platform *platform = gk20a_get_platform(pdev); 405 struct gk20a_platform *platform = gk20a_get_platform(pdev);
405 struct gk20a *g = platform->g; 406 struct gk20a *g = platform->g;
406 nvhost_debug_dump_device(g->dev); 407 nvhost_debug_dump_device(g->host1x_dev);
407} 408}
408 409
409static int gk20a_tegra_probe(struct platform_device *dev) 410static int gk20a_tegra_probe(struct platform_device *dev)
410{ 411{
411 struct gk20a_platform *platform = gk20a_get_platform(dev); 412 struct gk20a_platform *platform = gk20a_get_platform(dev);
413 struct device_node *np = dev->dev.of_node;
414 const __be32 *host1x_ptr;
415 struct platform_device *host1x_pdev = NULL;
416
417 host1x_ptr = of_get_property(np, "nvidia,host1x", NULL);
418 if (host1x_ptr) {
419 struct device_node *host1x_node =
420 of_find_node_by_phandle(be32_to_cpup(host1x_ptr));
421
422 host1x_pdev = of_find_device_by_node(host1x_node);
423 if (!host1x_pdev) {
424 dev_warn(&dev->dev, "host1x device not available");
425 return -EPROBE_DEFER;
426 }
427
428 } else {
429 host1x_pdev = to_platform_device(dev->dev.parent);
430 dev_warn(&dev->dev, "host1x reference not found. assuming host1x to be parent");
431 }
432
433 platform->g->host1x_dev = host1x_pdev;
412 434
413 if (tegra_get_chipid() == TEGRA_CHIPID_TEGRA13) { 435 if (tegra_get_chipid() == TEGRA_CHIPID_TEGRA13) {
414 t132_gk20a_tegra_platform.g = platform->g; 436 t132_gk20a_tegra_platform.g = platform->g;