From 1dad4adbd2aecfd484a84d47b29b81bb665bc60b Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Tue, 7 Nov 2017 10:25:07 -0800 Subject: gpu: nvgpu: Move fuse override DT handling Move fuse override DT handling to Linux code. All the chip specific fuse override functions did the same thing, so delete the HAL and call the same function to read the DT overrides on all chips. Also remove the fuse override functionality from dGPU. There are no DT entries for PCIe devices, so it would've failed anyway. JIRA NVGPU-259 Change-Id: Iba64a5d53bf4eb94198c0408a462620efc2ddde4 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1593687 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: Deepak Nibade GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/module.c | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 2e90fbe4..6b27c9f1 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include @@ -994,6 +996,48 @@ static inline void set_gk20a(struct platform_device *pdev, struct gk20a *gk20a) gk20a_get_platform(&pdev->dev)->g = gk20a; } +static int nvgpu_read_fuse_overrides(struct gk20a *g) +{ + struct device_node *np = dev_from_gk20a(g)->of_node; + u32 *fuses; + int count, i; + + if (!np) /* may be pcie device */ + return 0; + + count = of_property_count_elems_of_size(np, "fuse-overrides", 8); + if (count <= 0) + return count; + + fuses = nvgpu_kmalloc(g, sizeof(u32) * count * 2); + if (!fuses) + return -ENOMEM; + of_property_read_u32_array(np, "fuse-overrides", fuses, count * 2); + for (i = 0; i < count; i++) { + u32 fuse, value; + + fuse = fuses[2 * i]; + value = fuses[2 * i + 1]; + switch (fuse) { + case GM20B_FUSE_OPT_TPC_DISABLE: + g->tpc_fs_mask_user = ~value; + break; +#ifdef CONFIG_ARCH_TEGRA_18x_SOC + case GP10B_FUSE_OPT_ECC_EN: + g->gr.t18x.fecs_feature_override_ecc_val = value; + break; +#endif + default: + nvgpu_err(g, "ignore unknown fuse override %08x", fuse); + break; + } + } + + nvgpu_kfree(g, fuses); + + return 0; +} + static int gk20a_probe(struct platform_device *dev) { struct nvgpu_os_linux *l; @@ -1077,6 +1121,8 @@ static int gk20a_probe(struct platform_device *dev) if (err) return err; + err = nvgpu_read_fuse_overrides(gk20a); + #ifdef CONFIG_RESET_CONTROLLER platform->reset_control = devm_reset_control_get(&dev->dev, NULL); if (IS_ERR(platform->reset_control)) -- cgit v1.2.2