diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2014-04-11 10:46:07 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:09:46 -0400 |
commit | d224ca20089a9f05bd72d83990c190ad0c1e73c8 (patch) | |
tree | a33fce050a9c0d0bfd9c6d43af40b82b668d58a0 /drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | |
parent | 596aa6e592eef797770575833811303d5a5a65dd (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/nvgpu/gk20a/platform_gk20a_tegra.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 24 |
1 files changed, 23 insertions, 1 deletions
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 | ||
409 | static int gk20a_tegra_probe(struct platform_device *dev) | 410 | static 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; |