Commit 94c90785 authored by Avaneesh Kumar Dwivedi's avatar Avaneesh Kumar Dwivedi Committed by Bjorn Andersson

remoteproc: qcom: refactor mss fw image loading sequence

This patch refactor code to first load all firmware blobs
and then update modem proc to authenticate and boot fw.
Tested-and-acked-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarAvaneesh Kumar Dwivedi <akdwived@codeaurora.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent d82bd359
...@@ -504,7 +504,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) ...@@ -504,7 +504,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc)
bool relocate = false; bool relocate = false;
char seg_name[10]; char seg_name[10];
ssize_t offset; ssize_t offset;
size_t size; size_t size = 0;
void *ptr; void *ptr;
int ret; int ret;
int i; int i;
...@@ -542,7 +542,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) ...@@ -542,7 +542,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc)
} }
mpss_reloc = relocate ? min_addr : qproc->mpss_phys; mpss_reloc = relocate ? min_addr : qproc->mpss_phys;
/* Load firmware segments */
for (i = 0; i < ehdr->e_phnum; i++) { for (i = 0; i < ehdr->e_phnum; i++) {
phdr = &phdrs[i]; phdr = &phdrs[i];
...@@ -575,18 +575,15 @@ static int q6v5_mpss_load(struct q6v5 *qproc) ...@@ -575,18 +575,15 @@ static int q6v5_mpss_load(struct q6v5 *qproc)
memset(ptr + phdr->p_filesz, 0, memset(ptr + phdr->p_filesz, 0,
phdr->p_memsz - phdr->p_filesz); phdr->p_memsz - phdr->p_filesz);
} }
size = readl(qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG);
if (!size) {
boot_addr = relocate ? qproc->mpss_phys : min_addr;
writel(boot_addr, qproc->rmb_base + RMB_PMI_CODE_START_REG);
writel(RMB_CMD_LOAD_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG);
}
size += phdr->p_memsz; size += phdr->p_memsz;
writel(size, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG);
} }
/* Transfer ownership of modem ddr region with q6*/
boot_addr = relocate ? qproc->mpss_phys : min_addr;
writel(boot_addr, qproc->rmb_base + RMB_PMI_CODE_START_REG);
writel(RMB_CMD_LOAD_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG);
writel(size, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG);
ret = q6v5_rmb_mba_wait(qproc, RMB_MBA_AUTH_COMPLETE, 10000); ret = q6v5_rmb_mba_wait(qproc, RMB_MBA_AUTH_COMPLETE, 10000);
if (ret == -ETIMEDOUT) if (ret == -ETIMEDOUT)
dev_err(qproc->dev, "MPSS authentication timed out\n"); dev_err(qproc->dev, "MPSS authentication timed out\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment