[PATCH V2 0/5] 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(-)

Drop useless getting ccm device, there is no need to explicted do this in board code, and we not enable SPL CLK currently.
Signed-off-by: Peng Fan peng.fan@nxp.com --- board/freescale/imx8mp_evk/spl.c | 14 -------------- 1 file changed, 14 deletions(-)
diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index c5f640dc7b..8151b49d97 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -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@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)

Hi Peng,
On Tue, May 12, 2020 at 6:16 AM Peng Fan peng.fan@nxp.com wrote:
Drop useless getting ccm device, there is no need to explicted do this in board code, and we not enable SPL CLK currently.
Signed-off-by: Peng Fan peng.fan@nxp.com
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-feste...
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

Subject: Re: [PATCH V2 1/5] imx8mp_evk: spl: drop useless code
Hi Peng,
On Tue, May 12, 2020 at 6:16 AM Peng Fan peng.fan@nxp.com wrote:
Drop useless getting ccm device, there is no need to explicted do this in board code, and we not enable SPL CLK currently.
Signed-off-by: Peng Fan peng.fan@nxp.com
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.
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&data=02%7C01%7Cpeng.fan%40nxp.com% 7Cc16790e08601447b539c08d7f669a3ef%7C686ea1d3bc2b4c6fa92cd99c5c 301635%7C0%7C0%7C637248805891280120&sdata=4rvjaQt%2BoWw6 45GNynVYVJavcf6XU%2FhS0K3cfqKyRUM%3D&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
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?
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&data=02%7C01%7Cpeng.fan%40nxp.com% 7Cc16790e08601447b539c08d7f669a3ef%7C686ea1d3bc2b4c6fa92cd99c5c 301635%7C0%7C0%7C637248805891290111&sdata=z4rJdfJsEEeDux%2 Fs3VGs291EPuwYLjeYH981boDooEo%3D&reserved=0
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.
Thanks

Hi Peng,
On Tue, May 12, 2020 at 8:59 AM Peng Fan peng.fan@nxp.com wrote:
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 trini@konsulko.com Date: Mon May 11 18:28:19 2020 -0400
Prepare v2020.07-rc2
Signed-off-by: Tom Rini trini@konsulko.com
Plus this watchdog patch: https://patchwork.ozlabs.org/project/uboot/patch/20200511140031.8862-4-feste...

timer_init has been invoked in arch_cpu_init, no need to invoke it again in board code.
Signed-off-by: Peng Fan peng.fan@nxp.com --- board/freescale/imx8mp_evk/spl.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 8151b49d97..298203c631 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -110,8 +110,6 @@ void board_init_f(ulong dummy)
board_early_init_f();
- timer_init(); - preloader_console_init();
/* Clear the BSS. */

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.
Signed-off-by: Peng Fan peng.fan@nxp.com --- board/freescale/imx8mp_evk/spl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 298203c631..284d477514 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -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);

We no need invoke the code, since spl framework could help us do that.
Signed-off-by: Peng Fan peng.fan@nxp.com --- board/freescale/imx8mp_evk/spl.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 284d477514..92763be10e 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -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); }

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.
Reported-by: Fabio Estevam festevam@gmail.com Signed-off-by: Peng Fan peng.fan@nxp.com --- configs/imx8mp_evk_defconfig | 3 ++- include/configs/imx8mp_evk.h | 12 +++++------- 2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/configs/imx8mp_evk_defconfig b/configs/imx8mp_evk_defconfig index 44b2935f69..3189b2ad99 100644 --- a/configs/imx8mp_evk_defconfig +++ b/configs/imx8mp_evk_defconfig @@ -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 diff --git a/include/configs/imx8mp_evk.h b/include/configs/imx8mp_evk.h index 80e5738961..1b81ffc5f4 100644 --- a/include/configs/imx8mp_evk.h +++ b/include/configs/imx8mp_evk.h @@ -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
participants (2)
-
Fabio Estevam
-
Peng Fan