Skip to contentSkip to conversation

imx8mp: evk: fix boot and update

PATCH New Peng Fan 2 participants 9 messages May 12, 2020 Arm i.MX and Layerscape

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

v2 cover imx8mp: evk: fix boot and update

V2:
Split code into minor patches
Update fix boot patch, use simple malloc and drop malloc_f Tested 5.4.24 kernel, boots well.

Peng Fan (5):
imx8mp_evk: spl: drop useless code
imx8mp_evk: spl: drop timer_init
imx8mp_evk: spl: use spl_early_init
imx8mp_evk: spl: no need the code since spl framework could do that
imx: imx8mp_evk: fix boot issue

 board/freescale/imx8mp_evk/spl.c | 28 ++++------------------------
 configs/imx8mp_evk_defconfig     |  3 ++-
 include/configs/imx8mp_evk.h     | 12 +++++-------
 3 files changed, 11 insertions(+), 32 deletions(-)
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH v2 1/5 imx8mp_evk: spl: drop useless code

Drop useless getting ccm device, there is no need to explicted do this in board code, and we not enable SPL CLK currently.

---
 board/freescale/imx8mp_evk/spl.c | 14 --------------
 1 file changed, 14 deletions(-)
board/freescale/imx8mp_evk/spl.c +0 -14
index c5f640dc7b..8151b49d97 100644
@@ -25,11 +25,6 @@
 #include <mmc.h>
 #include <asm/arch/ddr.h>
 
-#include <dm/uclass.h>
-#include <dm/device.h>
-#include <dm/uclass-internal.h>
-#include <dm/device-internal.h>
-
 DECLARE_GLOBAL_DATA_PTR;
 
 int spl_board_boot_device(enum boot_device boot_dev_spl)
@@ -44,16 +39,7 @@ void spl_dram_init(void)
 
 void spl_board_init(void)
 {
-	struct udevice *dev;
-	int ret;
-
 	puts("Normal Boot\n");
-
-	ret = uclass_get_device_by_name(UCLASS_CLK,
-					"clock-controller at 30380000",
-					&dev);
-	if (ret < 0)
-		printf("Failed to find clock node. Check device tree\n");
 }
 
 #define I2C_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_HYS | PAD_CTL_PUE | PAD_CTL_PE)
Signature · 1 line
2.16.4
reviewer
#2 lore raw

PATCH v2 1/5 imx8mp_evk: spl: drop useless code

Hi Peng,

Quoted 5 lines · Peng Fan

Drop useless getting ccm device, there is no need to explicted do this in board code, and we not enable SPL CLK currently.

I got an error while applying this patch:

patching file board/freescale/imx8mp_evk/spl.c
Hunk #2 FAILED at 39.
1 out of 2 hunks FAILED -- saving rejects to file
board/freescale/imx8mp_evk/spl.c.rej

I fixed it manually and applied the whole series plus this watchdog one:
https://patchwork.ozlabs.org/project/uboot/patch/20200511140031.8862-4-festevam at gmail.com/

I get an "alloc space exhausted" error message though:

U-Boot SPL 2020.07-rc2-dirty (May 12 2020 - 08:29:04 -0300) Normal Boot
WDT: Started with servicing (60s timeout)
Trying to boot from BOOTROM
image offset 0x8000, pagesize 0x200, ivt offset 0x0

U-Boot 2020.07-rc2-dirty (May 12 2020 - 08:29:04 -0300)

alloc space exhausted
CPU: Freescale i.MX8MP rev1.0 at 1000 MHz

Despite the alloc error, the boot completes and the 'reset' command works.

I am still not able to boot a imx_5.4.3_2.0.0 NXP kernel though as it hangs after the serial driver is probed:
https://pastebin.com/raw/ix5dnGub

Are you able to boot an imx_5.4.3_2.0.0 NXP kernel?

If so, can you please share your ATF and LPDDR4 firmware files?

Thanks

author
#3 lore raw

PATCH v2 1/5 imx8mp_evk: spl: drop useless code

Quoted 9 lines

Subject: Re: [PATCH V2 1/5] imx8mp_evk: spl: drop useless code

Hi Peng,

Quoted 4 lines · Peng Fan

Drop useless getting ccm device, there is no need to explicted do this in board code, and we not enable SPL CLK currently.

Quoted 7 lines
Quoted 1 line

I got an error while applying this patch:

patching file board/freescale/imx8mp_evk/spl.c Hunk #2 FAILED at 39. 1 out of 2 hunks FAILED -- saving rejects to file board/freescale/imx8mp_evk/spl.c.rej

Ok. I'll rebase and try.

Quoted 17 lines

I fixed it manually and applied the whole series plus this watchdog one:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
work.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20200511140031.8862-4-f estevam%40gmail.com%2F&amp;data=02%7C01%7Cpeng.fan%40nxp.com% 7Cc16790e08601447b539c08d7f669a3ef%7C686ea1d3bc2b4c6fa92cd99c5c 301635%7C0%7C0%7C637248805891280120&amp;sdata=4rvjaQt%2BoWw6 45GNynVYVJavcf6XU%2FhS0K3cfqKyRUM%3D&amp;reserved=0

I get an "alloc space exhausted" error message though:

U-Boot SPL 2020.07-rc2-dirty (May 12 2020 - 08:29:04 -0300) Normal Boot
WDT: Started with servicing (60s timeout)
Trying to boot from BOOTROM
image offset 0x8000, pagesize 0x200, ivt offset 0x0

Quoted 6 lines

U-Boot 2020.07-rc2-dirty (May 12 2020 - 08:29:04 -0300)

alloc space exhausted
CPU: Freescale i.MX8MP rev1.0 at 1000 MHz

Despite the alloc error, the boot completes and the 'reset' command works.

I not met this error. Which commit hash are you using?

Quoted 9 lines

I am still not able to boot a imx_5.4.3_2.0.0 NXP kernel though as it hangs after the serial driver is probed:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpasteb
in.com%2Fraw%2Fix5dnGub&amp;data=02%7C01%7Cpeng.fan%40nxp.com% 7Cc16790e08601447b539c08d7f669a3ef%7C686ea1d3bc2b4c6fa92cd99c5c 301635%7C0%7C0%7C637248805891290111&amp;sdata=z4rJdfJsEEeDux%2 Fs3VGs291EPuwYLjeYH981boDooEo%3D&amp;reserved=0

Quoted 3 lines

Are you able to boot an imx_5.4.3_2.0.0 NXP kernel?

If so, can you please share your ATF and LPDDR4 firmware files?

I am using local latest 5.4 atf/kernel. I'll send you the link private.

Regards,
Peng.

Quoted 2 lines

Thanks

reviewer
#4 lore raw

PATCH v2 1/5 imx8mp_evk: spl: drop useless code

Hi Peng,

Quoted 1 line · Peng Fan

I not met this error. Which commit hash are you using?

I am using top of tree U-Boot master:

commit 2a38d2239d0bb4d128b00886bf097ab247a0b1a7

Author: Tom Rini <[email protected]>
Date:   Mon May 11 18:28:19 2020 -0400

Prepare v2020.07-rc2

Plus this watchdog patch:
https://patchwork.ozlabs.org/project/uboot/patch/20200511140031.8862-4-festevam at gmail.com/

author
#5 lore raw

PATCH v2 2/5 imx8mp_evk: spl: drop timer_init

In reply to Peng Fan

timer_init has been invoked in arch_cpu_init, no need to invoke it again in board code.

---
 board/freescale/imx8mp_evk/spl.c | 2 --
 1 file changed, 2 deletions(-)
board/freescale/imx8mp_evk/spl.c +0 -2
index 8151b49d97..298203c631 100644
@@ -110,8 +110,6 @@ void board_init_f(ulong dummy)
 
 	board_early_init_f();
 
-	timer_init();
-
 	preloader_console_init();
 
 	/* Clear the BSS. */
Signature · 1 line
2.16.4
author
#6 lore raw

PATCH v2 3/5 imx8mp_evk: spl: use spl_early_init

In reply to Peng Fan

Use spl_early_init to replace spl_init, spl_init will be invoked in board_init_r, we only need use spl_early_init to setup malloc and scan early dt.

---
 board/freescale/imx8mp_evk/spl.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
board/freescale/imx8mp_evk/spl.c +6 -6
index 298203c631..284d477514 100644
@@ -110,17 +110,17 @@ void board_init_f(ulong dummy)
 
 	board_early_init_f();
 
-	preloader_console_init();
-
-	/* Clear the BSS. */
-	memset(__bss_start, 0, __bss_end - __bss_start);
-
-	ret = spl_init();
+	ret = spl_early_init();
 	if (ret) {
 		debug("spl_init() failed: %d\n", ret);
 		hang();
 	}
 
+	preloader_console_init();
+
+	/* Clear the BSS. */
+	memset(__bss_start, 0, __bss_end - __bss_start);
+
 	enable_tzc380();
 
 	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
Signature · 1 line
2.16.4
author
#7 lore raw

PATCH v2 4/5 imx8mp_evk: spl: no need the code since spl framework could do that

In reply to Peng Fan

We no need invoke the code, since spl framework could help us do that.

---
 board/freescale/imx8mp_evk/spl.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
board/freescale/imx8mp_evk/spl.c +1 -5
index 284d477514..92763be10e 100644
@@ -100,6 +100,7 @@ int board_fit_config_name_match(const char *name)
 }
 #endif
 
+/* Do not use BSS area in this phase */
 void board_init_f(ulong dummy)
 {
 	int ret;
@@ -118,9 +119,6 @@ void board_init_f(ulong dummy)
 
 	preloader_console_init();
 
-	/* Clear the BSS. */
-	memset(__bss_start, 0, __bss_end - __bss_start);
-
 	enable_tzc380();
 
 	setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1);
@@ -129,6 +127,4 @@ void board_init_f(ulong dummy)
 
 	/* DDR initialization */
 	spl_dram_init();
-
-	board_init_r(NULL, 0);
 }
Signature · 1 line
2.16.4
author
#8 lore raw

PATCH v2 5/5 imx: imx8mp_evk: fix boot issue

In reply to Peng Fan

The u-boot-spl.bin pad with ddr firmware conflicts with the CONFIG_MALLOC_F_ADDR area, the ddr firmware will be overwritten by malloc in SPL stage and cause ddr initialization not able to finish. So update the related addresses to fix the issue.

---
 configs/imx8mp_evk_defconfig |  3 ++-
 include/configs/imx8mp_evk.h | 12 +++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)
configs/imx8mp_evk_defconfig +2 -1
index 44b2935f69..3189b2ad99 100644
@@ -4,7 +4,8 @@ CONFIG_SYS_TEXT_BASE=0x40200000
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_SYS_MALLOC_F_LEN=0x10000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_ENV_SIZE=0x1000
 CONFIG_ENV_OFFSET=0x400000
 CONFIG_SYS_I2C_MXC_I2C1=y
include/configs/imx8mp_evk.h +5 -7
index 80e5738961..1b81ffc5f4 100644
@@ -23,16 +23,14 @@
 #ifdef CONFIG_SPL_BUILD
 /*#define CONFIG_ENABLE_DDR_TRAINING_DEBUG*/
 #define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
-#define CONFIG_SPL_STACK		0x990000
-#define CONFIG_SPL_BSS_START_ADDR      0x0095e000
-#define CONFIG_SPL_BSS_MAX_SIZE        0x2000	/* 8 KB */
-#define CONFIG_SYS_SPL_MALLOC_START    0x42200000
-#define CONFIG_SYS_SPL_MALLOC_SIZE     SZ_512K	/* 512 KB */
+#define CONFIG_SPL_STACK		0x960000
+#define CONFIG_SPL_BSS_START_ADDR	0x0098FC00
+#define CONFIG_SPL_BSS_MAX_SIZE		0x400	/* 1 KB */
+#define CONFIG_SYS_SPL_MALLOC_START	0x42200000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	SZ_512K	/* 512 KB */
 #define CONFIG_SYS_ICACHE_OFF
 #define CONFIG_SYS_DCACHE_OFF
 
-#define CONFIG_MALLOC_F_ADDR		0x940000
-
 #define CONFIG_SPL_ABORT_ON_RAW_IMAGE
 
 #undef CONFIG_DM_MMC
Signature · 1 line
2.16.4