From df499d04d35d73c1518fc4c458d9207ad7428332 Mon Sep 17 00:00:00 2001 From: Santosh B S Date: Mon, 5 Jul 2021 12:41:24 +0530 Subject: [PATCH] video: tegra: host: moving T239 to private repo This patch takes care of moving NvHost changes related to T239 to it's dedicated repo. Jira HOSTX-2908 Jira HOSTX-2950 Change-Id: I0faa9b427c41c1f9970076cbf7602bbe5ed27a2a Signed-off-by: Santosh B S Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2554027 Reviewed-by: svc_kernel_abi Reviewed-by: Arto Merilainen Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/video/tegra/host/Kconfig | 7 + drivers/video/tegra/host/Makefile | 9 +- drivers/video/tegra/host/flcn/flcn.c | 7 +- drivers/video/tegra/host/flcn/flcn_t23x.h | 9 +- drivers/video/tegra/host/host1x/host1x.c | 14 +- .../tegra/host/host1x/host1x_of_match_t23x.h | 31 -- drivers/video/tegra/host/nvdec/nvdec.c | 11 +- .../tegra/host/nvdec/nvdec_of_match_t23x.h | 30 - drivers/video/tegra/host/t239/Makefile | 16 - drivers/video/tegra/host/t239/cg_regs.c | 117 ---- .../video/tegra/host/t239/classid_vm_regs.c | 35 -- drivers/video/tegra/host/t239/hardware_t239.h | 173 ------ drivers/video/tegra/host/t239/mmio_vm_regs.c | 32 -- drivers/video/tegra/host/t239/streamid_regs.c | 64 --- drivers/video/tegra/host/t239/t239.c | 521 ------------------ drivers/video/tegra/host/t239/t239.h | 49 -- drivers/video/tegra/host/tsec/tsec.c | 11 +- .../tegra/host/tsec/tsec_of_match_t23x.h | 30 - 18 files changed, 55 insertions(+), 1111 deletions(-) delete mode 100644 drivers/video/tegra/host/host1x/host1x_of_match_t23x.h delete mode 100644 drivers/video/tegra/host/nvdec/nvdec_of_match_t23x.h delete mode 100644 drivers/video/tegra/host/t239/Makefile delete mode 100644 drivers/video/tegra/host/t239/cg_regs.c delete mode 100644 drivers/video/tegra/host/t239/classid_vm_regs.c delete mode 100644 drivers/video/tegra/host/t239/hardware_t239.h delete mode 100644 drivers/video/tegra/host/t239/mmio_vm_regs.c delete mode 100644 drivers/video/tegra/host/t239/streamid_regs.c delete mode 100644 drivers/video/tegra/host/t239/t239.c delete mode 100644 drivers/video/tegra/host/t239/t239.h delete mode 100644 drivers/video/tegra/host/tsec/tsec_of_match_t23x.h diff --git a/drivers/video/tegra/host/Kconfig b/drivers/video/tegra/host/Kconfig index 316007a7b4cb..80dc59d1db0b 100644 --- a/drivers/video/tegra/host/Kconfig +++ b/drivers/video/tegra/host/Kconfig @@ -7,6 +7,13 @@ config TEGRA_T23X_GRHOST help Driver for the Tegra graphics host hardware. +config TEGRA_T239_GRHOST + bool "Tegra 239 graphics host driver" + depends on TEGRA_GRHOST && ARCH_TEGRA_239_SOC + default y + help + Driver for the Tegra graphics host hardware. + config TEGRA_GRHOST_NVDLA bool "Tegra NVDLA support" depends on TEGRA_GRHOST && (ARCH_TEGRA_19x_SOC || ARCH_TEGRA_194_SOC) diff --git a/drivers/video/tegra/host/Makefile b/drivers/video/tegra/host/Makefile index c337add23e85..a3c35d18ece1 100644 --- a/drivers/video/tegra/host/Makefile +++ b/drivers/video/tegra/host/Makefile @@ -6,6 +6,11 @@ ccflags-y += -Idrivers/video/tegra/host ccflags-y += -Idrivers/devfreq ccflags-y += -Wno-multichar +ifeq ($(CONFIG_TEGRA_T239_GRHOST),y) + ccflags-y += -I$(srctree.nvidia-t239)/include + ccflags-y += -I$(srctree.nvidia-t239)/drivers/video/tegra/host +endif + ccflags-y += -Werror -Wno-vla nvhost-y += \ @@ -32,9 +37,11 @@ nvhost-y += \ nvhost-$(CONFIG_TEGRA_T23X_GRHOST) += \ t23x/t23x.o \ - t239/t239.o \ riscv/riscv.o +nvhost-$(CONFIG_TEGRA_T239_GRHOST) += \ + t239/t239.o + nvhost-$(CONFIG_TEGRA_GRHOST_OFA) += ofa/ofa.o nvhost-$(CONFIG_TEGRA_GRHOST_NVDEC) += nvdec/nvdec.o diff --git a/drivers/video/tegra/host/flcn/flcn.c b/drivers/video/tegra/host/flcn/flcn.c index d08d1e8bd42d..ff3a9b43418b 100644 --- a/drivers/video/tegra/host/flcn/flcn.c +++ b/drivers/video/tegra/host/flcn/flcn.c @@ -50,6 +50,8 @@ #include "t194/t194.h" #ifdef CONFIG_TEGRA_T23X_GRHOST #include "t23x/t23x.h" +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST #include "t239/t239.h" #endif @@ -706,7 +708,10 @@ static struct of_device_id tegra_flcn_of_match[] = { .data = (struct nvhost_device_data *)&t19_nvjpg_info }, #endif #ifdef CONFIG_TEGRA_T23X_GRHOST -#include "flcn/flcn_t23x.h" + #include "flcn/flcn_t23x.h" +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST + #include "flcn/flcn_of_match_t239.h" #endif { }, }; diff --git a/drivers/video/tegra/host/flcn/flcn_t23x.h b/drivers/video/tegra/host/flcn/flcn_t23x.h index 848dcaa69983..f0067ff02847 100644 --- a/drivers/video/tegra/host/flcn/flcn_t23x.h +++ b/drivers/video/tegra/host/flcn/flcn_t23x.h @@ -13,7 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * struct of_device_id initialization for T234 and T239 + * struct of_device_id initialization for T234 */ //static struct of_device_id tegra_flcn_of_match[] = { @@ -21,8 +21,6 @@ #if defined(CONFIG_TEGRA_GRHOST_VIC) { .compatible = "nvidia,tegra234-vic", .data = (struct nvhost_device_data *)&t23x_vic_info }, - { .compatible = "nvidia,tegra239-vic", - .data = (struct nvhost_device_data *)&t239_vic_info }, #endif #if defined(CONFIG_TEGRA_GRHOST_NVJPG) { .compatible = "nvidia,tegra234-nvjpg", @@ -36,15 +34,10 @@ { .compatible = "nvidia,tegra234-nvenc", .data = (struct nvhost_device_data *)&t23x_msenc_info, .name = "nvenc" }, - { .compatible = "nvidia,tegra239-nvenc", - .data = (struct nvhost_device_data *)&t239_msenc_info, - .name = "nvenc" }, #endif #if defined(CONFIG_TEGRA_GRHOST_OFA) { .compatible = "nvidia,tegra234-ofa", .data = (struct nvhost_device_data *)&t23x_ofa_info }, - { .compatible = "nvidia,tegra239-ofa", - .data = (struct nvhost_device_data *)&t239_ofa_info }, #endif //}; diff --git a/drivers/video/tegra/host/host1x/host1x.c b/drivers/video/tegra/host/host1x/host1x.c index f2f0dbacbef9..ae197f33ebc3 100644 --- a/drivers/video/tegra/host/host1x/host1x.c +++ b/drivers/video/tegra/host/host1x/host1x.c @@ -67,6 +67,8 @@ #include "t194/t194.h" #ifdef CONFIG_TEGRA_T23X_GRHOST #include "t23x/t23x.h" +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST #include "t239/t239.h" #endif @@ -1016,7 +1018,17 @@ static struct of_device_id tegra_host1x_of_match[] = { .compatible = "nvidia,tegra194-host1x-hv", .data = (struct nvhost_device_data *)&t19_host1x_hv_info }, #ifdef CONFIG_TEGRA_T23X_GRHOST - #include "host1x/host1x_of_match_t23x.h" + { .name = "host1x", + .compatible = "nvidia,tegra234-host1x", + .data = (struct nvhost_device_data *)&t23x_host1x_info }, + { .name = "host1x", + .compatible = "nvidia,tegra234-host1x-hv", + .data = (struct nvhost_device_data *)&t23x_host1x_hv_info }, +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST + { .name = "host1x", + .compatible = "nvidia,tegra239-host1x", + .data = (struct nvhost_device_data *)&t239_host1x_info }, #endif { }, }; diff --git a/drivers/video/tegra/host/host1x/host1x_of_match_t23x.h b/drivers/video/tegra/host/host1x/host1x_of_match_t23x.h deleted file mode 100644 index 09d7854e5424..000000000000 --- a/drivers/video/tegra/host/host1x/host1x_of_match_t23x.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2021, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * struct of_device_id initialization for T234 and T239 - */ - -//static struct of_device_id tegra_host1x_of_match[] = { - - { .name = "host1x", - .compatible = "nvidia,tegra234-host1x", - .data = (struct nvhost_device_data *)&t23x_host1x_info }, - { .name = "host1x", - .compatible = "nvidia,tegra234-host1x-hv", - .data = (struct nvhost_device_data *)&t23x_host1x_hv_info }, - { .name = "host1x", - .compatible = "nvidia,tegra239-host1x", - .data = (struct nvhost_device_data *)&t239_host1x_info }, - -//}; diff --git a/drivers/video/tegra/host/nvdec/nvdec.c b/drivers/video/tegra/host/nvdec/nvdec.c index 6ed1712ea5a3..e3927d1afb05 100644 --- a/drivers/video/tegra/host/nvdec/nvdec.c +++ b/drivers/video/tegra/host/nvdec/nvdec.c @@ -60,6 +60,8 @@ #include "t194/t194.h" #ifdef CONFIG_TEGRA_T23X_GRHOST #include "t23x/t23x.h" +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST #include "t239/t239.h" #endif @@ -473,7 +475,14 @@ static struct of_device_id tegra_nvdec_of_match[] = { .data = (struct nvhost_device_data *)&t19_nvdec1_info, .name = "nvdec1" }, #ifdef CONFIG_TEGRA_T23X_GRHOST - #include "nvdec/nvdec_of_match_t23x.h" + { .compatible = "nvidia,tegra234-nvdec", + .data = (struct nvhost_device_data *)&t23x_nvdec_info, + .name = "nvdec" }, +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST + { .compatible = "nvidia,tegra239-nvdec", + .data = (struct nvhost_device_data *)&t239_nvdec_info, + .name = "nvdec" }, #endif { }, }; diff --git a/drivers/video/tegra/host/nvdec/nvdec_of_match_t23x.h b/drivers/video/tegra/host/nvdec/nvdec_of_match_t23x.h deleted file mode 100644 index edf6b6fe09f7..000000000000 --- a/drivers/video/tegra/host/nvdec/nvdec_of_match_t23x.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * struct of_device_id initialization for nvdec on T234 and T239 - */ - -//static struct of_device_id tegra_nvdec_of_match[] = { - -#if defined(CONFIG_TEGRA_GRHOST_NVDEC) - { .compatible = "nvidia,tegra234-nvdec", - .data = (struct nvhost_device_data *)&t23x_nvdec_info, - .name = "nvdec" }, - { .compatible = "nvidia,tegra239-nvdec", - .data = (struct nvhost_device_data *)&t239_nvdec_info, - .name = "nvdec" }, -#endif - -//}; diff --git a/drivers/video/tegra/host/t239/Makefile b/drivers/video/tegra/host/t239/Makefile deleted file mode 100644 index b53a66f0e731..000000000000 --- a/drivers/video/tegra/host/t239/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -ifeq ($(CONFIG_TEGRA_T23X_GRHOST),y) - -GCOV_PROFILE := y -ccflags-y += -I$(srctree.nvidia)/drivers/video/tegra/host -ccflags-y += -Idrivers/video/tegra/camera -ccflags-y += -Idrivers/media/platform/tegra/camera -ccflags-y += -I$(srctree.nvidia)/include -ccflags-y += -Wno-multichar -ccflags-y += -Werror - -nvhost-t239-objs = \ - t239.o - -obj-$(CONFIG_TEGRA_GRHOST) += nvhost-t239.o - -endif diff --git a/drivers/video/tegra/host/t239/cg_regs.c b/drivers/video/tegra/host/t239/cg_regs.c deleted file mode 100644 index 657402993099..000000000000 --- a/drivers/video/tegra/host/t239/cg_regs.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2021, NVIDIA Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * This program is distributed in the hope that 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * This file is autogenerated. Do not edit. - */ - -static struct nvhost_gating_register __attribute__((__unused__)) - t239_host1x_gating_registers[] = { - /* HOST1X_THOST_COMMON_ICG_EN_OVERRIDE_0 */ - { .addr = 0x00004808, .prod = 0x00000000, .disable = 0x00000001 }, - {} -}; - -static struct nvhost_gating_register __attribute__((__unused__)) - t239_nvenc_gating_registers[] = { - /* NV_PNVENC_THI_CLK_OVERRIDE */ - { .addr = 0x00000e00, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PNVENC_THI_SLCG_OVERRIDE_HIGH_A */ - { .addr = 0x00000088, .prod = 0x00000000, .disable = 0x000000ff }, - /* NV_PNVENC_THI_SLCG_OVERRIDE_LOW_A */ - { .addr = 0x0000008c, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PNVENC_FALCON_CGCTL */ - { .addr = 0x000010a0, .prod = 0x00000000, .disable = 0x00000001 }, - /* NV_PNVENC_TFBIF_MCCIF_FIFOCTRL */ - { .addr = 0x00001804, .prod = 0x00000000, .disable = 0x00000000 }, - /* NV_PNVENC_FALCON_CG2 */ - { .addr = 0x00001134, .prod = 0x00010004, .disable = 0x0003fffe }, - /* NV_PNVENC_CG2 */ - { .addr = 0x00002200, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PNVENC_CG3 */ - { .addr = 0x00002204, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PNVENC_CG4 */ - { .addr = 0x00002208, .prod = 0x00000000, .disable = 0xffffffff }, - {} -}; - -static struct nvhost_gating_register __attribute__((__unused__)) - t239_tsec_gating_registers[] = { - /* NV_PSEC_THI_CLK_OVERRIDE */ - { .addr = 0x00000e00, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PSEC_THI_SLCG_OVERRIDE_HIGH_A */ - { .addr = 0x00000088, .prod = 0x00000000, .disable = 0x000000ff }, - /* NV_PSEC_THI_SLCG_OVERRIDE_LOW_A */ - { .addr = 0x0000008c, .prod = 0x00000000, .disable = 0xffffffff }, - {} -}; - -static struct nvhost_gating_register __attribute__((__unused__)) - t239_vic_gating_registers[] = { - /* NV_PVIC_THI_CLK_OVERRIDE */ - { .addr = 0x00000e00, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PVIC_THI_SLCG_OVERRIDE_HIGH_A */ - { .addr = 0x00000088, .prod = 0x00000000, .disable = 0x000000ff }, - /* NV_PVIC_THI_SLCG_OVERRIDE_LOW_A */ - { .addr = 0x0000008c, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PVIC_FALCON_CGCTL */ - { .addr = 0x000010a0, .prod = 0x00000000, .disable = 0x00000001 }, - /* NV_PVIC_TFBIF_MCCIF_FIFOCTRL */ - { .addr = 0x00002004, .prod = 0x00000000, .disable = 0x00000000 }, - /* NV_PVIC_FALCON_CG2 */ - { .addr = 0x00001134, .prod = 0x00000000, .disable = 0x0003fffe }, - {} -}; - -static struct nvhost_gating_register __attribute__((__unused__)) - t239_nvdec_gating_registers[] = { - /* NV_PNVDEC_THI_CLK_OVERRIDE */ - { .addr = 0x00000e00, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PNVDEC_THI_SLCG_OVERRIDE_HIGH_A */ - { .addr = 0x00000088, .prod = 0x00000000, .disable = 0x000000ff }, - /* NV_PNVDEC_THI_SLCG_OVERRIDE_LOW_A */ - { .addr = 0x0000008c, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PNVDEC_FALCON_CGCTL */ - { .addr = 0x000010a0, .prod = 0x00000000, .disable = 0x00000001 }, - /* NV_PNVDEC_TFBIF_MCCIF_FIFOCTRL */ - { .addr = 0x00004e04, .prod = 0x00000000, .disable = 0x00000000 }, - /* NV_PNVDEC_FALCON_CG2 */ - { .addr = 0x00001134, .prod = 0x00010004, .disable = 0x0003fffe }, - /* NV_PNVDEC_CG2 */ - { .addr = 0x00002328, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_PNVDEC_CG3 */ - { .addr = 0x0000232c, .prod = 0x00800000, .disable = 0xffffffff }, - /* NV_PNVDEC_CG4 */ - { .addr = 0x00002950, .prod = 0xffff000e, .disable = 0xffffffff }, - /* NV_PNVDEC_SLCG_GIP_THROTTLE */ - { .addr = 0x00002340, .prod = 0x006db6db, .disable = 0x00ffffff }, - {} -}; - -static struct nvhost_gating_register __attribute__((__unused__)) - t239_ofa_gating_registers[] = { - /* NV_POFA_THI_CLK_OVERRIDE */ - { .addr = 0x00000e00, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_POFA_THI_SLCG_OVERRIDE_HIGH_A */ - { .addr = 0x00000088, .prod = 0x00000000, .disable = 0x000000ff }, - /* NV_POFA_THI_SLCG_OVERRIDE_LOW_A */ - { .addr = 0x0000008c, .prod = 0x00000000, .disable = 0xffffffff }, - /* NV_POFA_FALCON_CGCTL */ - { .addr = 0x000010a0, .prod = 0x00000000, .disable = 0x00000001 }, - /* NV_POFA_TFBIF_MCCIF_FIFOCTRL */ - { .addr = 0x00001404, .prod = 0x00000000, .disable = 0x00000000 }, - /* NV_POFA_FALCON_CG2 */ - { .addr = 0x00001134, .prod = 0x00010004, .disable = 0x0003fffe }, - {} -}; diff --git a/drivers/video/tegra/host/t239/classid_vm_regs.c b/drivers/video/tegra/host/t239/classid_vm_regs.c deleted file mode 100644 index 638951f426a1..000000000000 --- a/drivers/video/tegra/host/t239/classid_vm_regs.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2021, NVIDIA Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * This program is distributed in the hope that 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* HOST1X_THOST_COMMON_STRMID_VM_0 */ -static const u32 t239_host1x_strmid_vm_r = 0x0804u; -static const u32 t239_strmid_vm_regs_nb = 128u; -static const u32 t239_host1x_classid_vm_r[] = { - 0x0c04u, /* HOST1X_THOST_COMMON_THOST_CLASSID_VM */ - 0x0c08u, /* HOST1X_THOST_COMMON_SE1_CLASSID_VM */ - 0x0c0cu, /* HOST1X_THOST_COMMON_SE2_CLASSID_VM */ - 0x0c10u, /* HOST1X_THOST_COMMON_SE4_CLASSID_VM */ - 0x0c14u, /* HOST1X_THOST_COMMON_SEU1SE1_CLASSID_VM */ - 0x0c18u, /* HOST1X_THOST_COMMON_SEU1SE2_CLASSID_VM */ - 0x0c1cu, /* HOST1X_THOST_COMMON_SEU1SE4_CLASSID_VM */ - 0x0c20u, /* HOST1X_THOST_COMMON_DPAUX_CLASSID_VM */ - 0x0c24u, /* HOST1X_THOST_COMMON_VIC_CLASSID_VM */ - 0x0c28u, /* HOST1X_THOST_COMMON_NVENC_CLASSID_VM */ - 0x0c2cu, /* HOST1X_THOST_COMMON_NVDEC_CLASSID_VM */ - 0x0c30u, /* HOST1X_THOST_COMMON_TSEC_CLASSID_VM */ - 0x0c34u, /* HOST1X_THOST_COMMON_FDE_CLASSID_VM */ - 0x0c38u, /* HOST1X_THOST_COMMON_OFA_CLASSID_VM */ -}; diff --git a/drivers/video/tegra/host/t239/hardware_t239.h b/drivers/video/tegra/host/t239/hardware_t239.h deleted file mode 100644 index f916c43b89d6..000000000000 --- a/drivers/video/tegra/host/t239/hardware_t239.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * drivers/video/tegra/host/t239/hardware_t239.h - * - * Tegra T239 HOST1X Register Definitions - * - * Copyright (c) 2021, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef __NVHOST_HARDWARE_T239_H -#define __NVHOST_HARDWARE_T239_H - -#include "host1x/hw_host1x09_sync.h" -#include "host1x/hw_host1x6_uclass.h" -#include "host1x/hw_host1x8_channel.h" -#include "host1x/hw_host1x5_actmon.h" - -/* sync registers */ -#define NV_HOST1X_SYNCPT_NB_PTS 512 -#define NV_HOST1X_NB_MLOCKS 14 - -#define NV_HOST1X_MLOCK_ID_VIC 8 -#define NV_HOST1X_MLOCK_ID_NVENC 9 -#define NV_HOST1X_MLOCK_ID_NVDEC 10 -#define NV_HOST1X_MLOCK_ID_TSEC 11 -#define NV_HOST1X_MLOCK_ID_FDE 12 -#define NV_HOST1X_MLOCK_ID_OFA 13 - -/* Generic support */ -static inline u32 nvhost_class_host_wait_syncpt( - unsigned int indx, unsigned int threshold) -{ - return (indx << 24) | (threshold & 0xffffff); -} - -static inline u32 nvhost_class_host_load_syncpt_base( - unsigned int indx, unsigned int threshold) -{ - return host1x_uclass_wait_syncpt_indx_f(indx) - | host1x_uclass_wait_syncpt_thresh_f(threshold); -} - -static inline u32 nvhost_class_host_incr_syncpt( - unsigned int cond, unsigned int indx) -{ - return host1x_uclass_incr_syncpt_cond_f(cond) - | host1x_uclass_incr_syncpt_indx_f(indx); -} - -static inline void __iomem *host1x_channel_aperture(void __iomem *p, int ndx) -{ - p += host1x_channel_ch_aperture_start_r() + - ndx * host1x_channel_ch_aperture_size_r(); - return p; -} - -enum { - NV_HOST_MODULE_HOST1X = 0, - NV_HOST_MODULE_MPE = 1, - NV_HOST_MODULE_GR3D = 6 -}; - -/* cdma opcodes */ -static inline u32 nvhost_opcode_setclass( - unsigned int class_id, unsigned int offset, unsigned int mask) -{ - return (0 << 28) | (offset << 16) | (class_id << 6) | mask; -} - -static inline u32 nvhost_opcode_incr(unsigned int offset, unsigned int count) -{ - return (1 << 28) | (offset << 16) | count; -} - -static inline u32 nvhost_opcode_nonincr(unsigned int offset, unsigned int count) -{ - return (2 << 28) | (offset << 16) | count; -} - -static inline u32 nvhost_opcode_mask(unsigned int offset, unsigned int mask) -{ - return (3 << 28) | (offset << 16) | mask; -} - -static inline u32 nvhost_opcode_imm(unsigned int offset, unsigned int value) -{ - return (4 << 28) | (offset << 16) | value; -} - -static inline u32 nvhost_opcode_imm_incr_syncpt( - unsigned int cond, unsigned int indx) -{ - return nvhost_opcode_imm(host1x_uclass_incr_syncpt_r(), - nvhost_class_host_incr_syncpt(cond, indx)); -} - -static inline u32 nvhost_opcode_restart(unsigned int address) -{ - return (5 << 28) | (address >> 4); -} - -static inline u32 nvhost_opcode_gather(unsigned int count) -{ - return (6 << 28) | count; -} - -static inline u32 nvhost_opcode_gather_nonincr( - unsigned int offset, unsigned int count) -{ - return (6 << 28) | (offset << 16) | BIT(15) | count; -} - -static inline u32 nvhost_opcode_gather_incr( - unsigned int offset, unsigned int count) -{ - return (6 << 28) | (offset << 16) | BIT(15) | BIT(14) | count; -} - -static inline u32 nvhost_opcode_gather_insert( - unsigned int offset, unsigned int incr, unsigned int count) -{ - return (6 << 28) | (offset << 16) | BIT(15) | (incr << 14) | count; -} - -static inline u32 nvhost_opcode_setstreamid(unsigned int streamid) -{ - return (7 << 28) | streamid; -} - -static inline u32 nvhost_opcode_setpayload(unsigned int payload) -{ - return (9 << 28) | payload; -} - -static inline u32 nvhost_opcode_acquire_mlock(unsigned int id) -{ - return (14 << 28) | id; -} - -static inline u32 nvhost_opcode_release_mlock(unsigned int id) -{ - return (14 << 28) | (1 << 24) | id; -} - -static inline u32 nvhost_opcode_nonincr_w(unsigned int offset) -{ - return (11 << 28) | offset; -} - -static inline u32 nvhost_opcode_incr_w(unsigned int offset) -{ - return (10 << 28) | offset; -} - -#define NVHOST_OPCODE_NOOP nvhost_opcode_nonincr(0, 0) - -static inline u32 nvhost_mask2(unsigned int x, unsigned int y) -{ - return 1 | (1 << (y - x)); -} - -#endif /* __NVHOST_HARDWARE_T239_H */ diff --git a/drivers/video/tegra/host/t239/mmio_vm_regs.c b/drivers/video/tegra/host/t239/mmio_vm_regs.c deleted file mode 100644 index 87581521a402..000000000000 --- a/drivers/video/tegra/host/t239/mmio_vm_regs.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2021, NVIDIA Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * This program is distributed in the hope that 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -static const u32 t239_host1x_mmio_vm_r[] = { - 0x0d04u, /* HOST1X_THOST_COMMON_THOST_MMIO_VM */ - 0x0d08u, /* HOST1X_THOST_COMMON_SE1_MMIO_VM */ - 0x0d0cu, /* HOST1X_THOST_COMMON_SE2_MMIO_VM */ - 0x0d10u, /* HOST1X_THOST_COMMON_SE4_MMIO_VM */ - 0x0d14u, /* HOST1X_THOST_COMMON_SEU1SE1_MMIO_VM */ - 0x0d18u, /* HOST1X_THOST_COMMON_SEU1SE2_MMIO_VM */ - 0x0d1cu, /* HOST1X_THOST_COMMON_SEU1SE4_MMIO_VM */ - 0x0d20u, /* HOST1X_THOST_COMMON_DPAUX_MMIO_VM */ - 0x0d24u, /* HOST1X_THOST_COMMON_VIC_MMIO_VM */ - 0x0d28u, /* HOST1X_THOST_COMMON_NVENC_MMIO_VM */ - 0x0d2cu, /* HOST1X_THOST_COMMON_NVDEC_MMIO_VM */ - 0x0d30u, /* HOST1X_THOST_COMMON_TSEC_MMIO_VM */ - 0x0d34u, /* HOST1X_THOST_COMMON_FDE_MMIO_VM */ - 0x0d38u, /* HOST1X_THOST_COMMON_OFA_MMIO_VM */ -}; diff --git a/drivers/video/tegra/host/t239/streamid_regs.c b/drivers/video/tegra/host/t239/streamid_regs.c deleted file mode 100644 index 466a031b58e1..000000000000 --- a/drivers/video/tegra/host/t239/streamid_regs.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2021, NVIDIA Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License. - * - * This program is distributed in the hope that 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -struct nvhost_streamid_mapping { - u32 host1x_offset; - u32 client_offset; - u32 client_limit; -}; - -static struct nvhost_streamid_mapping __attribute__((__unused__)) - t239_host1x_streamid_mapping[] = { - - /* host1x client streamid registers for fw ucode */ - - /* HOST1X_THOST_COMMON_SE1_STRMID_0_OFFSET_BASE_0 */ - { 0x00000e50, 0x00000090, 0x00000090 }, - /* HOST1X_THOST_COMMON_SE2_STRMID_0_OFFSET_BASE_0 */ - { 0x00000e58, 0x00000090, 0x00000090 }, - /* HOST1X_THOST_COMMON_SE4_STRMID_0_OFFSET_BASE_0 */ - { 0x00000e60, 0x00000090, 0x00000090 }, - /* HOST1X_THOST_COMMON_VIC_STRMID_0_OFFSET_BASE_0 */ - { 0x00000e80, 0x00000034, 0x00000034 }, - /* HOST1X_THOST_COMMON_NVENC_STRMID_0_OFFSET_BASE_0 */ - { 0x00000e88, 0x00000034, 0x00000034 }, - /* HOST1X_THOST_COMMON_NVDEC_STRMID_0_OFFSET_BASE_0 */ - { 0x00000e90, 0x00000034, 0x00000034 }, - /* HOST1X_THOST_COMMON_OFA_STRMID_0_OFFSET_BASE_0 */ - { 0x00000ea8, 0x00000034, 0x00000034 }, - /* HOST1X_THOST_COMMON_TSEC_STRMID_0_OFFSET_BASE_0 */ - { 0x00000e98, 0x00000034, 0x00000034 }, - - /* host1x_client ch streamid registers for data buffers */ - - /* HOST1X_THOST_COMMON_SE1_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000ee0, 0x00000090, 0x00000090 }, - /* HOST1X_THOST_COMMON_SE2_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000ee8, 0x00000090, 0x00000090 }, - /* HOST1X_THOST_COMMON_SE4_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000ef0, 0x00000090, 0x00000090 }, - /* HOST1X_THOST_COMMON_VIC_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000f18, 0x00000030, 0x00000030 }, - /* HOST1X_THOST_COMMON_NVENC_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000f20, 0x00000030, 0x00000030 }, - /* HOST1X_THOST_COMMON_NVDEC_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000f28, 0x00000030, 0x00000030 }, - /* HOST1X_THOST_COMMON_OFA_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000f40, 0x00000030, 0x00000030 }, - /* HOST1X_THOST_COMMON_TSEC_CH_STRMID_0_OFFSET_BASE_0 */ - { 0x00000f30, 0x00000030, 0x00000030 }, - {} -}; diff --git a/drivers/video/tegra/host/t239/t239.c b/drivers/video/tegra/host/t239/t239.c deleted file mode 100644 index a0a1f49fc49a..000000000000 --- a/drivers/video/tegra/host/t239/t239.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Tegra Graphics Init for T239 Architecture Chips - * - * Copyright (c) 2021, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include -#include -#include -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) -#include -#else -#include -#endif - -#include - -#include - -#include - -#include "dev.h" -#include "platform.h" -#include "class_ids.h" -#include "class_ids_t194.h" -#include "class_ids_t23x.h" - -#include "nvhost_syncpt_unit_interface.h" -#include "nvhost_gos.h" -#include "t239.h" -#include "host1x/host1x.h" -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_TSEC) -#include "tsec/tsec.h" -#include "tsec/tsec_t23x.h" -#endif -#include "flcn/flcn.h" -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_NVDEC) -#include "nvdec/nvdec.h" -#endif -#include "hardware_t239.h" -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_OFA) -#include "ofa/ofa.h" -#endif - -#include "chip_support.h" - -#include "streamid_regs.c" -#include "cg_regs.c" -#include "classid_vm_regs.c" -#include "mmio_vm_regs.c" - -#include - -#define NVHOST_HAS_SUBMIT_HOST1XSTREAMID - -static dma_addr_t nvhost_t239_get_reloc_phys_addr(dma_addr_t phys_addr, - u32 reloc_type) -{ - if (reloc_type == NVHOST_RELOC_TYPE_BLOCK_LINEAR) - phys_addr += BIT(39); - - return phys_addr; -} - -static struct host1x_device_info host1x04_info = { - .nb_channels = T239_NVHOST_NUMCHANNELS, - .ch_base = 0, - .ch_limit = T239_NVHOST_NUMCHANNELS, - .nb_mlocks = NV_HOST1X_NB_MLOCKS, - .initialize_chip_support = nvhost_init_t239_support, - .nb_hw_pts = NV_HOST1X_SYNCPT_NB_PTS, - .nb_pts = NV_HOST1X_SYNCPT_NB_PTS, - .pts_base = 0, - .pts_limit = NV_HOST1X_SYNCPT_NB_PTS, - .nb_syncpt_irqs = 8, - .syncpt_policy = SYNCPT_PER_CHANNEL_INSTANCE, - .channel_policy = MAP_CHANNEL_ON_SUBMIT, - .nb_actmons = 1, - .use_cross_vm_interrupts = 1, - .resources = { - "guest", - "hypervisor", - "actmon", - "sem-syncpt-shim", - "common" - }, - .nb_resources = 5, - .secure_cmdfifo = true, - .syncpt_page_size = 0x10000, -}; - -struct nvhost_device_data t239_host1x_info = { - .clocks = { - {"host1x", 204000000}, - {"actmon", UINT_MAX} - }, - .autosuspend_delay = 50, - .private_data = &host1x04_info, - .finalize_poweron = nvhost_host1x_finalize_poweron, - .prepare_poweroff = nvhost_host1x_prepare_poweroff, - .engine_can_cg = true, -}; - -struct nvhost_device_data t239_host1x_hv_info = { - .autosuspend_delay = 2000, - .private_data = &host1x04_info, - .finalize_poweron = nvhost_host1x_finalize_poweron, - .prepare_poweroff = nvhost_host1x_prepare_poweroff, -}; - -static struct host1x_device_info host1xb04_info = { - .nb_channels = T239_NVHOST_NUMCHANNELS, - .ch_base = 0, - .ch_limit = T239_NVHOST_NUMCHANNELS, - .nb_mlocks = NV_HOST1X_NB_MLOCKS, - .initialize_chip_support = nvhost_init_t239_support, - .nb_hw_pts = NV_HOST1X_SYNCPT_NB_PTS, - .nb_pts = NV_HOST1X_SYNCPT_NB_PTS, - .pts_base = 0, - .pts_limit = NV_HOST1X_SYNCPT_NB_PTS, - .nb_syncpt_irqs = 8, - .syncpt_policy = SYNCPT_PER_CHANNEL_INSTANCE, - .channel_policy = MAP_CHANNEL_ON_SUBMIT, - .use_cross_vm_interrupts = 1, -}; - -struct nvhost_device_data t239_host1xb_info = { - .clocks = { - {"host1x", UINT_MAX}, - {"actmon", UINT_MAX} - }, - .private_data = &host1xb04_info, -}; - -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_NVENC) -struct nvhost_device_data t239_msenc_info = { - .version = NVHOST_ENCODE_FLCN_VER(8, 0), - .devfs_name = "msenc", - .class = NV_VIDEO_ENCODE_NVENC_CLASS_ID, - .modulemutexes = {NV_HOST1X_MLOCK_ID_NVENC}, - .autosuspend_delay = 500, - .clocks = { - {"nvenc", UINT_MAX}, - {"emc", 0, - NVHOST_MODULE_ID_EXTERNAL_MEMORY_CONTROLLER, - TEGRA_SET_EMC_SHARED_BW} - }, - .poweron_reset = true, - .finalize_poweron = nvhost_flcn_finalize_poweron_t186, - .moduleid = NVHOST_MODULE_MSENC, - .num_channels = 1, - .firmware_name = "nvhost_nvenc080.fw", - .serialize = true, - .push_work_done = true, - .resource_policy = RESOURCE_PER_CHANNEL_INSTANCE, - .vm_regs = {{0x30, true}, {0x34, false} }, - .transcfg_addr = 0x1844, - .transcfg_val = 0x20, - .icc_id = TEGRA_ICC_NVENC, - .get_reloc_phys_addr = nvhost_t239_get_reloc_phys_addr, - .engine_cg_regs = t239_nvenc_gating_registers, - .engine_can_cg = true, - .can_powergate = true, - .isolate_contexts = true, - .enable_timestamps = flcn_enable_timestamps, -}; -#endif - -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_NVDEC) -struct nvhost_device_data t239_nvdec_info = { - .version = NVHOST_ENCODE_NVDEC_VER(5, 0), - .devfs_name = "nvdec", - .modulemutexes = {NV_HOST1X_MLOCK_ID_NVDEC}, - .class = NV_NVDEC_CLASS_ID, - .autosuspend_delay = 500, - .clocks = { - {"nvdec", UINT_MAX}, - {"kfuse", 0, 0}, - {"efuse", 0, 0}, - {"emc", 0, - NVHOST_MODULE_ID_EXTERNAL_MEMORY_CONTROLLER, - TEGRA_SET_EMC_FLOOR} - }, - .poweron_reset = true, - .finalize_poweron = nvhost_nvdec_finalize_poweron_t186, - .prepare_poweroff = nvhost_nvdec_prepare_poweroff_t186, - .moduleid = NVHOST_MODULE_NVDEC, - .ctrl_ops = &tegra_nvdec_ctrl_ops, - .num_channels = 1, - .serialize = true, - .push_work_done = true, - .resource_policy = RESOURCE_PER_CHANNEL_INSTANCE, - .vm_regs = {{0x30, true}, {0x34, false} }, - .transcfg_addr = 0x4e44, - .transcfg_val = 0x20, - .icc_id = TEGRA_ICC_NVDEC, - .get_reloc_phys_addr = nvhost_t239_get_reloc_phys_addr, - .engine_cg_regs = t239_nvdec_gating_registers, - .engine_can_cg = true, - .can_powergate = true, - .isolate_contexts = true, -}; -#endif - -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_OFA) -struct nvhost_device_data t239_ofa_info = { - .version = NVHOST_ENCODE_FLCN_VER(1, 2), - .devfs_name = "ofa", - .modulemutexes = {NV_HOST1X_MLOCK_ID_OFA}, - .class = NV_OFA_CLASS_ID, - .autosuspend_delay = 500, - .clocks = { - {"ofa", UINT_MAX}, - {"emc", 0, - NVHOST_MODULE_ID_EXTERNAL_MEMORY_CONTROLLER, - TEGRA_SET_EMC_SHARED_BW} - }, - .poweron_reset = true, - .finalize_poweron = nvhost_flcn_finalize_poweron_t186, - .memory_init = ofa_safety_ram_init, - .moduleid = NVHOST_MODULE_OFA, - .num_channels = 1, - .firmware_name = "nvhost_ofa012.fw", - .serialize = true, - .push_work_done = true, - .resource_policy = RESOURCE_PER_CHANNEL_INSTANCE, - .vm_regs = {{0x30, true}, {0x34, false} }, - .transcfg_addr = 0x1444, - .transcfg_val = 0x20, - .icc_id = TEGRA_ICC_OFAA, - .get_reloc_phys_addr = nvhost_t239_get_reloc_phys_addr, - .engine_cg_regs = t239_ofa_gating_registers, - .engine_can_cg = true, - .can_powergate = true, - .isolate_contexts = true, -}; -#endif - -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_TSEC) -struct nvhost_device_data t239_tsec_info = { - .num_channels = 1, - .devfs_name = "tsec", - .version = NVHOST_ENCODE_TSEC_VER(1, 0), - .modulemutexes = {NV_HOST1X_MLOCK_ID_TSEC}, - .class = NV_TSEC_CLASS_ID, - .clocks = { - {"tsec", UINT_MAX}, - {"efuse", 0, 0}, - {"emc", 0, - NVHOST_MODULE_ID_EXTERNAL_MEMORY_CONTROLLER, - TEGRA_SET_EMC_FLOOR} - }, - .autosuspend_delay = 500, - .keepalive = true, - .moduleid = NVHOST_MODULE_TSEC, - .poweron_reset = true, - .finalize_poweron = nvhost_tsec_finalize_poweron_t23x, - .prepare_poweroff = nvhost_tsec_prepare_poweroff_t23x, - .serialize = true, - .push_work_done = true, - .resource_policy = RESOURCE_PER_CHANNEL_INSTANCE, - .vm_regs = {{0x30, true}, {0x34, false} }, - .transcfg_addr = 0x1644, - .transcfg_val = 0x20, - .icc_id = TEGRA_ICC_TSEC, - .engine_cg_regs = t239_tsec_gating_registers, - .engine_can_cg = true, - .can_powergate = true, - .isolate_contexts = true, - .enable_riscv_boot = true, - .riscv_desc_bin = "nvhost_tsec_desc.fw", - .riscv_image_bin = "nvhost_tsec_riscv.fw", -}; -#endif - -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_VIC) -struct nvhost_device_data t239_vic_info = { - .num_channels = 1, - .devfs_name = "vic", - .clocks = { - {"vic", UINT_MAX, 0}, - {"emc", 0, NVHOST_MODULE_ID_EXTERNAL_MEMORY_CONTROLLER, - TEGRA_SET_EMC_SHARED_BW}, - }, - .version = NVHOST_ENCODE_FLCN_VER(4, 2), - .autosuspend_delay = 500, - .moduleid = NVHOST_MODULE_VIC, - .poweron_reset = true, - .modulemutexes = {NV_HOST1X_MLOCK_ID_VIC}, - .class = NV_GRAPHICS_VIC_CLASS_ID, - .finalize_poweron = nvhost_flcn_finalize_poweron_t186, - .prepare_poweroff = nvhost_flcn_prepare_poweroff, - .flcn_isr = nvhost_flcn_common_isr, - .firmware_name = "nvhost_vic042.fw", - .firmware_not_in_subdir = true, - .serialize = true, - .push_work_done = true, - .resource_policy = RESOURCE_PER_CHANNEL_INSTANCE, - .vm_regs = {{0x30, true}, {0x34, false} }, - .transcfg_addr = 0x2044, - .transcfg_val = 0x20, - .icc_id = TEGRA_ICC_VIC, - .get_reloc_phys_addr = nvhost_t239_get_reloc_phys_addr, - .module_irq = 1, - .engine_cg_regs = t239_vic_gating_registers, - .engine_can_cg = true, - .can_powergate = true, - .isolate_contexts = true, -}; -#endif - -#include "host1x/host1x_channel_t186.c" - -static void t239_set_nvhost_chanops(struct nvhost_channel *ch) -{ - if (!ch) - return; - - ch->ops = host1x_channel_ops; - - /* Disable gather filter in simulator */ - if (tegra_platform_is_vdk()) - ch->ops.init_gather_filter = NULL; -} - -int nvhost_init_t239_channel_support(struct nvhost_master *host, - struct nvhost_chip_support *op) -{ - op->nvhost_dev.set_nvhost_chanops = t239_set_nvhost_chanops; - - return 0; -} - -static void t239_remove_support(struct nvhost_chip_support *op) -{ - kfree(op->priv); - op->priv = NULL; -} - -#define SYNCPT_RAM_INIT_TIMEOUT_MS 1000 - -static void t239_init_gating_regs(struct platform_device *pdev, bool prod) -{ - struct nvhost_gating_register *cg_regs = t239_host1x_gating_registers; - ktime_t now, start = ktime_get(); - u32 ram_init; - - if (nvhost_dev_is_virtual(pdev) == true) { - return; - } - - /* Ensure that HW has finished initializing syncpt RAM prior to use */ - for (;;) { - /* XXX: This retry loop takes too long to timeout on VDK */ - if (tegra_platform_is_sim()) { - pr_info("%s: Skipping ram_init done check on sim.\n", - __func__); - break; - } - - ram_init = host1x_hypervisor_readl(pdev, - host1x_sync_syncpt_ram_init_0_r()); - if (!host1x_sync_syncpt_ram_init_0_ram_init_v(ram_init)) { - pr_info("%s: Host1x HW syncpt ram init disabled\n", - __func__); - break; - } - if (host1x_sync_syncpt_ram_init_0_ram_init_done_v(ram_init)) - break; - - now = ktime_get(); - if (ktime_ms_delta(now, start) >= SYNCPT_RAM_INIT_TIMEOUT_MS) { - pr_err("%s: Timed out waiting for syncpt ram init!\n", - __func__); - break; - } - } - - while (cg_regs->addr) { - u32 val = prod ? cg_regs->prod : cg_regs->disable; - - host1x_common_writel(pdev, cg_regs->addr, val); - cg_regs++; - } - -} - -static void t239_init_map_regs(struct platform_device *pdev) -{ - struct nvhost_streamid_mapping *map_regs = t239_host1x_streamid_mapping; - u32 i; - - /* Write the client streamid map registers */ - while (map_regs->host1x_offset) { - host1x_hypervisor_writel(pdev, - map_regs->host1x_offset, - map_regs->client_offset); - host1x_hypervisor_writel(pdev, - map_regs->host1x_offset + sizeof(u32), - map_regs->client_limit); - map_regs++; - } - - /* Allow all VMs to access all streamid */ - for (i = 0; i < t239_strmid_vm_regs_nb; i++) { - host1x_hypervisor_writel(pdev, - t239_host1x_strmid_vm_r + (i * 4), - 0xff); - } - - /* Update common_thost_classid registers */ - for (i = 0; i < ARRAY_SIZE(t239_host1x_classid_vm_r); i++) { - host1x_hypervisor_writel(pdev, t239_host1x_classid_vm_r[i], - 0xff); - } - - /* Update relevant MMIO-to-VM mapping table entries to VM1 (0x1) */ - for (i = 0; i < ARRAY_SIZE(t239_host1x_mmio_vm_r); i++) { - host1x_hypervisor_writel(pdev, t239_host1x_mmio_vm_r[i], - 0x1); - } -} - -#include "host1x/host1x_cdma_t186.c" -#include "host1x/host1x_syncpt.c" -#include "host1x/host1x_syncpt_prot_t186.c" -#include "host1x/host1x_intr_t186.c" -#include "host1x/host1x_debug_t186.c" -#include "host1x/host1x_vm_t186.c" -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_SCALE) -#include "host1x/host1x_actmon_t186.c" -#endif - -static void host1x08_intr_resume(struct nvhost_intr *intr) -{ - struct nvhost_master *dev = intr_to_dev(intr); - const int nb_pts = nvhost_syncpt_nb_hw_pts(&dev->syncpt); - const int nb_syncpt_irqs = nvhost_syncpt_nb_irqs(&dev->syncpt); - const int pts_per_irq = nb_pts / nb_syncpt_irqs; - const int routed_equally = nb_syncpt_irqs * pts_per_irq; - unsigned int i; - - host1x_intr_ops.resume(intr); - - /* - * Configure Host1x to send syncpoint threshold interrupts to the - * interrupt lines as below: - * - Available syncpoints are equally distributed among 8 interrupt - * lines - * - First 1/8 syncpoints shall trigger 1st line - * - Second 1/8 syncpoints shall trigger 2nd line - * - Similarly, for all other lines - * - Left-over(if any) are mapped to last line - */ - for (i = 0; i < nb_pts; i++) { - const int reg = host1x_common_vm1_syncpt_intr_dest_vm_r() + - i * 4; - - if (i < routed_equally) - host1x_writel(dev->dev, reg, (i / pts_per_irq)); - else - host1x_writel(dev->dev, reg, (nb_syncpt_irqs-1)); - } -} - -int nvhost_init_t239_support(struct nvhost_master *host, - struct nvhost_chip_support *op) -{ - int err; - - /* Not changing this to tegra239, because fw is searched in this path */ - op->soc_name = "tegra23x"; - - /* don't worry about cleaning up on failure... "remove" does it. */ - err = nvhost_init_t239_channel_support(host, op); - if (err) - return err; - - op->cdma = host1x_cdma_ops; - op->push_buffer = host1x_pushbuffer_ops; - op->debug = host1x_debug_ops; - - host->sync_aperture = host->aperture; - op->syncpt = host1x_syncpt_ops; - op->intr = host1x_intr_ops; - op->intr.resume = host1x08_intr_resume; - - op->vm = host1x_vm_ops; - op->vm.init_syncpt_interface = nvhost_syncpt_unit_interface_init; -#if IS_ENABLED(CONFIG_TEGRA_GRHOST_SCALE) - op->actmon = host1x_actmon_ops; -#endif - op->nvhost_dev.load_gating_regs = t239_init_gating_regs; - op->nvhost_dev.load_map_regs = t239_init_map_regs; - - op->syncpt.alloc = nvhost_syncpt_alloc_gos_backing; - op->syncpt.release = nvhost_syncpt_release_gos_backing; - - op->syncpt.reset = t186_syncpt_reset; - op->syncpt.mark_used = t186_syncpt_mark_used; - op->syncpt.mark_unused = t186_syncpt_mark_unused; - - op->syncpt.mutex_owner = t186_syncpt_mutex_owner; - - op->remove_support = t239_remove_support; - - return 0; -} diff --git a/drivers/video/tegra/host/t239/t239.h b/drivers/video/tegra/host/t239/t239.h deleted file mode 100644 index 66d32640c7a0..000000000000 --- a/drivers/video/tegra/host/t239/t239.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Tegra Graphics Chip support for T239 - * - * Copyright (c) 2021, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#ifndef _NVHOST_T239_H_ -#define _NVHOST_T239_H_ - -#include "chip_support.h" - -#define T239_NVHOST_NUMCHANNELS 31 - -extern struct nvhost_device_data t239_host1x_info; -extern struct nvhost_device_data t239_host1x_hv_info; -extern struct nvhost_device_data t239_host1xb_info; -#if defined(CONFIG_TEGRA_GRHOST_VIC) -extern struct nvhost_device_data t239_vic_info; -#endif -#if defined(CONFIG_TEGRA_GRHOST_NVDEC) -extern struct nvhost_device_data t239_nvdec_info; -#endif -#if defined(CONFIG_TEGRA_GRHOST_OFA) -extern struct nvhost_device_data t239_ofa_info; -#endif -#if defined(CONFIG_TEGRA_GRHOST_NVENC) -extern struct nvhost_device_data t239_msenc_info; -#endif -#if defined(CONFIG_TEGRA_GRHOST_TSEC) -extern struct nvhost_device_data t239_tsec_info; -#endif - -int nvhost_init_t239_support(struct nvhost_master *host, - struct nvhost_chip_support *op); -int nvhost_init_t239_channel_support(struct nvhost_master *host, - struct nvhost_chip_support *op); - -#endif /* _NVHOST_T239_H_ */ diff --git a/drivers/video/tegra/host/tsec/tsec.c b/drivers/video/tegra/host/tsec/tsec.c index c0b0106b2bdb..574f09ab7a69 100644 --- a/drivers/video/tegra/host/tsec/tsec.c +++ b/drivers/video/tegra/host/tsec/tsec.c @@ -56,6 +56,8 @@ #include "t194/t194.h" #ifdef CONFIG_TEGRA_T23X_GRHOST #include "t23x/t23x.h" +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST #include "t239/t239.h" #endif @@ -779,7 +781,14 @@ static struct of_device_id tegra_tsec_of_match[] = { .compatible = "nvidia,tegra194-tsec", .data = (struct nvhost_device_data *)&t19_tsecb_info }, #ifdef CONFIG_TEGRA_T23X_GRHOST - #include "tsec/tsec_of_match_t23x.h" + { .name = "tsec", + .compatible = "nvidia,tegra234-tsec", + .data = (struct nvhost_device_data *)&t23x_tsec_info }, +#endif +#ifdef CONFIG_TEGRA_T239_GRHOST + { .name = "tsec", + .compatible = "nvidia,tegra239-tsec", + .data = (struct nvhost_device_data *)&t239_tsec_info }, #endif { }, }; diff --git a/drivers/video/tegra/host/tsec/tsec_of_match_t23x.h b/drivers/video/tegra/host/tsec/tsec_of_match_t23x.h deleted file mode 100644 index 049d4d61da1d..000000000000 --- a/drivers/video/tegra/host/tsec/tsec_of_match_t23x.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2021, 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * struct of_device_id initialization for TSEC on T234 and T239 - */ - -//static struct of_device_id tegra_tsec_of_match[] = { - -#if defined(CONFIG_TEGRA_GRHOST_TSEC) - { .name = "tsec", - .compatible = "nvidia,tegra234-tsec", - .data = (struct nvhost_device_data *)&t23x_tsec_info }, - { .name = "tsec", - .compatible = "nvidia,tegra239-tsec", - .data = (struct nvhost_device_data *)&t239_tsec_info }, -#endif - -//};