From aec94d809348e8ff9a900c2a38456d7217c86728 Mon Sep 17 00:00:00 2001 From: Kenneth Adams Date: Wed, 29 Oct 2014 08:28:27 +0200 Subject: gpu: nvgpu: T18x support nvgpu framework and build for T18x Bug 1567274 Change-Id: I77835302a1110573008869d1106eface512bb9b1 Signed-off-by: Ken Adams Signed-off-by: Terje Bergstrom --- drivers/gpu/nvgpu/Makefile | 12 ++++++++++++ drivers/gpu/nvgpu/gk20a/gk20a.c | 17 +++++++++++++++++ drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 3 +-- drivers/gpu/nvgpu/gk20a/hal.c | 10 ++++++++++ drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 4 ++++ drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c | 6 +++--- 6 files changed, 47 insertions(+), 5 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 391ccec7..f189cdc9 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -6,6 +6,12 @@ ccflags-y += -Idrivers/devfreq ccflags-y += -Wno-multichar ccflags-y += -Werror +ifeq ($(CONFIG_ARCH_TEGRA_18x_SOC),y) +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/drivers/gpu/nvgpu +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/include +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/include/uapi +endif + obj-$(CONFIG_GK20A) := nvgpu.o nvgpu-y := \ @@ -70,3 +76,9 @@ nvgpu-$(CONFIG_TEGRA_CLK_FRAMEWORK) += \ nvgpu-$(CONFIG_GK20A_DEVFREQ) += \ gk20a/gk20a_scale.o + +ifeq ($(CONFIG_ARCH_TEGRA_18x_SOC),y) +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/drivers/gpu/nvgpu +ccflags-$(CONFIG_GK20A) += -I$(srctree)/../kernel-t18x/include +obj-$(CONFIG_GK20A) += ../../../../kernel-t18x/drivers/gpu/nvgpu/ +endif diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 2e1bd003..3df13309 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -64,6 +64,10 @@ #define CREATE_TRACE_POINTS #include +#ifdef CONFIG_ARCH_TEGRA_18x_SOC +#include "nvgpu_gpuid_t18x.h" +#endif + #ifdef CONFIG_ARM64 #define __cpuc_flush_dcache_area __flush_dcache_area #endif @@ -878,6 +882,10 @@ static struct of_device_id tegra_gk20a_of_match[] = { .data = &gk20a_tegra_platform }, { .compatible = "nvidia,tegra210-gm20b", .data = &gm20b_tegra_platform }, +#ifdef CONFIG_ARCH_TEGRA_18x_SOC + { .compatible = TEGRA_18x_GPU_COMPAT_TEGRA, + .data = &gk20a_tegra_platform }, +#endif #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION { .compatible = "nvidia,tegra124-gk20a-vgpu", .data = &vgpu_tegra_platform }, @@ -887,11 +895,20 @@ static struct of_device_id tegra_gk20a_of_match[] = { .data = &gk20a_generic_platform }, { .compatible = "nvidia,tegra210-gm20b", .data = &gk20a_generic_platform }, +#ifdef CONFIG_ARCH_TEGRA_18x_SOC + { .compatible = TEGRA_18x_GPU_COMPAT_TEGRA, + .data = &gk20a_generic_platform }, +#endif + #endif { .compatible = "nvidia,generic-gk20a", .data = &gk20a_generic_platform }, { .compatible = "nvidia,generic-gm20b", .data = &gk20a_generic_platform }, +#ifdef CONFIG_ARCH_TEGRA_18x_SOC + { .compatible = TEGRA_18x_GPU_COMPAT_GENERIC, + .data = &gk20a_generic_platform }, +#endif { }, }; diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index b07d0803..4b0d7591 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -2150,8 +2150,7 @@ int gr_gk20a_load_ctxsw_ucode(struct gk20a *g) * In case bootloader is not supported, revert to the old way of * loading gr ucode, without the faster bootstrap routine. */ - if (g->gpu_characteristics.arch != NVGPU_GPU_ARCH_GK100 && - g->gpu_characteristics.arch != NVGPU_GPU_ARCH_GM200) { + if (g->gpu_characteristics.arch > NVGPU_GPU_ARCH_GM200) { gr_gk20a_load_falcon_dmem(g); gr_gk20a_load_falcon_imem(g); gr_gk20a_start_falcon_ucode(g); diff --git a/drivers/gpu/nvgpu/gk20a/hal.c b/drivers/gpu/nvgpu/gk20a/hal.c index 8d1a29dd..56553819 100644 --- a/drivers/gpu/nvgpu/gk20a/hal.c +++ b/drivers/gpu/nvgpu/gk20a/hal.c @@ -17,6 +17,10 @@ #include "hal_gk20a.h" #include "gm20b/hal_gm20b.h" +#ifdef CONFIG_ARCH_TEGRA_18x_SOC +#include "nvgpu_gpuid_t18x.h" +#endif + int gpu_init_hal(struct gk20a *g) { u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; @@ -30,6 +34,12 @@ int gpu_init_hal(struct gk20a *g) if (gm20b_init_hal(&g->ops)) return -ENODEV; break; +#if defined(CONFIG_ARCH_TEGRA_18x_SOC) + case TEGRA_18x_GPUID: + if (TEGRA_18x_GPUID_HAL(&g->ops)) + return -ENODEV; + break; +#endif default: gk20a_err(&g->dev->dev, "no support for %x", ver); return -ENODEV; diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h index d5a1cc91..0cc04595 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h @@ -185,4 +185,8 @@ static inline bool gk20a_platform_has_syncpoints(struct platform_device *dev) return p->has_syncpoints; } +int gk20a_tegra_busy(struct platform_device *dev); +void gk20a_tegra_idle(struct platform_device *dev); +void gk20a_tegra_debug_dump(struct platform_device *pdev); + #endif diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c index d7500929..a4b7fe18 100644 --- a/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c @@ -339,14 +339,14 @@ static void gk20a_tegra_scale_init(struct platform_device *pdev) profile->private_data = emc_params; } -static void gk20a_tegra_debug_dump(struct platform_device *pdev) +void gk20a_tegra_debug_dump(struct platform_device *pdev) { struct gk20a_platform *platform = gk20a_get_platform(pdev); struct gk20a *g = platform->g; nvhost_debug_dump_device(g->host1x_dev); } -static int gk20a_tegra_busy(struct platform_device *dev) +int gk20a_tegra_busy(struct platform_device *dev) { struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a *g = platform->g; @@ -356,7 +356,7 @@ static int gk20a_tegra_busy(struct platform_device *dev) return 0; } -static void gk20a_tegra_idle(struct platform_device *dev) +void gk20a_tegra_idle(struct platform_device *dev) { struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a *g = platform->g; -- cgit v1.2.2