* [PATCH 1/4] imx: bootaux: cleanup code
@ 2022-04-29 8:03 Peng Fan (OSS)
2022-04-29 8:03 ` [PATCH 2/4] imx: bootaux: add missing newline Peng Fan (OSS)
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Peng Fan (OSS) @ 2022-04-29 8:03 UTC (permalink / raw)
To: sbabic, festevam, NXP i.MX U-Boot Team; +Cc: u-boot, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Use if (CONFIG_IS_ENABLED()) to make code cleaner
Enable elf support for i.MX8M
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/mach-imx/imx_bootaux.c | 43 +++++++++++++++------------------
1 file changed, 20 insertions(+), 23 deletions(-)
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 9ffe5ac6e34..6a075ccc4fb 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -14,7 +14,13 @@
#include <linux/compiler.h>
#include <cpu_func.h>
-#ifndef CONFIG_IMX8M
+/* Just to avoid build error */
+#if CONFIG_IS_ENABLED(IMX8M)
+#define SRC_M4C_NON_SCLR_RST_MASK BIT(0)
+#define SRC_M4_ENABLE_MASK BIT(0)
+#define SRC_M4_REG_OFFSET 0
+#endif
+
const __weak struct rproc_att hostmap[] = { };
static const struct rproc_att *get_host_mapping(unsigned long auxcore)
@@ -59,7 +65,7 @@ static unsigned long load_elf_image_m_core_phdr(unsigned long addr)
return 0;
}
- dst = (void *)(phdr->p_paddr - mmap->da) + mmap->sa;
+ dst = (void *)(ulong)(phdr->p_paddr - mmap->da) + mmap->sa;
src = (void *)addr + phdr->p_offset;
debug("Loading phdr %i to 0x%p (%i bytes)\n",
@@ -77,7 +83,6 @@ static unsigned long load_elf_image_m_core_phdr(unsigned long addr)
return ehdr->e_entry;
}
-#endif
int arch_auxiliary_core_up(u32 core_id, ulong addr)
{
@@ -86,10 +91,6 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr)
if (!addr)
return -EINVAL;
-#ifdef CONFIG_IMX8M
- stack = *(u32 *)addr;
- pc = *(u32 *)(addr + 4);
-#else
/*
* handling ELF64 binaries
* isn't supported yet.
@@ -109,7 +110,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr)
stack = *(u32 *)addr;
pc = *(u32 *)(addr + 4);
}
-#endif
+
printf("## Starting auxiliary core stack = 0x%08lX, pc = 0x%08lX...\n",
stack, pc);
@@ -120,36 +121,32 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr)
flush_dcache_all();
/* Enable M4 */
-#ifdef CONFIG_IMX8M
- arm_smccc_smc(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0,
- 0, 0, 0, 0, NULL);
-#else
- clrsetbits_le32(SRC_BASE_ADDR + SRC_M4_REG_OFFSET,
- SRC_M4C_NON_SCLR_RST_MASK, SRC_M4_ENABLE_MASK);
-#endif
+ if (CONFIG_IS_ENABLED(IMX8M)) {
+ arm_smccc_smc(IMX_SIP_SRC, IMX_SIP_SRC_M4_START, 0, 0, 0, 0, 0, 0, NULL);
+ } else {
+ clrsetbits_le32(SRC_BASE_ADDR + SRC_M4_REG_OFFSET,
+ SRC_M4C_NON_SCLR_RST_MASK, SRC_M4_ENABLE_MASK);
+ }
return 0;
}
int arch_auxiliary_core_check_up(u32 core_id)
{
-#ifdef CONFIG_IMX8M
struct arm_smccc_res res;
-
- arm_smccc_smc(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0,
- 0, 0, 0, 0, &res);
-
- return res.a0;
-#else
unsigned int val;
+ if (CONFIG_IS_ENABLED(IMX8M)) {
+ arm_smccc_smc(IMX_SIP_SRC, IMX_SIP_SRC_M4_STARTED, 0, 0, 0, 0, 0, 0, &res);
+ return res.a0;
+ }
+
val = readl(SRC_BASE_ADDR + SRC_M4_REG_OFFSET);
if (val & SRC_M4C_NON_SCLR_RST_MASK)
return 0; /* assert in reset */
return 1;
-#endif
}
/*
--
2.36.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] imx: bootaux: add missing newline
2022-04-29 8:03 [PATCH 1/4] imx: bootaux: cleanup code Peng Fan (OSS)
@ 2022-04-29 8:03 ` Peng Fan (OSS)
2022-05-20 13:43 ` sbabic
2022-04-29 8:03 ` [PATCH 3/4] imx: bootaux: get stack from elf file Peng Fan (OSS)
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Peng Fan (OSS) @ 2022-04-29 8:03 UTC (permalink / raw)
To: sbabic, festevam, NXP i.MX U-Boot Team; +Cc: u-boot, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add missing newline
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/mach-imx/imx_bootaux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 6a075ccc4fb..3c6a5c09b7d 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -60,7 +60,7 @@ static unsigned long load_elf_image_m_core_phdr(unsigned long addr)
continue;
if (!mmap) {
- printf("Invalid aux core address: %08x",
+ printf("Invalid aux core address: %08x\n",
phdr->p_paddr);
return 0;
}
--
2.36.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] imx: bootaux: get stack from elf file
2022-04-29 8:03 [PATCH 1/4] imx: bootaux: cleanup code Peng Fan (OSS)
2022-04-29 8:03 ` [PATCH 2/4] imx: bootaux: add missing newline Peng Fan (OSS)
@ 2022-04-29 8:03 ` Peng Fan (OSS)
2022-05-20 13:42 ` sbabic
2022-04-29 8:03 ` [PATCH 4/4] imx: imx8m: add rproc_att Peng Fan (OSS)
2022-05-20 13:43 ` [PATCH 1/4] imx: bootaux: cleanup code sbabic
3 siblings, 1 reply; 8+ messages in thread
From: Peng Fan (OSS) @ 2022-04-29 8:03 UTC (permalink / raw)
To: sbabic, festevam, NXP i.MX U-Boot Team; +Cc: u-boot, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
To i.MX8, M core stack is pre-coded in source code, so need to get it
before kicking M core. The stack pointer is stored in the first word of
the first PT_LOAD section __isr_vector. So use a num to index the
section loading.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/mach-imx/imx_bootaux.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 3c6a5c09b7d..8115bf40f1a 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -42,10 +42,11 @@ static const struct rproc_att *get_host_mapping(unsigned long auxcore)
* is valid, returns the entry point address.
* Translates load addresses in the elf file to the U-Boot address space.
*/
-static unsigned long load_elf_image_m_core_phdr(unsigned long addr)
+static unsigned long load_elf_image_m_core_phdr(unsigned long addr, ulong *stack)
{
Elf32_Ehdr *ehdr; /* ELF header structure pointer */
Elf32_Phdr *phdr; /* Program header structure pointer */
+ int num = 0;
int i;
ehdr = (Elf32_Ehdr *)addr;
@@ -71,8 +72,13 @@ static unsigned long load_elf_image_m_core_phdr(unsigned long addr)
debug("Loading phdr %i to 0x%p (%i bytes)\n",
i, dst, phdr->p_filesz);
- if (phdr->p_filesz)
+ if (phdr->p_filesz) {
memcpy(dst, src, phdr->p_filesz);
+ /* Stack in __isr_vector is the first section/word */
+ if (!num)
+ *stack = *(uint32_t *)src;
+ num++;
+ }
if (phdr->p_filesz != phdr->p_memsz)
memset(dst + phdr->p_filesz, 0x00,
phdr->p_memsz - phdr->p_filesz);
@@ -96,11 +102,12 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr)
* isn't supported yet.
*/
if (valid_elf_image(addr)) {
- stack = 0x0;
- pc = load_elf_image_m_core_phdr(addr);
+ pc = load_elf_image_m_core_phdr(addr, &stack);
if (!pc)
return CMD_RET_FAILURE;
+ if (!CONFIG_IS_ENABLED(ARM64))
+ stack = 0x0;
} else {
/*
* Assume binary file with vector table at the beginning.
--
2.36.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] imx: imx8m: add rproc_att
2022-04-29 8:03 [PATCH 1/4] imx: bootaux: cleanup code Peng Fan (OSS)
2022-04-29 8:03 ` [PATCH 2/4] imx: bootaux: add missing newline Peng Fan (OSS)
2022-04-29 8:03 ` [PATCH 3/4] imx: bootaux: get stack from elf file Peng Fan (OSS)
@ 2022-04-29 8:03 ` Peng Fan (OSS)
2022-05-20 13:42 ` sbabic
2022-05-20 13:43 ` [PATCH 1/4] imx: bootaux: cleanup code sbabic
3 siblings, 1 reply; 8+ messages in thread
From: Peng Fan (OSS) @ 2022-04-29 8:03 UTC (permalink / raw)
To: sbabic, festevam, NXP i.MX U-Boot Team; +Cc: u-boot, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
With rpoc_att, bootaux able to kick elf file for M core
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm/mach-imx/imx8m/soc.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 5240dc11363..3de5af6484c 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -1561,3 +1561,29 @@ enum env_location arch_env_get_location(enum env_operation op, int prio)
}
#endif
+
+#ifdef CONFIG_IMX_BOOTAUX
+const struct rproc_att hostmap[] = {
+ /* aux core , host core, size */
+ { 0x00000000, 0x007e0000, 0x00020000 },
+ /* OCRAM_S */
+ { 0x00180000, 0x00180000, 0x00008000 },
+ /* OCRAM */
+ { 0x00900000, 0x00900000, 0x00020000 },
+ /* OCRAM */
+ { 0x00920000, 0x00920000, 0x00020000 },
+ /* QSPI Code - alias */
+ { 0x08000000, 0x08000000, 0x08000000 },
+ /* DDR (Code) - alias */
+ { 0x10000000, 0x80000000, 0x0FFE0000 },
+ /* TCML */
+ { 0x1FFE0000, 0x007E0000, 0x00040000 },
+ /* OCRAM_S */
+ { 0x20180000, 0x00180000, 0x00008000 },
+ /* OCRAM */
+ { 0x20200000, 0x00900000, 0x00040000 },
+ /* DDR (Data) */
+ { 0x40000000, 0x40000000, 0x80000000 },
+ { /* sentinel */ }
+};
+#endif
--
2.36.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] imx: bootaux: get stack from elf file
2022-04-29 8:03 ` [PATCH 3/4] imx: bootaux: get stack from elf file Peng Fan (OSS)
@ 2022-05-20 13:42 ` sbabic
0 siblings, 0 replies; 8+ messages in thread
From: sbabic @ 2022-05-20 13:42 UTC (permalink / raw)
To: Peng Fan (OSS), u-boot
> From: Peng Fan <peng.fan@nxp.com>
> To i.MX8, M core stack is pre-coded in source code, so need to get it
> before kicking M core. The stack pointer is stored in the first word of
> the first PT_LOAD section __isr_vector. So use a num to index the
> section loading.
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] imx: imx8m: add rproc_att
2022-04-29 8:03 ` [PATCH 4/4] imx: imx8m: add rproc_att Peng Fan (OSS)
@ 2022-05-20 13:42 ` sbabic
0 siblings, 0 replies; 8+ messages in thread
From: sbabic @ 2022-05-20 13:42 UTC (permalink / raw)
To: Peng Fan (OSS), u-boot
> From: Peng Fan <peng.fan@nxp.com>
> With rpoc_att, bootaux able to kick elf file for M core
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] imx: bootaux: cleanup code
2022-04-29 8:03 [PATCH 1/4] imx: bootaux: cleanup code Peng Fan (OSS)
` (2 preceding siblings ...)
2022-04-29 8:03 ` [PATCH 4/4] imx: imx8m: add rproc_att Peng Fan (OSS)
@ 2022-05-20 13:43 ` sbabic
3 siblings, 0 replies; 8+ messages in thread
From: sbabic @ 2022-05-20 13:43 UTC (permalink / raw)
To: Peng Fan (OSS), u-boot
> From: Peng Fan <peng.fan@nxp.com>
> Use if (CONFIG_IS_ENABLED()) to make code cleaner
> Enable elf support for i.MX8M
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] imx: bootaux: add missing newline
2022-04-29 8:03 ` [PATCH 2/4] imx: bootaux: add missing newline Peng Fan (OSS)
@ 2022-05-20 13:43 ` sbabic
0 siblings, 0 replies; 8+ messages in thread
From: sbabic @ 2022-05-20 13:43 UTC (permalink / raw)
To: Peng Fan (OSS), u-boot
> From: Peng Fan <peng.fan@nxp.com>
> Add missing newline
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-05-20 13:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 8:03 [PATCH 1/4] imx: bootaux: cleanup code Peng Fan (OSS)
2022-04-29 8:03 ` [PATCH 2/4] imx: bootaux: add missing newline Peng Fan (OSS)
2022-05-20 13:43 ` sbabic
2022-04-29 8:03 ` [PATCH 3/4] imx: bootaux: get stack from elf file Peng Fan (OSS)
2022-05-20 13:42 ` sbabic
2022-04-29 8:03 ` [PATCH 4/4] imx: imx8m: add rproc_att Peng Fan (OSS)
2022-05-20 13:42 ` sbabic
2022-05-20 13:43 ` [PATCH 1/4] imx: bootaux: cleanup code sbabic
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.