diff --git a/drivers/gpu/nvgpu/gp10b/Makefile b/drivers/gpu/nvgpu/gp10b/Makefile index 722cc5503..193efee0d 100644 --- a/drivers/gpu/nvgpu/gp10b/Makefile +++ b/drivers/gpu/nvgpu/gp10b/Makefile @@ -12,3 +12,5 @@ obj-$(CONFIG_GK20A) += \ gr_gp10b.o \ mc_gp10b.o \ hal_gp10b.o + +obj-$(CONFIG_TEGRA_GK20A) += platform_gp10b_tegra.o diff --git a/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c new file mode 100644 index 000000000..7a25a3fc3 --- /dev/null +++ b/drivers/gpu/nvgpu/gp10b/platform_gp10b_tegra.c @@ -0,0 +1,99 @@ +/* + * drivers/video/tegra/host/gk20a/platform_gk20a_tegra.c + * + * GK20A Tegra Platform Interface + * + * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gk20a/platform_gk20a.h" +#include "gk20a/gk20a.h" + +static int gp10b_tegra_probe(struct platform_device *pdev) +{ + struct gk20a_platform *platform = gk20a_get_platform(pdev); + struct device_node *np = pdev->dev.of_node; + struct device_node *host1x_node; + struct platform_device *host1x_pdev; + const __be32 *host1x_ptr; + + host1x_ptr = of_get_property(np, "nvidia,host1x", NULL); + if (!host1x_ptr) { + gk20a_err(&pdev->dev, "host1x device not available"); + return -ENOSYS; + } + + host1x_node = of_find_node_by_phandle(be32_to_cpup(host1x_ptr)); + host1x_pdev = of_find_device_by_node(host1x_node); + if (!host1x_pdev) { + gk20a_err(&pdev->dev, "host1x device not available"); + return -ENOSYS; + } + + platform->g->host1x_dev = host1x_pdev; + + return 0; +} + +static int gp10b_tegra_late_probe(struct platform_device *pdev) +{ + return 0; +} + +static bool gp10b_tegra_is_railgated(struct platform_device *pdev) +{ + return false; +} + +static int gp10b_tegra_railgate(struct platform_device *pdev) +{ + return 0; +} + +static int gp10b_tegra_unrailgate(struct platform_device *pdev) +{ + return 0; +} + +static int gp10b_tegra_suspend(struct device *dev) +{ + return 0; +} + +struct gk20a_platform t18x_gpu_tegra_platform = { + .has_syncpoints = true, + + .default_big_page_size = SZ_128K, + + .probe = gp10b_tegra_probe, + .late_probe = gp10b_tegra_late_probe, + + /* power management callbacks */ + .suspend = gp10b_tegra_suspend, + .railgate = gp10b_tegra_railgate, + .unrailgate = gp10b_tegra_unrailgate, + .is_railgated = gp10b_tegra_is_railgated, + + .busy = gk20a_tegra_busy, + .idle = gk20a_tegra_idle, + + .dump_platform_dependencies = gk20a_tegra_debug_dump, +}; diff --git a/drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h b/drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h index fe027fb01..ac65af189 100644 --- a/drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h +++ b/drivers/gpu/nvgpu/nvgpu_gpuid_t18x.h @@ -27,4 +27,5 @@ #define TEGRA_18x_GPU_COMPAT_GENERIC NVGPU_COMPAT_GENERIC_GP10B struct gpu_ops; extern int gp10b_init_hal(struct gpu_ops *); +extern struct gk20a_platform t18x_gpu_tegra_platform; #endif