nvadsp: Add provision to specify ADSP ELF name

Provision is added to specify ADSP ELF name from DT, using prop
'nvidia,adsp_elf'. This will be picked from /lib/firmware/ when
ADSP boots in backdoor mode. Default name remains "adsp.elf", if
the prop is not specified.

Bug 200746669
Bug 200773359

Change-Id: Ie5a4ba60fa2c049b7895967326a325257a65bb82
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2662909
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Asha Talambedu <atalambedu@nvidia.com>
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Viswanath L
2022-02-02 09:00:48 +00:00
committed by Laxman Dewangan
parent 35393d7615
commit a99d68a86e
3 changed files with 20 additions and 9 deletions

View File

@@ -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");

View File

@@ -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

View File

@@ -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: