From 72aa83467029dc114f7c07f5a366695d264bd2bd Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Mon, 30 May 2022 23:14:55 -0700 Subject: [PATCH] tegra: hwpm: add fa mode fuse condition If FA mode fuse is set, allow all IPs to be enabled irrespective of build config. Bug 3435123 Change-Id: I937d8f9fa79706167102daadd9c3a04a80180cfb Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2720737 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Seema Khowala Reviewed-by: svc_kernel_abi GVS: Gerrit_Virtual_Submit --- hal/t234/t234_hwpm_ip_utils.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hal/t234/t234_hwpm_ip_utils.c b/hal/t234/t234_hwpm_ip_utils.c index c7c1eee..3cbe6e1 100644 --- a/hal/t234/t234_hwpm_ip_utils.c +++ b/hal/t234/t234_hwpm_ip_utils.c @@ -195,6 +195,7 @@ int t234_hwpm_validate_current_config(struct tegra_soc_hwpm *hwpm) { u32 production_mode = 0U; u32 security_mode = 0U; + u32 fa_mode = 0U; u32 hwpm_global_disable = 0U; u32 idx = 0U; int err; @@ -221,6 +222,13 @@ int t234_hwpm_validate_current_config(struct tegra_soc_hwpm *hwpm) return err; } +#define TEGRA_FUSE_FA_MODE 0x48U + err = tegra_fuse_readl(TEGRA_FUSE_FA_MODE, &fa_mode); + if (err != 0) { + tegra_hwpm_err(hwpm, "fa mode fuse read failed"); + return err; + } + #define TEGRA_HWPM_GLOBAL_DISABLE_OFFSET 0x3CU #define TEGRA_HWPM_GLOBAL_DISABLE_DISABLED 0x1U err = tegra_hwpm_read_sticky_bits(hwpm, addr_map_pmc_misc_base_r(), @@ -231,8 +239,16 @@ int t234_hwpm_validate_current_config(struct tegra_soc_hwpm *hwpm) } tegra_hwpm_dbg(hwpm, hwpm_info, "PROD_MODE fuse = 0x%x " - "SECURITY_MODE fuse = 0x%x HWPM_GLOBAL_DISABLE = 0x%x", - production_mode, security_mode, hwpm_global_disable); + "SECURITY_MODE fuse = 0x%x FA mode fuse = 0x%x" + "HWPM_GLOBAL_DISABLE = 0x%x", + production_mode, security_mode, fa_mode, hwpm_global_disable); + + /* Do not enable override if FA mode fuse is set */ + if (fa_mode != 0U) { + tegra_hwpm_dbg(hwpm, hwpm_info, + "fa mode fuse enabled, no override required"); + return 0; + } /* Override enable depends on security mode and global hwpm disable */ if ((security_mode == 0U) &&