summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/pru_rproc.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-12 08:15:27 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-04-12 08:15:27 +0200
commit14d34d2dbbe2d9144a65bae1549202d1717062e2 (patch)
tree8d8a84be09fa898bdfdf14e7783cd6b42d6bb0ed /drivers/remoteproc/pru_rproc.c
parent3db53374405fbf7a474086ed984189f65b6f0008 (diff)
parentd434405aaab7d0ebc516b68a8fc4100922d7f5ef (diff)
downloadlinux-14d34d2dbbe2d9144a65bae1549202d1717062e2.tar.bz2
Merge 5.12-rc7 into usb-next
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/remoteproc/pru_rproc.c')
-rw-r--r--drivers/remoteproc/pru_rproc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index 2667919d76b3..dcb380e868df 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -450,6 +450,24 @@ static void *pru_i_da_to_va(struct pru_rproc *pru, u32 da, size_t len)
if (len == 0)
return NULL;
+ /*
+ * GNU binutils do not support multiple address spaces. The GNU
+ * linker's default linker script places IRAM at an arbitrary high
+ * offset, in order to differentiate it from DRAM. Hence we need to
+ * strip the artificial offset in the IRAM addresses coming from the
+ * ELF file.
+ *
+ * The TI proprietary linker would never set those higher IRAM address
+ * bits anyway. PRU architecture limits the program counter to 16-bit
+ * word-address range. This in turn corresponds to 18-bit IRAM
+ * byte-address range for ELF.
+ *
+ * Two more bits are added just in case to make the final 20-bit mask.
+ * Idea is to have a safeguard in case TI decides to add banking
+ * in future SoCs.
+ */
+ da &= 0xfffff;
+
if (da >= PRU_IRAM_DA &&
da + len <= PRU_IRAM_DA + pru->mem_regions[PRU_IOMEM_IRAM].size) {
offset = da - PRU_IRAM_DA;
@@ -585,7 +603,7 @@ pru_rproc_load_elf_segments(struct rproc *rproc, const struct firmware *fw)
break;
}
- if (pru->data->is_k3 && is_iram) {
+ if (pru->data->is_k3) {
ret = pru_rproc_memcpy(ptr, elf_data + phdr->p_offset,
filesz);
if (ret) {