@@ -4,6 +4,7 @@
* Copyright (C) 2026 Engicam srl
*/
+#include <dt-bindings/gpio/gpio.h>
#include "stm32mp25-u-boot.dtsi"
/ {
@@ -12,6 +13,93 @@
};
};
+/ {
+ panel-lvds {
+ compatible = "ampire,am-1280800w8tzqw-t00h";
+ backlight = <&backlight>;
+ power-supply = <®_3v3>;
+
+ port {
+ lvds_panel_in: endpoint {
+ remote-endpoint = <&lvds_out>;
+ };
+ };
+ };
+};
+
+/*
+ * Displays supported for the splash screen: the Rocktech RK050HR345-CT106A
+ * RGB one and the Ampire AM-1280800W8TZQW-T00H LVDS one. Linux describes
+ * them in devicetree overlays instead, and the board code keeps only the
+ * one selected by the "display" environment variable.
+ */
+<dc {
+ /* RGB output: the pixel clock is the LTDC kernel clock */
+ clocks = <&rcc CK_KER_LTDC>, <&rcc CK_BUS_LTDC>, <&syscfg>, <&lvds>;
+ pinctrl-names = "default", "sleep";
+ pinctrl-0 = <<dc_pins_a>;
+ pinctrl-1 = <<dc_sleep_pins_a>;
+ bootph-all;
+ status = "okay";
+
+ port {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ltdc_out_rgb: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&rgb_panel_in>;
+ };
+
+ ltdc_out_lvds: endpoint@1 {
+ reg = <1>;
+ remote-endpoint = <&lvds_in>;
+ };
+ };
+};
+
+&lvds {
+ status = "okay";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ lvds_in: endpoint {
+ remote-endpoint = <<dc_out_lvds>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+
+ lvds_out: endpoint {
+ remote-endpoint = <&lvds_panel_in>;
+ };
+ };
+ };
+};
+
+&spi1 {
+ display@0 {
+ compatible = "rocktech,rk050hr345-ct106a", "ilitek,ili9806e";
+ reg = <0>;
+ vdd-supply = <®_3v3>;
+ spi-max-frequency = <10000000>;
+ reset-gpios = <&gpiob 6 GPIO_ACTIVE_LOW>;
+ backlight = <&backlight>;
+
+ port {
+ rgb_panel_in: endpoint {
+ remote-endpoint = <<dc_out_rgb>;
+ };
+ };
+ };
+};
+
&usart2 {
bootph-all;
};
@@ -13,3 +13,11 @@
*/
display=rk050hr345-ct106a
extension_overlay_addr=0x90300000
+
+/*
+ * Splash screen, centered: splashfile in the partition 10 of the boot
+ * device or, if missing, the built-in Engicam logo
+ */
+splashfile=splash.bmp
+splashimage=CONFIG_SYS_LOAD_ADDR
+splashpos=m,m
@@ -8,10 +8,17 @@
#include <alist.h>
#include <config.h>
+#include <dm.h>
#include <env.h>
+#include <event.h>
#include <extension_board.h>
#include <log.h>
+#include <splash.h>
+#include <asm/arch/stm32.h>
+#include <asm/arch/sys_proto.h>
+#include <dm/device-internal.h>
#include <dm/ofnode.h>
+#include <dm/uclass-internal.h>
#include <linux/string.h>
int checkboard(void)
@@ -42,6 +49,103 @@ static const char *microgea_get_display(void)
return display;
}
+/*
+ * The U-Boot devicetree describes the displays supported for the splash
+ * screen. Their panel compatible is "<vendor>,<display>", where <display>
+ * is the display fitted on the carrier board.
+ */
+static bool microgea_panel_is_display(struct udevice *panel,
+ const char *display)
+{
+ const char *compat, *model;
+
+ compat = dev_read_string(panel, "compatible");
+ if (!compat)
+ return false;
+
+ model = strchr(compat, ',');
+
+ return model && !strcmp(model + 1, display);
+}
+
+/*
+ * Before the video devices are probed, drop the panels other than the
+ * one of the display fitted on the carrier board, so that the display
+ * controller drives it. If that display is not described, drop the video
+ * devices too, leaving the display controller untouched for Linux.
+ * This must run after the environment is loaded, hence EVT_SETTINGS_R.
+ */
+static int microgea_settings_r(void)
+{
+ const char *display = microgea_get_display();
+ struct udevice *dev, *next;
+ bool found = false;
+ int ret;
+
+ uclass_find_first_device(UCLASS_PANEL, &dev);
+ while (dev) {
+ next = dev;
+ uclass_find_next_device(&next);
+
+ if (display && microgea_panel_is_display(dev, display)) {
+ found = true;
+ } else {
+ ret = device_unbind(dev);
+ if (ret)
+ return ret;
+ }
+
+ dev = next;
+ }
+
+ if (found)
+ return 0;
+
+ while (!uclass_find_first_device(UCLASS_VIDEO, &dev) && dev) {
+ ret = device_unbind(dev);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+EVENT_SPY_SIMPLE(EVT_SETTINGS_R, microgea_settings_r);
+
+#if CONFIG_IS_ENABLED(SPLASH_SOURCE)
+static struct splash_location microgea_splash_locations[] = {
+ {
+ .name = "mmc",
+ .storage = SPLASH_STORAGE_MMC,
+ .flags = SPLASH_STORAGE_FS,
+ },
+};
+
+/*
+ * Load the splash image, "splashfile", from the partition 10 of the
+ * boot MMC device, i.e. the SD card or the eMMC. If not available, fall
+ * back to the built-in logo.
+ */
+int splash_screen_prepare(void)
+{
+ static char devpart[8];
+ u32 bootmode = get_bootmode();
+ unsigned int instance = (bootmode & TAMP_BOOT_INSTANCE_MASK) - 1;
+
+ switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
+ case BOOT_FLASH_SD:
+ case BOOT_FLASH_EMMC:
+ snprintf(devpart, sizeof(devpart), "%u:a", instance);
+ microgea_splash_locations[0].devpart = devpart;
+ if (!splash_source_load(microgea_splash_locations,
+ ARRAY_SIZE(microgea_splash_locations)))
+ return 0;
+ break;
+ }
+
+ return splash_video_logo_load();
+}
+#endif
+
int board_late_init(void)
{
const char *fdt_compat;
@@ -38,6 +38,7 @@ CONFIG_CMD_PWM=y
# CONFIG_CMD_LOADB is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_MTD=y
+CONFIG_CMD_BMP=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_RNG=y
@@ -98,6 +99,20 @@ CONFIG_DM_SPI=y
CONFIG_STM32_OSPI=y
CONFIG_STM32_SPI=y
# CONFIG_OPTEE_TA_AVB is not set
+CONFIG_VIDEO=y
+CONFIG_VIDEO_LOGO=y
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_VIDEO_LCD_ILITEK_ILI9806E=y
+CONFIG_VIDEO_STM32=y
+CONFIG_VIDEO_STM32_LVDS=y
+CONFIG_VIDEO_STM32_MAX_XRES=1280
+CONFIG_VIDEO_STM32_MAX_YRES=854
+CONFIG_SPLASH_SCREEN=y
+CONFIG_SPLASH_SCREEN_ALIGN=y
+CONFIG_SPLASH_SOURCE=y
+CONFIG_BMP_16BPP=y
+CONFIG_BMP_24BPP=y
+CONFIG_BMP_32BPP=y
CONFIG_WDT=y
CONFIG_WDT_STM32MP=y
CONFIG_WDT_ARM_SMC=y
Describe the RGB and LVDS displays in the U-Boot devicetree and show a splash screen on the one selected by the "display" environment variable. The U-Boot devicetree can only be fixed up before relocation, when the environment is not loaded yet. So, once the environment is loaded, unbind the panels not selected before the video devices are probed. If the selected display is not described, as for a display supported by Linux only, unbind the video devices too, so that U-Boot does not touch the display controller. The splash image is loaded from the partition 10 of the boot device, falling back to the built-in Engicam logo. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> --- ...m32mp257d-engicam-microgea-rmm-u-boot.dtsi | 88 +++++++++++++++ board/engicam/stm32mp2/microgea-stm32mp2.env | 8 ++ board/engicam/stm32mp2/stm32mp2.c | 104 ++++++++++++++++++ configs/stm32mp25-microgea-rmm_defconfig | 15 +++ 4 files changed, 215 insertions(+)