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 <akshatab@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2929422
Reviewed-by: Maxim Grigoriev (SW-GPU) <maximg@nvidia.com>
Reviewed-by: Arvind M <am@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Akshata
2023-06-30 08:23:40 +00:00
committed by mobile promotions
parent 1a471a12b5
commit 25b08cb82d
2 changed files with 18 additions and 8 deletions

View File

@@ -19,6 +19,7 @@
#include <linux/nvmem-consumer.h> #include <linux/nvmem-consumer.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <soc/tegra/fuse-helper.h> #include <soc/tegra/fuse-helper.h>
#include <soc/tegra/fuse.h>
#include <uapi/linux/nvhost_nvdla_ioctl.h> #include <uapi/linux/nvhost_nvdla_ioctl.h>
#include <uapi/linux/tegra-soc-hwpm-uapi.h> #include <uapi/linux/tegra-soc-hwpm-uapi.h>
@@ -978,6 +979,8 @@ static int nvdla_probe(struct platform_device *pdev)
struct nvdla_device *nvdla_dev = NULL; struct nvdla_device *nvdla_dev = NULL;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
uint32_t soft_fuse_ret = 0U; 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; struct tegra_soc_hwpm_ip_ops hwpm_ip_ops;
#if !IS_ENABLED(CONFIG_TEGRA_GRHOST) #if !IS_ENABLED(CONFIG_TEGRA_GRHOST)
@@ -1037,26 +1040,26 @@ static int nvdla_probe(struct platform_device *pdev)
err = -ENODEV; err = -ENODEV;
goto err_no_ip; goto err_no_ip;
} }
#if KERNEL_VERSION(5, 11, 0) >= LINUX_VERSION_CODE
} else { } else {
#if KERNEL_VERSION(5, 11, 0) >= LINUX_VERSION_CODE
err = nvhost_nvdla_read_chip_option_register(pdev); fuse_register_ret = nvhost_nvdla_read_chip_option_register(pdev);
#else
if ((err & FUSE_OPT_DLA_0_DISABLED) err = tegra_fuse_readl(NVDLA_DISABLE_FUSE_REGISTER_OFFSET, &register_value);
fuse_register_ret = (int)register_value;
#endif
if ((fuse_register_ret & FUSE_OPT_DLA_0_DISABLED)
&& (pdata->class == NV_DLA0_CLASS_ID)) { && (pdata->class == NV_DLA0_CLASS_ID)) {
dev_err(dev, "NVDLA0 IP is disabled in Fuse\n"); dev_err(dev, "NVDLA0 IP is disabled in Fuse\n");
err = -ENODEV; err = -ENODEV;
goto err_no_ip; 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)) { && (pdata->class == NV_DLA1_CLASS_ID)) {
dev_err(dev, "NVDLA1 IP is disabled in Fuse\n"); dev_err(dev, "NVDLA1 IP is disabled in Fuse\n");
err = -ENODEV; err = -ENODEV;
goto err_no_ip; goto err_no_ip;
} }
#endif
} }
} }

View File

@@ -40,6 +40,13 @@
#endif /* CONFIG_TEGRA_HSIERRRPTINJ */ #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 * macro to encode firmware version
*/ */