All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] imx: fix M4 boot on i.MX8MQ processors
@ 2018-11-14 16:55 Gary Bisson
  2018-11-14 16:55 ` [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM Gary Bisson
  2018-11-14 16:55 ` [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms Gary Bisson
  0 siblings, 2 replies; 7+ messages in thread
From: Gary Bisson @ 2018-11-14 16:55 UTC (permalink / raw)
  To: u-boot

Hi,

This series fixes loading a M4 firmware into memory and start that M4
core using bootaux on i.MX8MQ platforms.

There were two issues:
1- the memory where the firmware is loaded (TCM) wasn't mapped
2- the bootaux code relied on ulong instead of u32 (M4 core is 32-bit)

This was tested on Nitrogen8M platform.

Regards,
Gary

Gary Bisson (2):
  imx: mx8m: add memory mapping for CAAM and TCM
  imx: bootaux: fix stack and pc assignment on 64-bit platforms

 arch/arm/mach-imx/imx_bootaux.c |  4 ++--
 arch/arm/mach-imx/mx8m/soc.c    | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

-- 
2.19.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM
  2018-11-14 16:55 [U-Boot] [PATCH 0/2] imx: fix M4 boot on i.MX8MQ processors Gary Bisson
@ 2018-11-14 16:55 ` Gary Bisson
  2018-11-17 10:00   ` Peng Fan
  2018-12-08 17:38   ` Stefano Babic
  2018-11-14 16:55 ` [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms Gary Bisson
  1 sibling, 2 replies; 7+ messages in thread
From: Gary Bisson @ 2018-11-14 16:55 UTC (permalink / raw)
  To: u-boot

Otherwise can't boot the M4 core as it is impossible to load its
firmware into the TCM memory.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 arch/arm/mach-imx/mx8m/soc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/mach-imx/mx8m/soc.c b/arch/arm/mach-imx/mx8m/soc.c
index 46873aa8dd..11251c5f9a 100644
--- a/arch/arm/mach-imx/mx8m/soc.c
+++ b/arch/arm/mach-imx/mx8m/soc.c
@@ -77,6 +77,22 @@ static struct mm_region imx8m_mem_map[] = {
 		.size = 0x100000UL,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_OUTER_SHARE
+	}, {
+		/* CAAM */
+		.virt = 0x100000UL,
+		.phys = 0x100000UL,
+		.size = 0x8000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* TCM */
+		.virt = 0x7C0000UL,
+		.phys = 0x7C0000UL,
+		.size = 0x80000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
 	}, {
 		/* OCRAM */
 		.virt = 0x900000UL,
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms
  2018-11-14 16:55 [U-Boot] [PATCH 0/2] imx: fix M4 boot on i.MX8MQ processors Gary Bisson
  2018-11-14 16:55 ` [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM Gary Bisson
@ 2018-11-14 16:55 ` Gary Bisson
  2018-11-17 10:02   ` Peng Fan
  2018-12-08 17:38   ` Stefano Babic
  1 sibling, 2 replies; 7+ messages in thread
From: Gary Bisson @ 2018-11-14 16:55 UTC (permalink / raw)
  To: u-boot

Using ulong is wrong as its size depends on the Host CPU architecture
(32-bit vs. 64-bit) although the Cortex-M4 is always 32-bit.

Without this patch, the stack and PC are obviously wrong and it
generates an abort when used on 64-bit processors such as the i.MX8MQ.

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 arch/arm/mach-imx/imx_bootaux.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index a1ea5c13f1..3103001b7c 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -17,8 +17,8 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
 	if (!boot_private_data)
 		return -EINVAL;
 
-	stack = *(ulong *)boot_private_data;
-	pc = *(ulong *)(boot_private_data + 4);
+	stack = *(u32 *)boot_private_data;
+	pc = *(u32 *)(boot_private_data + 4);
 
 	/* Set the stack and pc to M4 bootROM */
 	writel(stack, M4_BOOTROM_BASE_ADDR);
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM
  2018-11-14 16:55 ` [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM Gary Bisson
@ 2018-11-17 10:00   ` Peng Fan
  2018-12-08 17:38   ` Stefano Babic
  1 sibling, 0 replies; 7+ messages in thread
From: Peng Fan @ 2018-11-17 10:00 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Gary Bisson [mailto:gary.bisson at boundarydevices.com]
> Sent: 2018年11月15日 0:55
> To: u-boot at lists.denx.de
> Cc: sbabic at denx.de; Fabio Estevam <fabio.estevam@nxp.com>; Peng Fan
> <peng.fan@nxp.com>; dl-linux-imx <linux-imx@nxp.com>; Gary Bisson
> <gary.bisson@boundarydevices.com>
> Subject: [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM
> 
> Otherwise can't boot the M4 core as it is impossible to load its firmware into
> the TCM memory.
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
>  arch/arm/mach-imx/mx8m/soc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/mx8m/soc.c
> b/arch/arm/mach-imx/mx8m/soc.c index 46873aa8dd..11251c5f9a 100644
> --- a/arch/arm/mach-imx/mx8m/soc.c
> +++ b/arch/arm/mach-imx/mx8m/soc.c
> @@ -77,6 +77,22 @@ static struct mm_region imx8m_mem_map[] = {
>  		.size = 0x100000UL,
>  		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
>  			 PTE_BLOCK_OUTER_SHARE
> +	}, {
> +		/* CAAM */
> +		.virt = 0x100000UL,
> +		.phys = 0x100000UL,
> +		.size = 0x8000UL,
> +		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> +			 PTE_BLOCK_NON_SHARE |
> +			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
> +	}, {
> +		/* TCM */
> +		.virt = 0x7C0000UL,
> +		.phys = 0x7C0000UL,
> +		.size = 0x80000UL,
> +		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> +			 PTE_BLOCK_NON_SHARE |
> +			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
>  	}, {
>  		/* OCRAM */
>  		.virt = 0x900000UL,

Reviewed-by: Peng Fan <peng.fan@nxp.com>
> --
> 2.19.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms
  2018-11-14 16:55 ` [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms Gary Bisson
@ 2018-11-17 10:02   ` Peng Fan
  2018-12-08 17:38   ` Stefano Babic
  1 sibling, 0 replies; 7+ messages in thread
From: Peng Fan @ 2018-11-17 10:02 UTC (permalink / raw)
  To: u-boot


> -----Original Message-----
> From: Gary Bisson [mailto:gary.bisson at boundarydevices.com]
> Sent: 2018年11月15日 0:55
> To: u-boot at lists.denx.de
> Cc: sbabic at denx.de; Fabio Estevam <fabio.estevam@nxp.com>; Peng Fan
> <peng.fan@nxp.com>; dl-linux-imx <linux-imx@nxp.com>; Gary Bisson
> <gary.bisson@boundarydevices.com>
> Subject: [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit
> platforms
> 
> Using ulong is wrong as its size depends on the Host CPU architecture (32-bit
> vs. 64-bit) although the Cortex-M4 is always 32-bit.
> 
> Without this patch, the stack and PC are obviously wrong and it generates an
> abort when used on 64-bit processors such as the i.MX8MQ.
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
>  arch/arm/mach-imx/imx_bootaux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx_bootaux.c
> b/arch/arm/mach-imx/imx_bootaux.c index a1ea5c13f1..3103001b7c
> 100644
> --- a/arch/arm/mach-imx/imx_bootaux.c
> +++ b/arch/arm/mach-imx/imx_bootaux.c
> @@ -17,8 +17,8 @@ int arch_auxiliary_core_up(u32 core_id, ulong
> boot_private_data)
>  	if (!boot_private_data)
>  		return -EINVAL;
> 
> -	stack = *(ulong *)boot_private_data;
> -	pc = *(ulong *)(boot_private_data + 4);
> +	stack = *(u32 *)boot_private_data;
> +	pc = *(u32 *)(boot_private_data + 4);
> 
>  	/* Set the stack and pc to M4 bootROM */
>  	writel(stack, M4_BOOTROM_BASE_ADDR);

Reviewed-by: Peng Fan <peng.fan@nxp.com>

> --
> 2.19.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM
  2018-11-14 16:55 ` [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM Gary Bisson
  2018-11-17 10:00   ` Peng Fan
@ 2018-12-08 17:38   ` Stefano Babic
  1 sibling, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2018-12-08 17:38 UTC (permalink / raw)
  To: u-boot



On 14/11/18 17:55, Gary Bisson wrote:
> Otherwise can't boot the M4 core as it is impossible to load its
> firmware into the TCM memory.
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
>  arch/arm/mach-imx/mx8m/soc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/mx8m/soc.c b/arch/arm/mach-imx/mx8m/soc.c
> index 46873aa8dd..11251c5f9a 100644
> --- a/arch/arm/mach-imx/mx8m/soc.c
> +++ b/arch/arm/mach-imx/mx8m/soc.c
> @@ -77,6 +77,22 @@ static struct mm_region imx8m_mem_map[] = {
>  		.size = 0x100000UL,
>  		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
>  			 PTE_BLOCK_OUTER_SHARE
> +	}, {
> +		/* CAAM */
> +		.virt = 0x100000UL,
> +		.phys = 0x100000UL,
> +		.size = 0x8000UL,
> +		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> +			 PTE_BLOCK_NON_SHARE |
> +			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
> +	}, {
> +		/* TCM */
> +		.virt = 0x7C0000UL,
> +		.phys = 0x7C0000UL,
> +		.size = 0x80000UL,
> +		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
> +			 PTE_BLOCK_NON_SHARE |
> +			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
>  	}, {
>  		/* OCRAM */
>  		.virt = 0x900000UL,
> 


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 at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms
  2018-11-14 16:55 ` [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms Gary Bisson
  2018-11-17 10:02   ` Peng Fan
@ 2018-12-08 17:38   ` Stefano Babic
  1 sibling, 0 replies; 7+ messages in thread
From: Stefano Babic @ 2018-12-08 17:38 UTC (permalink / raw)
  To: u-boot



On 14/11/18 17:55, Gary Bisson wrote:
> Using ulong is wrong as its size depends on the Host CPU architecture
> (32-bit vs. 64-bit) although the Cortex-M4 is always 32-bit.
> 
> Without this patch, the stack and PC are obviously wrong and it
> generates an abort when used on 64-bit processors such as the i.MX8MQ.
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> ---
>  arch/arm/mach-imx/imx_bootaux.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
> index a1ea5c13f1..3103001b7c 100644
> --- a/arch/arm/mach-imx/imx_bootaux.c
> +++ b/arch/arm/mach-imx/imx_bootaux.c
> @@ -17,8 +17,8 @@ int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
>  	if (!boot_private_data)
>  		return -EINVAL;
>  
> -	stack = *(ulong *)boot_private_data;
> -	pc = *(ulong *)(boot_private_data + 4);
> +	stack = *(u32 *)boot_private_data;
> +	pc = *(u32 *)(boot_private_data + 4);
>  
>  	/* Set the stack and pc to M4 bootROM */
>  	writel(stack, M4_BOOTROM_BASE_ADDR);
> 


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 at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-12-08 17:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 16:55 [U-Boot] [PATCH 0/2] imx: fix M4 boot on i.MX8MQ processors Gary Bisson
2018-11-14 16:55 ` [U-Boot] [PATCH 1/2] imx: mx8m: add memory mapping for CAAM and TCM Gary Bisson
2018-11-17 10:00   ` Peng Fan
2018-12-08 17:38   ` Stefano Babic
2018-11-14 16:55 ` [U-Boot] [PATCH 2/2] imx: bootaux: fix stack and pc assignment on 64-bit platforms Gary Bisson
2018-11-17 10:02   ` Peng Fan
2018-12-08 17:38   ` Stefano Babic

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.