From 25b08cb82d2a9c7f42bc4d1056ba6cb4387c55cd Mon Sep 17 00:00:00 2001 From: Akshata Date: Fri, 30 Jun 2023 08:23:40 +0000 Subject: [PATCH] dla: kmd: Update fuse register read for K5.15 + Enabled the logic to read the DLA Fuse registers directly for K5.15 + Required for setting up the correct DLA instance on fused boards like TA983 Bug 4156086 Change-Id: I23addb28c54466979fd88a1b3c65960b10f946ca Signed-off-by: Akshata Bhat Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929422 Reviewed-by: Maxim Grigoriev (SW-GPU) Reviewed-by: Arvind M GVS: Gerrit_Virtual_Submit --- drivers/video/tegra/host/nvdla/nvdla.c | 19 +++++++++++-------- drivers/video/tegra/host/nvdla/nvdla.h | 7 +++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/video/tegra/host/nvdla/nvdla.c b/drivers/video/tegra/host/nvdla/nvdla.c index b46b5388..f23b4bd1 100644 --- a/drivers/video/tegra/host/nvdla/nvdla.c +++ b/drivers/video/tegra/host/nvdla/nvdla.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -978,6 +979,8 @@ static int nvdla_probe(struct platform_device *pdev) struct nvdla_device *nvdla_dev = NULL; struct device *dev = &pdev->dev; uint32_t soft_fuse_ret = 0U; + int fuse_register_ret = 0U; + uint32_t register_value = 0U; struct tegra_soc_hwpm_ip_ops hwpm_ip_ops; #if !IS_ENABLED(CONFIG_TEGRA_GRHOST) @@ -1037,26 +1040,26 @@ static int nvdla_probe(struct platform_device *pdev) err = -ENODEV; goto err_no_ip; } - -#if KERNEL_VERSION(5, 11, 0) >= LINUX_VERSION_CODE } else { - - err = nvhost_nvdla_read_chip_option_register(pdev); - - if ((err & FUSE_OPT_DLA_0_DISABLED) +#if KERNEL_VERSION(5, 11, 0) >= LINUX_VERSION_CODE + fuse_register_ret = nvhost_nvdla_read_chip_option_register(pdev); +#else + err = tegra_fuse_readl(NVDLA_DISABLE_FUSE_REGISTER_OFFSET, ®ister_value); + fuse_register_ret = (int)register_value; +#endif + if ((fuse_register_ret & FUSE_OPT_DLA_0_DISABLED) && (pdata->class == NV_DLA0_CLASS_ID)) { dev_err(dev, "NVDLA0 IP is disabled in Fuse\n"); err = -ENODEV; goto err_no_ip; } - if ((err & FUSE_OPT_DLA_1_DISABLED) + if ((fuse_register_ret & FUSE_OPT_DLA_1_DISABLED) && (pdata->class == NV_DLA1_CLASS_ID)) { dev_err(dev, "NVDLA1 IP is disabled in Fuse\n"); err = -ENODEV; goto err_no_ip; } -#endif } } diff --git a/drivers/video/tegra/host/nvdla/nvdla.h b/drivers/video/tegra/host/nvdla/nvdla.h index 27eca154..1d232753 100644 --- a/drivers/video/tegra/host/nvdla/nvdla.h +++ b/drivers/video/tegra/host/nvdla/nvdla.h @@ -40,6 +40,13 @@ #endif /* CONFIG_TEGRA_HSIERRRPTINJ */ +/* DLA FUSE REGISTER + * Corresponds to the offset of "opt-dla-disable" - part of the + * struct tegra_fuse_cells of type nvmem_cell_info. + */ + +#define NVDLA_DISABLE_FUSE_REGISTER_OFFSET 0x3f0 + /* * macro to encode firmware version */