From 4176935c35a306b4b57f25f50c2a458f89c6e732 Mon Sep 17 00:00:00 2001 From: Bitan Biswas Date: Tue, 28 Apr 2020 16:39:40 -0700 Subject: [PATCH] kernel: nvidia: use k5.4 fuse APIs Selected k4.14 fuse API mapping to k5.4 fuse API used is: tegra_read_chipid() -> tegra_read_chipid() enum tegra_chipid tegra_get_chipid() -> u8 tegra_get_chip_id() u8 tegra_get_chip_id() -> u8 tegra_get_chip_id() tegra_get_platform() -> tegra_get_platform() tegra_hidrev_get_chipid(chipid) -> u8 tegra_get_chip_id() enum tegra_revision tegra_chip_get_revision() -> enum tegra_revision tegra_chip_get_revision() (Note: chip specific revision enum removed in k5.4, hence chip_id and revision comparison needed now.) u32 tegra_get_sku_id() -> u32 tegra_get_sku_id() Below downstream fuse data types are no longer used in k5.4: enum tegra_chipid K5.4 specific T210b01 check is done using is_t210b01_sku(). bug 200591811 Change-Id: I2a259669802cb22bccafd435fa9fb7027ee0a9d3 Signed-off-by: Bitan Biswas Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2335855 Reviewed-by: automaticguardword Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/video/tegra/host/nvdla/nvdla.c | 9 +++++++++ drivers/video/tegra/host/nvdla/nvdla_debug.c | 19 +++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/video/tegra/host/nvdla/nvdla.c b/drivers/video/tegra/host/nvdla/nvdla.c index 49b5f06b..ad514e78 100644 --- a/drivers/video/tegra/host/nvdla/nvdla.c +++ b/drivers/video/tegra/host/nvdla/nvdla.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "dev.h" @@ -734,14 +735,22 @@ static int nvdla_probe(struct platform_device *pdev) goto err_get_pdata; } +#if KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE if (tegra_get_chipid() == TEGRA_CHIPID_TEGRA19 && +#else + if (tegra_get_chip_id() == TEGRA194 && +#endif tegra_get_sku_id() == 0x9E) { dev_err(dev, "NVDLA IP is disabled in SKU\n"); err = -ENODEV; goto err_no_ip; } +#if KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE if (tegra_get_chipid() == TEGRA_CHIPID_TEGRA19 && +#else + if (tegra_get_chip_id() == TEGRA194 && +#endif tegra_get_sku_id() == 0x9F && pdata->class == NV_DLA1_CLASS_ID) { dev_err(dev, "NVDLA1 IP is disabled in SKU\n"); diff --git a/drivers/video/tegra/host/nvdla/nvdla_debug.c b/drivers/video/tegra/host/nvdla/nvdla_debug.c index 9c5701a0..2b004bf4 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_debug.c +++ b/drivers/video/tegra/host/nvdla/nvdla_debug.c @@ -19,15 +19,18 @@ #include #include #include +#include +#include +#include +#include +#if KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE +#include +#endif + #include "host1x/host1x.h" #include "flcn/flcn.h" #include "flcn/hw_flcn.h" #include "dla_os_interface.h" -#include -#include -#include -#include - #include "nvdla/nvdla.h" #include "nvdla_debug.h" #include "nvhost_acm.h" @@ -571,9 +574,13 @@ static ssize_t debug_dla_fw_a01_war_set(struct file *file, if (val < 0) /* "0" to disable WAR, positive value to enable WAR */ return count; - +#if KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE if ((tegra_get_chipid() == TEGRA_CHIPID_TEGRA19) && (tegra_chip_get_revision() == TEGRA194_REVISION_A01)) +#else + if ((tegra_get_chip_id() == TEGRA194) && + (tegra_chip_get_revision() == TEGRA_REVISION_A01)) +#endif if (val) nvdla_dev->quirks |= (NVDLA_QUIRK_T194_A01_WAR); else