From 2b36c623ef0751e01b40b2443c14a4455feee8b4 Mon Sep 17 00:00:00 2001 From: Nikhil M Jain Date: Wed, 21 Jun 2023 16:29:53 +0530 Subject: common: splash_source: Fix type casting errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During compilation splash_source puts out below warning for type conversion in splash_load_fit for bmp_load_addr and fit_header. Change their type to uintptr_t to fix the warnings. common/splash_source.c: In function ‘splash_load_fit’: common/splash_source.c:366:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 366 | img_header = (struct legacy_img_hdr *)bmp_load_addr; | ^ common/splash_source.c:376:49: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] 376 | res = splash_storage_read_raw(location, (u32)fit_header, fit_size); | ^ common/splash_source.c:401:25: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 401 | memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size); The above warnings are generated if CONFIG_FIT is enabled. Signed-off-by: Nikhil M Jain --- common/splash_source.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common') diff --git a/common/splash_source.c b/common/splash_source.c index a2601376198..7223a1aae78 100644 --- a/common/splash_source.c +++ b/common/splash_source.c @@ -363,7 +363,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) if (res < 0) return res; - img_header = (struct legacy_img_hdr *)bmp_load_addr; + img_header = (struct legacy_img_hdr *)(uintptr_t)bmp_load_addr; if (image_get_magic(img_header) != FDT_MAGIC) { printf("Could not find FDT magic\n"); return -EINVAL; @@ -373,7 +373,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) /* Read in entire FIT */ fit_header = (const u32 *)(bmp_load_addr + header_size); - res = splash_storage_read_raw(location, (u32)fit_header, fit_size); + res = splash_storage_read_raw(location, (uintptr_t)fit_header, fit_size); if (res < 0) return res; @@ -398,7 +398,7 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr) /* Extract the splash data from FIT */ /* 1. Test if splash is in FIT internal data. */ if (!fit_image_get_data(fit_header, node_offset, &internal_splash_data, &internal_splash_size)) - memmove((void *)bmp_load_addr, internal_splash_data, internal_splash_size); + memmove((void *)(uintptr_t)bmp_load_addr, internal_splash_data, internal_splash_size); /* 2. Test if splash is in FIT external data with fixed position. */ else if (!fit_image_get_data_position(fit_header, node_offset, &external_splash_addr)) is_splash_external = true; -- cgit v1.2.3 From 149fb05b8346e6ac37df594ef0427cecff09053c Mon Sep 17 00:00:00 2001 From: Nikhil M Jain Date: Tue, 18 Jul 2023 14:27:27 +0530 Subject: common: spl: spl: Update stack pointer address At SPL stage when stack is relocated, the stack pointer needs to be updated, the stack pointer may point to stack in on chip memory even though stack is relocated. Signed-off-by: Nikhil M Jain Reviewed-by: Tom Rini --- common/spl/spl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'common') diff --git a/common/spl/spl.c b/common/spl/spl.c index d74acec10b5..d45dd1c923e 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -992,6 +992,7 @@ ulong spl_relocate_stack_gd(void) #endif /* Get stack position: use 8-byte alignment for ABI compliance */ ptr = CONFIG_SPL_STACK_R_ADDR - roundup(sizeof(gd_t),16); + gd->start_addr_sp = ptr; new_gd = (gd_t *)ptr; memcpy(new_gd, (void *)gd, sizeof(gd_t)); #if CONFIG_IS_ENABLED(DM) -- cgit v1.2.3 From 5bc610a7d9d1ea1b83aaab7ca54ef847087d7167 Mon Sep 17 00:00:00 2001 From: Nikhil M Jain Date: Tue, 18 Jul 2023 14:27:31 +0530 Subject: common: board_f: Pass frame buffer info from SPL to u-boot U-boot proper can use frame buffer address passed from SPL to reserve the memory area used by framebuffer set in SPL so that splash image set in SPL continues to get displayed while u-boot proper is running. Put the framebuffer address and size in a bloblist to make them available at u-boot proper, if in u-boot proper CONFIG_VIDEO is defined. Signed-off-by: Nikhil M Jain Reviewed-by: Devarsh Thakkar Reviewed-by: Simon Glass --- common/board_f.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/board_f.c b/common/board_f.c index e5969ec9a27..7d2c380e91e 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -411,7 +411,16 @@ __weak int arch_reserve_mmu(void) static int reserve_video(void) { - if (IS_ENABLED(CONFIG_VIDEO)) { + if (IS_ENABLED(CONFIG_SPL_VIDEO) && spl_phase() > PHASE_SPL && + CONFIG_IS_ENABLED(BLOBLIST)) { + struct video_handoff *ho; + + ho = bloblist_find(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho)); + if (!ho) + return log_msg_ret("blf", -ENOENT); + video_reserve_from_bloblist(ho); + gd->relocaddr = ho->fb; + } else if (CONFIG_IS_ENABLED(VIDEO)) { ulong addr; int ret; -- cgit v1.2.3 From 954b0ad4a228112f68cf96522e93f4b30c7b6117 Mon Sep 17 00:00:00 2001 From: Nikhil M Jain Date: Tue, 18 Jul 2023 14:27:33 +0530 Subject: common: spl: spl: Remove video driver Use config SPL_VIDEO_REMOVE to remove video driver at SPL stage before jumping to next stage, in place of CONFIG_SPL_VIDEO, to allow user to remove video if required. Signed-off-by: Nikhil M Jain Reviewed-by: Devarsh Thakkar Reviewed-by: Simon Glass --- common/spl/spl.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/spl/spl.c b/common/spl/spl.c index d45dd1c923e..f09bb977814 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -891,18 +891,18 @@ void board_init_r(gd_t *dummy1, ulong dummy2) debug("Failed to stash bootstage: err=%d\n", ret); #endif -#if defined(CONFIG_SPL_VIDEO) - struct udevice *dev; - int rc; - - rc = uclass_find_device(UCLASS_VIDEO, 0, &dev); - if (!rc && dev) { - rc = device_remove(dev, DM_REMOVE_NORMAL); - if (rc) - printf("Cannot remove video device '%s' (err=%d)\n", - dev->name, rc); + if (IS_ENABLED(CONFIG_SPL_VIDEO_REMOVE)) { + struct udevice *dev; + int rc; + + rc = uclass_find_device(UCLASS_VIDEO, 0, &dev); + if (!rc && dev) { + rc = device_remove(dev, DM_REMOVE_NORMAL); + if (rc) + printf("Cannot remove video device '%s' (err=%d)\n", + dev->name, rc); + } } -#endif spl_board_prepare_for_boot(); jump_to_image_no_args(&spl_image); -- cgit v1.2.3 From 373991d6939b01c47b352b1f620ef772419a9cf4 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Tue, 18 Jul 2023 14:27:36 +0530 Subject: common: Kconfig: Fix CMD_BMP/BMP dependency Using `default y` will not select BMP when CMD_BMP has been enabled, if it was already configured. By using `select`, if `CMD_BMP` is turned on, it will force the presence of `BMP`. Fixes: 072b0e16c4 ("common: Kconfig: Add BMP configs") Signed-off-by: Samuel Dionne-Riel Signed-off-by: Nikhil M Jain --- common/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index f5ad63ce166..973482f0756 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1167,7 +1167,6 @@ config IO_TRACE config BMP bool "Enable bmp image display" - default y if CMD_BMP help Enable bmp functions to display bmp image and get bmp info. -- cgit v1.2.3