diff --git a/drivers/platform/tegra/nvadsp/dev.c b/drivers/platform/tegra/nvadsp/dev.c index 29a5a579..7f718cda 100644 --- a/drivers/platform/tegra/nvadsp/dev.c +++ b/drivers/platform/tegra/nvadsp/dev.c @@ -263,6 +263,7 @@ static int __init nvadsp_parse_dt(struct platform_device *pdev) { struct nvadsp_drv_data *drv_data = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; + const char *adsp_elf; u32 *adsp_reset; u32 *adsp_mem; int iter; @@ -287,6 +288,12 @@ static int __init nvadsp_parse_dt(struct platform_device *pdev) } } + if (!of_property_read_string(dev->of_node, + "nvidia,adsp_elf", &adsp_elf)) + strcpy(drv_data->adsp_elf, adsp_elf); + else + strcpy(drv_data->adsp_elf, NVADSP_ELF); + drv_data->adsp_unit_fpga = of_property_read_bool(dev->of_node, "nvidia,adsp_unit_fpga"); diff --git a/drivers/platform/tegra/nvadsp/dev.h b/drivers/platform/tegra/nvadsp/dev.h index 8fc8aee9..76adfb2c 100644 --- a/drivers/platform/tegra/nvadsp/dev.h +++ b/drivers/platform/tegra/nvadsp/dev.h @@ -3,7 +3,7 @@ * * A header file for Host driver for ADSP and APE * - * Copyright (C) 2014-2021, NVIDIA Corporation. All rights reserved. + * Copyright (C) 2014-2022, NVIDIA Corporation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -104,6 +104,9 @@ enum adsp_unit_fpga_reset { #endif #endif +#define NVADSP_ELF "adsp.elf" +#define MAX_FW_STR 30 + enum nvadsp_virqs { MBOX_SEND_VIRQ, MBOX_RECV_VIRQ, @@ -248,6 +251,9 @@ struct nvadsp_drv_data { /* "nvidia,adsp_load_timeout" (in ms) */ u32 adsp_load_timeout; + + /* "nvidia,adsp_elf" (FW for backdoor boot) */ + char adsp_elf[MAX_FW_STR]; }; #define ADSP_CONFIG 0x04 diff --git a/drivers/platform/tegra/nvadsp/os.c b/drivers/platform/tegra/nvadsp/os.c index 709b5c9c..793e6506 100644 --- a/drivers/platform/tegra/nvadsp/os.c +++ b/drivers/platform/tegra/nvadsp/os.c @@ -58,9 +58,6 @@ #include "hwmailbox.h" #include "log_state.h" -#define NVADSP_ELF "adsp.elf" -#define NVADSP_FIRMWARE NVADSP_ELF - #define MAILBOX_REGION ".mbox_shared_data" #define DEBUG_RAM_REGION ".debug_mem_logs" @@ -845,10 +842,10 @@ static int nvadsp_firmware_load(struct platform_device *pdev) const struct firmware *fw; int ret = 0; - ret = request_firmware(&fw, NVADSP_FIRMWARE, dev); + ret = request_firmware(&fw, drv_data->adsp_elf, dev); if (ret < 0) { dev_err(dev, "reqest firmware for %s failed with %d\n", - NVADSP_FIRMWARE, ret); + drv_data->adsp_elf, ret); goto end; } #ifdef CONFIG_ANDROID @@ -864,11 +861,11 @@ static int nvadsp_firmware_load(struct platform_device *pdev) goto release_firmware; } - dev_info(dev, "Loading ADSP OS firmware %s\n", NVADSP_FIRMWARE); + dev_info(dev, "Loading ADSP OS firmware %s\n", drv_data->adsp_elf); ret = nvadsp_os_elf_load(fw); if (ret) { - dev_err(dev, "failed to load %s\n", NVADSP_FIRMWARE); + dev_err(dev, "failed to load %s\n", drv_data->adsp_elf); goto deallocate_os_memory; } @@ -1981,7 +1978,8 @@ static void __nvadsp_os_stop(bool reload) logger->ram_iter = 0; /* load a fresh copy of adsp.elf */ if (nvadsp_os_elf_load(fw)) - dev_err(dev, "failed to reload %s\n", NVADSP_FIRMWARE); + dev_err(dev, "failed to reload %s\n", + drv_data->adsp_elf); } end: