stm32mp1: enable simple framebuffer node for splashscreen
cover stm32mp1: enable simple framebuffer node for splashscreen
Use simple framebuffer node in the Linux kernel device tree to preserved the resources (clock, memory) used by the stm32 video driver to display the splashscreen.
See Linux documentation for details:Documentation/devicetree/bindings/display/simple-framebuffer.yaml
The 3 first commits of the series are cleanup steps:
migration to Kconfig and rename files and function to fdt_simplefb_ (it seems like a good time time as this function is only used today
in RPI boards)
patch 4 is a preliminary step = add video_is_active function
patch 5 add a new API fdt_simplefb_enable_and_mem_rsv to activate node and add reserved memory for video memory
patch 6 avoid a issue in kernel when the reserved video memory by LTDC driver is not aligned with Linux kernel MMU_SECTION_SIZE
patch 7 use this new function in stm32mp1 code for STMicroelectronics boards when the simple-framebuffer node is present in Linux device tree
Patrick Delaunay (7):
Convert CONFIG_LCD_DT_SIMPLEFB to Kconfig
common: rename lcd_simplefb.c file to fdt_simplefb.c
common: rename functions lcd_dt_simplefb to fdt_simplefb
video: Add video_is_active function
common: add fdt_simplefb_enable_and_mem_rsv function
video: stm32: stm32_ltdc: align framebuffer on 2MB
board: stm32mp1: enable simple framebuffer node for splashscreen
board/raspberrypi/rpi/rpi.c | 2 +-
board/st/stm32mp1/stm32mp1.c | 4 +++
common/Kconfig | 9 ++++++
common/Makefile | 2 +-
common/{lcd_simplefb.c => fdt_simplefb.c} | 37 ++++++++++++++++++++---
configs/rpi_0_w_defconfig | 1 +
configs/rpi_2_defconfig | 1 +
configs/rpi_3_32b_defconfig | 1 +
configs/rpi_3_b_plus_defconfig | 1 +
configs/rpi_3_defconfig | 1 +
configs/rpi_4_32b_defconfig | 1 +
configs/rpi_4_defconfig | 1 +
configs/rpi_arm64_defconfig | 1 +
configs/rpi_defconfig | 1 +
configs/stm32mp15_basic_defconfig | 1 +
configs/stm32mp15_defconfig | 1 +
configs/stm32mp15_trusted_defconfig | 1 +
drivers/video/stm32/stm32_ltdc.c | 5 ++-
drivers/video/video-uclass.c | 14 +++++++++
include/configs/rpi.h | 1 -
include/fdt_simplefb.h | 5 +--
include/video.h | 7 +++++
scripts/config_whitelist.txt | 1 -
23 files changed, 87 insertions(+), 12 deletions(-)
rename common/{lcd_simplefb.c => fdt_simplefb.c} (65%)Signature · 1 line
2.25.1
PATCH 1/7 Convert CONFIG_LCD_DT_SIMPLEFB to Kconfig
This converts the following to Kconfig:
CONFIG_LCD_DT_SIMPLEFB
This patch also renames this config to CONFIG_FDT_SIMPLEFB as the code in common/lcd_simplefb.c support CONFIG_LCD and CONFIG_VIDEO.
---
common/Kconfig | 9 +++++++++ common/Makefile | 2 +- configs/rpi_0_w_defconfig | 1 + configs/rpi_2_defconfig | 1 + configs/rpi_3_32b_defconfig | 1 + configs/rpi_3_b_plus_defconfig | 1 + configs/rpi_3_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/rpi_defconfig | 1 + include/configs/rpi.h | 1 - scripts/config_whitelist.txt | 1 - 13 files changed, 19 insertions(+), 3 deletions(-)
common/Kconfig +9 -0
@@ -766,3 +766,12 @@ config SPL_IMAGE_SIGN_INFO Enable image_sign_info helper functions in SPL. endif + +config FDT_SIMPLEFB + bool "FDT tools for simplefb support" + depends on OF_LIBFDT + help + Enable the fdt tools to manage the simple fb nodes in device tree. + These functions can be used by board to indicate to the OS + the presence of the simple frame buffer with associated reserved + memory
common/Makefile +1 -1
@@ -40,7 +40,7 @@ ifndef CONFIG_DM_VIDEO obj-$(CONFIG_LCD) += lcd.o lcd_console.o endif obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o -obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o +obj-$(CONFIG_FDT_SIMPLEFB) += lcd_simplefb.o obj-$(CONFIG_MENU) += menu.o obj-$(CONFIG_UPDATE_COMMON) += update.o obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
configs/rpi_0_w_defconfig +1 -0
@@ -13,6 +13,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y
configs/rpi_2_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y
configs/rpi_3_32b_defconfig +1 -0
@@ -15,6 +15,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y
configs/rpi_3_b_plus_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y
configs/rpi_3_defconfig +1 -0
@@ -14,6 +14,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y
configs/rpi_4_32b_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_DFU=y CONFIG_CMD_GPIO=y
configs/rpi_4_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_DFU=y CONFIG_CMD_GPIO=y
configs/rpi_arm64_defconfig +1 -0
@@ -12,6 +12,7 @@ CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y
configs/rpi_defconfig +1 -0
@@ -13,6 +13,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=y
include/configs/rpi.h +0 -1
@@ -44,7 +44,6 @@/* GPIO */ #define CONFIG_BCM2835_GPIO /* LCD */ -#define CONFIG_LCD_DT_SIMPLEFB #define CONFIG_VIDEO_BCM2835 /* DFU over USB/UDC */
scripts/config_whitelist.txt +0 -1
@@ -699,7 +699,6 @@ CONFIG_LBA48 CONFIG_LBDAF CONFIG_LCD_ALIGNMENT CONFIG_LCD_BMP_RLE8 -CONFIG_LCD_DT_SIMPLEFB CONFIG_LCD_INFO CONFIG_LCD_INFO_BELOW_LOGO CONFIG_LCD_IN_PSRAM
Signature · 1 line
2.25.1
Re: [PATCH 1/7] Convert CONFIG_LCD_DT_SIMPLEFB to Kconfig
Quoted 7 lines · Patrick Delaunay
This converts the following to
Kconfig:
CONFIG_LCD_DT_SIMPLEFBThis patch also renames this config to
CONFIG_FDT_SIMPLEFBas the code incommon/lcd_simplefb.csupportCONFIG_LCDandCONFIG_VIDEO.Signed-off-by Patrick Delaunay <[email protected]>
Quoted 180 lines
---
common/Kconfig | 9 +++++++++ common/Makefile | 2 +- configs/rpi_0_w_defconfig | 1 + configs/rpi_2_defconfig | 1 + configs/rpi_3_32b_defconfig | 1 + configs/rpi_3_b_plus_defconfig | 1 + configs/rpi_3_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/rpi_defconfig | 1 + include/configs/rpi.h | 1 - scripts/config_whitelist.txt | 1 - 13 files changed, 19 insertions(+), 3 deletions(-)common/Kconfig +9
-0@@ -766,3 +766,12 @@ config SPL_IMAGE_SIGN_INFO Enable image_sign_info helper functions in SPL. endif + +config FDT_SIMPLEFB + bool "FDT tools for simplefb support" + depends on OF_LIBFDT + help + Enable the fdt tools to manage the simple fb nodes in device tree. + These functions can be used by board to indicate to the OS + the presence of the simple frame buffer with associated reserved + memorycommon/Makefile +1
-1@@ -40,7 +40,7 @@ ifndef CONFIG_DM_VIDEO obj-$(CONFIG_LCD) += lcd.o lcd_console.o endif obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o -obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o +obj-$(CONFIG_FDT_SIMPLEFB) += lcd_simplefb.o obj-$(CONFIG_MENU) += menu.o obj-$(CONFIG_UPDATE_COMMON) += update.o obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.oconfigs/rpi_0_w_defconfig +1
-0@@ -13,6 +13,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=yconfigs/rpi_2_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=yconfigs/rpi_3_32b_defconfig +1
-0@@ -15,6 +15,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=yconfigs/rpi_3_b_plus_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=yconfigs/rpi_3_defconfig +1
-0@@ -14,6 +14,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=yconfigs/rpi_4_32b_defconfig +1
-0@@ -12,6 +12,7 @@ CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_DFU=y CONFIG_CMD_GPIO=yconfigs/rpi_4_defconfig +1
-0@@ -12,6 +12,7 @@ CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_DFU=y CONFIG_CMD_GPIO=yconfigs/rpi_arm64_defconfig +1
-0@@ -12,6 +12,7 @@ CONFIG_PREBOOT="pci enum; usb start;" # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=yconfigs/rpi_defconfig +1
-0@@ -13,6 +13,7 @@ CONFIG_USE_PREBOOT=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_MISC_INIT_R=y +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="U-Boot> " CONFIG_CMD_GPIO=y CONFIG_CMD_MMC=yinclude/configs/rpi.h +0
-1@@ -44,7 +44,6 @@/* GPIO */ #define CONFIG_BCM2835_GPIO /* LCD */ -#define CONFIG_LCD_DT_SIMPLEFB #define CONFIG_VIDEO_BCM2835 /* DFU over USB/UDC */ scripts/config_whitelist.txt +0
-1@@ -699,7 +699,6 @@ CONFIG_LBA48 CONFIG_LBDAF CONFIG_LCD_ALIGNMENT CONFIG_LCD_BMP_RLE8 -CONFIG_LCD_DT_SIMPLEFB CONFIG_LCD_INFO CONFIG_LCD_INFO_BELOW_LOGO CONFIG_LCD_IN_PSRAM
PATCH 2/7 common: rename lcd_simplefb.c file to fdt_simplefb.c
In reply to Patrick DelaunayRename the file lcd_simplefb.c to fdt_simplefb.c to be aligned with the configuration name and with the associated include file ./include/fdt_simplefb.h
---
common/Makefile | 2 +-
common/{lcd_simplefb.c => fdt_simplefb.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename common/{lcd_simplefb.c => fdt_simplefb.c} (100%)common/Makefile +1 -1
@@ -18,6 +18,7 @@ obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o obj-$(CONFIG_CMD_BEDBUG) += bedbug.o +obj-$(CONFIG_FDT_SIMPLEFB) += fdt_simplefb.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o obj-$(CONFIG_MII) += miiphyutil.o obj-$(CONFIG_CMD_MII) += miiphyutil.o
@@ -40,7 +41,6 @@ ifndef CONFIG_DM_VIDEO obj-$(CONFIG_LCD) += lcd.o lcd_console.o endif obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o -obj-$(CONFIG_FDT_SIMPLEFB) += lcd_simplefb.o obj-$(CONFIG_MENU) += menu.o obj-$(CONFIG_UPDATE_COMMON) += update.o obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
common/fdt_simplefb.c renamed from common/lcd_simplefb.c +0 -0
Signature · 1 line
2.25.1
Re: [Uboot-stm32] [PATCH 2/7] common: rename lcd_simplefb.c file to fdt_simplefb.c
Hi Patrick
common/fdt_simplefb.c
Quoted 37 lines · Patrick Delaunay
Rename the file
lcd_simplefb.ctofdt_simplefb.cto be aligned with the configuration name and with the associated include file./include/fdt_simplefb.hSigned-off-by Patrick Delaunay <[email protected]>---
common/Makefile | 2 +- common/{lcd_simplefb.c => fdt_simplefb.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename common/{lcd_simplefb.c => fdt_simplefb.c} (100%)common/Makefile +1
-1@@ -18,6 +18,7 @@ obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o obj-$(CONFIG_CMD_BEDBUG) += bedbug.o +obj-$(CONFIG_FDT_SIMPLEFB) += fdt_simplefb.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o obj-$(CONFIG_MII) += miiphyutil.o obj-$(CONFIG_CMD_MII) += miiphyutil.o@@ -40,7 +41,6 @@ ifndef CONFIG_DM_VIDEO obj-$(CONFIG_LCD) += lcd.o lcd_console.o endif obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o -obj-$(CONFIG_FDT_SIMPLEFB) += lcd_simplefb.o obj-$(CONFIG_MENU) += menu.o obj-$(CONFIG_UPDATE_COMMON) += update.o obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.ocommon/fdt_simplefb.c renamed from common/lcd_simplefb.c +0
-0
Thanks
Patrice
PATCH 3/7 common: rename functions lcd_dt_simplefb to fdt_simplefb
In reply to Patrick DelaunayRename the function named lcd_dt_simplefb* to fdt_simplefb* to be aligned with the associated file name fdt_simplefb.h/fdt_simplefb.c
---
board/raspberrypi/rpi/rpi.c | 2 +- common/fdt_simplefb.c | 10 +++++----- include/fdt_simplefb.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
board/raspberrypi/rpi/rpi.c +1 -1
@@ -505,7 +505,7 @@ int ft_board_setup(void *blob, struct bd_info *bd) node =fdt_node_offset_by_compatible (blob,-1 ,"simple-framebuffer" );if (node <0 ) -lcd_dt_simplefb_add_node (blob); +fdt_simplefb_add_node (blob);#ifdef CONFIG_EFI_LOADER /* Reserve the spin table */
common/fdt_simplefb.c +5 -5
@@ -16,7 +16,7 @@DECLARE_GLOBAL_DATA_PTR ; -static int lcd_dt_simplefb_configure_node (void *blob,int off) +static int fdt_simplefb_configure_node (void *blob,int off) {int xsize, ysize;int bpix;/* log2 of bits per pixel */
@@ -58,7 +58,7 @@ static int lcd_dt_simplefb_configure_node(void *blob, int off) xsize * (1 << bpix) / 8, name); } -int lcd_dt_simplefb_add_node (void *blob) +int fdt_simplefb_add_node (void *blob) {static const char compat[] ="simple-framebuffer" ;static const char disabled[] ="disabled" ;
@@ -76,10 +76,10 @@ int lcd_dt_simplefb_add_node(void *blob)if (ret <0 )return -1 ; -return lcd_dt_simplefb_configure_node (blob, off); +return fdt_simplefb_configure_node (blob, off); } -int lcd_dt_simplefb_enable_existing_node (void *blob) +int fdt_simplefb_enable_existing_node (void *blob) {int off;
@@ -87,5 +87,5 @@ int lcd_dt_simplefb_enable_existing_node(void *blob)if (off <0 )return -1 ; -return lcd_dt_simplefb_configure_node (blob, off); +return fdt_simplefb_configure_node (blob, off); }
include/fdt_simplefb.h +2 -2
@@ -8,6 +8,6 @@#ifndef _FDT_SIMPLEFB_H_#define _FDT_SIMPLEFB_H_ -int lcd_dt_simplefb_add_node (void *blob); -int lcd_dt_simplefb_enable_existing_node (void *blob); +int fdt_simplefb_add_node (void *blob); +int fdt_simplefb_enable_existing_node (void *blob);#endif
Signature · 1 line
2.25.1
Re: [PATCH 3/7] common: rename functions lcd_dt_simplefb to fdt_simplefb
Quoted 4 lines · Patrick Delaunay
Rename the function named lcd_dt_simplefb* to fdt_simplefb* to be aligned with the associated file name
fdt_simplefb.h/fdt_simplefb.cSigned-off-by Patrick Delaunay <[email protected]>
Quoted 76 lines
---
board/raspberrypi/rpi/rpi.c | 2 +- common/fdt_simplefb.c | 10 +++++----- include/fdt_simplefb.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)board/raspberrypi/rpi/rpi.c +1
-1@@ -505,7 +505,7 @@ int ft_board_setup(void *blob, struct bd_info *bd) node =fdt_node_offset_by_compatible (blob,-1 ,"simple-framebuffer" );if (node <0 ) -lcd_dt_simplefb_add_node (blob); +fdt_simplefb_add_node (blob);#ifdef CONFIG_EFI_LOADER /* Reserve the spin table */ common/fdt_simplefb.c +5
-5@@ -16,7 +16,7 @@DECLARE_GLOBAL_DATA_PTR ; -static int lcd_dt_simplefb_configure_node (void *blob,int off) +static int fdt_simplefb_configure_node (void *blob,int off) {int xsize, ysize;int bpix;/* log2 of bits per pixel */ @@ -58,7 +58,7 @@ static int lcd_dt_simplefb_configure_node(void *blob, int off) xsize * (1 << bpix) / 8, name); } -int lcd_dt_simplefb_add_node (void *blob) +int fdt_simplefb_add_node (void *blob) {static const char compat[] ="simple-framebuffer" ;static const char disabled[] ="disabled" ;@@ -76,10 +76,10 @@ int lcd_dt_simplefb_add_node(void *blob)if (ret <0 )return -1 ; -return lcd_dt_simplefb_configure_node (blob, off); +return fdt_simplefb_configure_node (blob, off); } -int lcd_dt_simplefb_enable_existing_node (void *blob) +int fdt_simplefb_enable_existing_node (void *blob) {int off;@@ -87,5 +87,5 @@ int lcd_dt_simplefb_enable_existing_node(void *blob)if (off <0 )return -1 ; -return lcd_dt_simplefb_configure_node (blob, off); +return fdt_simplefb_configure_node (blob, off); }include/fdt_simplefb.h +2
-2@@ -8,6 +8,6 @@#ifndef _FDT_SIMPLEFB_H_#define _FDT_SIMPLEFB_H_ -int lcd_dt_simplefb_add_node (void *blob); -int lcd_dt_simplefb_enable_existing_node (void *blob); +int fdt_simplefb_add_node (void *blob); +int fdt_simplefb_enable_existing_node (void *blob);#endif
PATCH 4/7 video: Add video_is_active function
In reply to Patrick DelaunayAdd the helper function video_is_active() to test if one video device is active.
This function can be used in board code to execute operation only when the display is probed / really used.
---
drivers/video/video-uclass.c | 14 ++++++++++++++ include/video.h | 7 +++++++ 2 files changed, 21 insertions(+)
drivers/video/video-uclass.c +14 -0
@@ -228,6 +228,20 @@ void video_sync_all(void) } } +bool video_is_active (void ) +{ +struct udevice *dev; + +for (uclass_find_first_device (UCLASS_VIDEO , &dev); + dev; +uclass_find_next_device (&dev)) { +if (device_active (dev)) +return true; + } + +return false; +} +int video_get_xsize (struct udevice *dev) {struct video_priv *priv =dev_get_uclass_priv (dev);
include/video.h +7 -0
@@ -276,6 +276,13 @@ static inline int video_sync_copy_all(struct udevice *dev)#endif +/** +* video_is_active() - Test if one video device it active +* +* @return true if at least one video device is active, else false. +*/ +bool video_is_active (void ); +#ifndef CONFIG_DM_VIDEO /* Video functions */
Signature · 1 line
2.25.1
Re: [Uboot-stm32] [PATCH 4/7] video: Add video_is_active function
Hi Patrick
Quoted 47 lines · Patrick Delaunay
Add the helper function
video_is_active()to test if one video device is active.This function can be used in board code to execute operation only when the display is probed / really used.
Signed-off-by Patrick Delaunay <[email protected]>---
drivers/video/video-uclass.c | 14 ++++++++++++++ include/video.h | 7 +++++++ 2 files changed, 21 insertions(+)drivers/video/video-uclass.c +14
-0@@ -228,6 +228,20 @@ void video_sync_all(void) } } +bool video_is_active (void ) +{ +struct udevice *dev; + +for (uclass_find_first_device (UCLASS_VIDEO , &dev); + dev; +uclass_find_next_device (&dev)) { +if (device_active (dev)) +return true; + } + +return false; +} +int video_get_xsize (struct udevice *dev) {struct video_priv *priv =dev_get_uclass_priv (dev);include/video.h +0
-0@@ -276,6 +276,13 @@ static inline int video_sync_copy_all(struct udevice *dev)#endif
include/video.h static inline int video_sync_copy_all(struct udevice *dev) · line 288
Quoted 10 lines
include/video.h +7
-0+/** +* video_is_active() - Test if one video device it active +* +* @return true if at least one video device is active, else false. +*/ +bool video_is_active (void ); +#ifndef CONFIG_DM_VIDEO /* Video functions */
Thanks
Patrice
PATCH 5/7 common: add fdt_simplefb_enable_and_mem_rsv function
In reply to Patrick DelaunayAdd a new function to activate an existing simple frame buffer node and add the associated reserved memory, with no-map properties.
This device tree update is only done when the video device is active and the video buffer is used.
This patch uses '#if CONFIG_IS_ENABLED(DM_VIDEO)' because gd->video_bottom and gd->video_top are only defined when CONFIG_DM_VIDEO is activated.
---
common/fdt_simplefb.c | 27 +++++++++++++++++++++++++++ include/fdt_simplefb.h | 1 + 2 files changed, 28 insertions(+)
common/fdt_simplefb.c +27 -0
@@ -89,3 +89,30 @@ int fdt_simplefb_enable_existing_node(void *blob)return fdt_simplefb_configure_node (blob, off); } + +#if CONFIG_IS_ENABLED (DM_VIDEO ) +int fdt_simplefb_enable_and_mem_rsv (void *blob) +{ +struct fdt_memory mem; +int ret; + +/* nothing to do when video is not active */ +if (!video_is_active ()) +return 0 ; + + ret =fdt_simplefb_enable_existing_node (blob); +if (ret) +return ret; + +/* nothing to do when the frame buffer is not defined */ +if (gd->video_bottom == gd->video_top) +return 0 ; + +/* reserved with no-map tag the video buffer */ + mem.start = gd->video_bottom; + mem.end = gd->video_top -1 ; + +return fdtdec_add_reserved_memory (blob,"framebuffer" , &mem,NULL ,0 ,NULL , +FDTDEC_RESERVED_MEMORY_NO_MAP ); +} +#endif
include/fdt_simplefb.h +1 -0
@@ -10,4 +10,5 @@#define _FDT_SIMPLEFB_H_int fdt_simplefb_add_node (void *blob);int fdt_simplefb_enable_existing_node (void *blob); +int fdt_simplefb_enable_and_mem_rsv (void *blob);#endif
Signature · 1 line
2.25.1
Re: [Uboot-stm32] [PATCH 5/7] common: add fdt_simplefb_enable_and_mem_rsv function
Hi Patrick
Quoted 58 lines · Patrick Delaunay
Add a new function to activate an existing simple frame buffer node and add the associated reserved memory, with no-map properties.
This device tree update is only done when the video device is active and the video buffer is used.
This patch uses '#if
CONFIG_IS_ENABLED(DM_VIDEO)' becausegd->video_bottomandgd->video_topare only defined whenCONFIG_DM_VIDEOis activated.Signed-off-by Patrick Delaunay <[email protected]>---
common/fdt_simplefb.c | 27 +++++++++++++++++++++++++++ include/fdt_simplefb.h | 1 + 2 files changed, 28 insertions(+)common/fdt_simplefb.c +27
-0@@ -89,3 +89,30 @@ int fdt_simplefb_enable_existing_node(void *blob)return fdt_simplefb_configure_node (blob, off); } + +#if CONFIG_IS_ENABLED (DM_VIDEO ) +int fdt_simplefb_enable_and_mem_rsv (void *blob) +{ +struct fdt_memory mem; +int ret; + +/* nothing to do when video is not active */ +if (!video_is_active ()) +return 0 ; + + ret =fdt_simplefb_enable_existing_node (blob); +if (ret) +return ret; + +/* nothing to do when the frame buffer is not defined */ +if (gd->video_bottom == gd->video_top) +return 0 ; + +/* reserved with no-map tag the video buffer */ + mem.start = gd->video_bottom; + mem.end = gd->video_top -1 ; + +return fdtdec_add_reserved_memory (blob,"framebuffer" , &mem,NULL ,0 ,NULL , +FDTDEC_RESERVED_MEMORY_NO_MAP ); +} +#endif include/fdt_simplefb.h +0
-0
include/fdt_simplefb.h line 14
Quoted 5 lines
include/fdt_simplefb.h +1
-0@@ -10,4 +10,5 @@#define _FDT_SIMPLEFB_H_int fdt_simplefb_add_node (void *blob);int fdt_simplefb_enable_existing_node (void *blob); +int fdt_simplefb_enable_and_mem_rsv (void *blob);#endif
Thanks
Patrice
PATCH 6/7 video: stm32: stm32_ltdc: align framebuffer on 2MB
In reply to Patrick DelaunayAlign the framebuffer size on MMU_SECTION_SIZE in kernel, = max 2MB for LPAE for armV7, to avoid issue with the simple frame buffer activation, when U-Boot add a reserved memory in the kernel device tree to preserve the splash screen until Linux driver initialization.
See Linux documentation for details:Documentation/devicetree/bindings/display/simple-framebuffer.yaml
---
drivers/video/stm32/stm32_ltdc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/video/stm32/stm32_ltdc.c +4 -1
@@ -459,7 +459,10 @@ static int stm32_ltdc_bind(struct udevice *dev) uc_plat->size =CONFIG_VIDEO_STM32_MAX_XRES *CONFIG_VIDEO_STM32_MAX_YRES * (CONFIG_VIDEO_STM32_MAX_BPP >>3 ); -dev_dbg (dev,"frame buffer max size %d bytes\n" , uc_plat->size); +/* align framebuffer on kernel MMU_SECTION_SIZE = max 2MB for LPAE */ + uc_plat->align =SZ_2M ; +dev_dbg (dev,"frame buffer max size %d bytes align %x\n" , + uc_plat->size, uc_plat->align);return 0 ; }
Signature · 1 line
2.25.1
Re: [PATCH 6/7] video: stm32: stm32_ltdc: align framebuffer on 2MB
Hi Patrick
Quoted 21 lines · Patrick Delaunay
Align the framebuffer size on
MMU_SECTION_SIZEin kernel, = max 2MB for LPAE for armV7, to avoid issue with the simple frame buffer activation, when U-Boot add a reserved memory in the kernel device tree to preserve the splash screen until Linux driver initialization.See Linux documentation for details:
Documentation/devicetree/bindings/display/simple-framebuffer.yamlSigned-off-by Patrick Delaunay <[email protected]>---
drivers/video/stm32/stm32_ltdc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/video/stm32/stm32_ltdc.c +0
-0@@ -459,7 +459,10 @@ static int stm32_ltdc_bind(struct udevice *dev) uc_plat->size = CONFIG_VIDEO_STM32_MAX_XRES *
drivers/video/stm32/stm32_ltdc.c static int stm32_ltdc_bind(struct udevice *dev) · line 468
Quoted 10 lines
drivers/video/stm32/stm32_ltdc.c +4
-1CONFIG_VIDEO_STM32_MAX_YRES * (CONFIG_VIDEO_STM32_MAX_BPP >>3 ); -dev_dbg (dev,"frame buffer max size %d bytes\n" , uc_plat->size); +/* align framebuffer on kernel MMU_SECTION_SIZE = max 2MB for LPAE */ + uc_plat->align =SZ_2M ; +dev_dbg (dev,"frame buffer max size %d bytes align %x\n" , + uc_plat->size, uc_plat->align);return 0 ; }
Thanks
Patrice
PATCH 7/7 board: stm32mp1: enable simple framebuffer node for splashscreen
In reply to Patrick DelaunayEnable an existing simple framebuffer node in the Linux kernel device tree and the add the associated reserved memory node to preserved the resources (clock, memory) used by the stm32 video driver to display the splashscreen = background in exlinux.conf file.
These resources will be released by the Linux driver only when the associated driver is ready to avoid transition issues during the Linux kernel initialization between U-Boot splash screen and the final display.
See Linux documentation for details:Documentation/devicetree/bindings/display/simple-framebuffer.yaml
---
board/st/stm32mp1/stm32mp1.c | 4 ++++ configs/stm32mp15_basic_defconfig | 1 + configs/stm32mp15_defconfig | 1 + configs/stm32mp15_trusted_defconfig | 1 + 4 files changed, 7 insertions(+)
board/st/stm32mp1/stm32mp1.c +4 -0
@@ -13,6 +13,7 @@#include <dm.h> #include <env.h> #include <env_internal.h> +#include <fdt_simplefb.h> #include <fdt_support.h> #include <g_dnl.h> #include <generic-phy.h>
@@ -914,6 +915,9 @@ int ft_board_setup(void *blob, struct bd_info *bd)if (IS_ENABLED (CONFIG_FDT_FIXUP_PARTITIONS ))fdt_fixup_mtdparts (blob, nodes,ARRAY_SIZE (nodes)); +if (CONFIG_IS_ENABLED (FDT_SIMPLEFB )) +fdt_simplefb_enable_and_mem_rsv (blob); + return 0; }#endif
configs/stm32mp15_basic_defconfig +1 -0
@@ -34,6 +34,7 @@ CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER=y CONFIG_SPL_SPI_FLASH_MTD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000 +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="STM32MP> " CONFIG_CMD_ADTIMG=y CONFIG_CMD_ERASEENV=y
configs/stm32mp15_defconfig +1 -0
@@ -19,6 +19,7 @@ CONFIG_SYS_LOAD_ADDR=0xc2000000 CONFIG_FIT=y CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="STM32MP> " CONFIG_CMD_ADTIMG=y CONFIG_CMD_ERASEENV=y
configs/stm32mp15_trusted_defconfig +1 -0
@@ -20,6 +20,7 @@ CONFIG_SYS_LOAD_ADDR=0xc2000000 CONFIG_FIT=y CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="STM32MP> " CONFIG_CMD_ADTIMG=y CONFIG_CMD_ERASEENV=y
Signature · 1 line
2.25.1
Re: [PATCH 7/7] board: stm32mp1: enable simple framebuffer node for splashscreen
Hi Patrick
Quoted 73 lines · Patrick Delaunay
Enable an existing simple framebuffer node in the Linux kernel device tree and the add the associated reserved memory node to preserved the resources (clock, memory) used by the stm32 video driver to display the splashscreen = background in exlinux.conf file.
These resources will be released by the Linux driver only when the associated driver is ready to avoid transition issues during the Linux kernel initialization between U-Boot splash screen and the final display.
See Linux documentation for details:
Documentation/devicetree/bindings/display/simple-framebuffer.yamlSigned-off-by Patrick Delaunay <[email protected]>---
board/st/stm32mp1/stm32mp1.c | 4 ++++ configs/stm32mp15_basic_defconfig | 1 + configs/stm32mp15_defconfig | 1 + configs/stm32mp15_trusted_defconfig | 1 + 4 files changed, 7 insertions(+)board/st/stm32mp1/stm32mp1.c +4
-0@@ -13,6 +13,7 @@#include <dm.h> #include <env.h> #include <env_internal.h> +#include <fdt_simplefb.h> #include <fdt_support.h> #include <g_dnl.h> #include <generic-phy.h> @@ -914,6 +915,9 @@ int ft_board_setup(void *blob, struct bd_info *bd)if (IS_ENABLED (CONFIG_FDT_FIXUP_PARTITIONS ))fdt_fixup_mtdparts (blob, nodes,ARRAY_SIZE (nodes)); +if (CONFIG_IS_ENABLED (FDT_SIMPLEFB )) +fdt_simplefb_enable_and_mem_rsv (blob); + return 0; }#endif configs/stm32mp15_basic_defconfig +1
-0@@ -34,6 +34,7 @@ CONFIG_SPL_DM_SPI_FLASH=y CONFIG_SPL_POWER=y CONFIG_SPL_SPI_FLASH_MTD=y CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000 +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="STM32MP> " CONFIG_CMD_ADTIMG=y CONFIG_CMD_ERASEENV=yconfigs/stm32mp15_defconfig +1
-0@@ -19,6 +19,7 @@ CONFIG_SYS_LOAD_ADDR=0xc2000000 CONFIG_FIT=y CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="STM32MP> " CONFIG_CMD_ADTIMG=y CONFIG_CMD_ERASEENV=yconfigs/stm32mp15_trusted_defconfig +0
-0
configs/stm32mp15_trusted_defconfig CONFIG_SYS_LOAD_ADDR=0xc2000000 · line 26
Quoted 7 lines
configs/stm32mp15_trusted_defconfig +1
-0@@ -20,6 +20,7 @@ CONFIG_SYS_LOAD_ADDR=0xc2000000 CONFIG_FIT=y CONFIG_BOOTDELAY=1 CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" +CONFIG_FDT_SIMPLEFB=y CONFIG_SYS_PROMPT="STM32MP> " CONFIG_CMD_ADTIMG=y CONFIG_CMD_ERASEENV=y
Thanks
Patrice
Hi Patrick
Quoted 52 lines · Patrick Delaunay
Use simple framebuffer node in the Linux kernel device tree to preserved the resources (clock, memory) used by the stm32 video driver to display the splashscreen.
See Linux documentation for details:
Documentation/devicetree/bindings/display/simple-framebuffer.yamlThe 3 first commits of the series are cleanup steps:
migration toKconfigand rename files and function tofdt_simplefb_(it seems like a good time time as this function is only used today
in RPI boards)patch 4 is a preliminary step = add
video_is_activefunctionpatch 5 add a new API
fdt_simplefb_enable_and_mem_rsvto activate node and add reserved memory for video memorypatch 6 avoid a issue in kernel when the reserved video memory by LTDC driver is not aligned with Linux kernel
MMU_SECTION_SIZEpatch 7 use this new function in stm32mp1 code for STMicroelectronics boards when the simple-framebuffer node is present in Linux device tree
Patrick Delaunay (7):
ConvertCONFIG_LCD_DT_SIMPLEFBtoKconfig
common: renamelcd_simplefb.cfile tofdt_simplefb.c
common: rename functionslcd_dt_simplefbtofdt_simplefb
video: Addvideo_is_activefunction
common: addfdt_simplefb_enable_and_mem_rsvfunction
video: stm32:stm32_ltdc: align framebuffer on 2MB
board: stm32mp1: enable simple framebuffer node for splashscreenboard/raspberrypi/rpi/rpi.c | 2 +- board/st/stm32mp1/stm32mp1.c | 4 +++ common/Kconfig | 9 ++++++ common/Makefile | 2 +- common/{lcd_simplefb.c => fdt_simplefb.c} | 37 ++++++++++++++++++++--- configs/rpi_0_w_defconfig | 1 + configs/rpi_2_defconfig | 1 + configs/rpi_3_32b_defconfig | 1 + configs/rpi_3_b_plus_defconfig | 1 + configs/rpi_3_defconfig | 1 + configs/rpi_4_32b_defconfig | 1 + configs/rpi_4_defconfig | 1 + configs/rpi_arm64_defconfig | 1 + configs/rpi_defconfig | 1 + configs/stm32mp15_basic_defconfig | 1 + configs/stm32mp15_defconfig | 1 + configs/stm32mp15_trusted_defconfig | 1 +
Quoted 9 lines
drivers/video/stm32/stm32_ltdc.c | 5 ++-
drivers/video/video-uclass.c | 14 +++++++++
include/configs/rpi.h | 1 -
include/fdt_simplefb.h | 5 +--
include/video.h | 7 +++++
scripts/config_whitelist.txt | 1 -
23 files changed, 87 insertions(+), 12 deletions(-)
rename common/{lcd_simplefb.c => fdt_simplefb.c} (65%)For the series, applied to u-boot-stm32/next
Thanks
Patrice