From e66ab84fa74daee2b24acad9bbba62b00d97b762 Mon Sep 17 00:00:00 2001 From: vhaudiquet Date: Sun, 30 Aug 2026 16:10:36 +0200 Subject: [PATCH] WIP (temporary): bind/probe checkpoints in scanout driver and video uclass --- drivers/video/mt8183_scanout.c | 40 ++++++++++++++++++++++++++++++---- drivers/video/video-uclass.c | 21 ++++++++++++++++++ 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/drivers/video/mt8183_scanout.c b/drivers/video/mt8183_scanout.c index dc342b93e2c..26eb385cd64 100644 --- a/drivers/video/mt8183_scanout.c +++ b/drivers/video/mt8183_scanout.c @@ -40,6 +40,27 @@ #define DISP_REG_OVL_EN 0x000c #define DISP_REG_OVL0_2L_EN 0x100c +/* TEMPORARY bring-up diagnostics (krane Round 24) — do not upstream: + * paint a band into the live depthcharge scanout. */ +static void krane_diag_band(u32 y0, u32 rows, u32 color) +{ + u32 base = readl((void __iomem *)0x14008f40); + u32 *p, n = rows * 1200, i; + + if (base < 0x40000000) + return; + + if (dcache_status()) + mmu_map_region(base, 0x8ca000, false); + + p = (u32 *)(uintptr_t)(base + (u64)y0 * 4800); + for (i = 0; i < n; i++) + p[i] = color; + + if (dcache_status()) + flush_dcache_range((uintptr_t)p, (uintptr_t)(p + n)); +} + /* * Backlight GPIOs. The MT8183 GPIO controller is at 0x10005000; the dout * block starts at +0x100 with 16 bytes per 32-pin group and set@+4 (layout @@ -147,9 +168,13 @@ static int mt8183_scanout_probe(struct udevice *dev) u64 addr; int ret; + krane_diag_band(500, 40, 0x00ff00ff); /* magenta: probe entered */ + ovl = dev_read_addr(dev); - if (ovl == FDT_ADDR_T_NONE) + if (ovl == FDT_ADDR_T_NONE) { + krane_diag_band(780, 40, 0x00ff0000); /* red: ovl read failed */ return log_msg_ret("ovl", -EINVAL); + } /* * Revive the pipeline: undo depthcharge's display_cleanup() by @@ -171,13 +196,17 @@ static int mt8183_scanout_probe(struct udevice *dev) mmu_map_region(COREBOOT_TABLE_ADDR, SZ_4K, false); ret = find_framebuffer(COREBOOT_TABLE_ADDR, &fb); - if (ret) + if (ret) { + krane_diag_band(800, 40, 0x00ff0000); /* red: lbio failed */ return log_msg_ret("lbio", ret); + } if (fb.bits_per_pixel != 32 || fb.red_pos != 16 || fb.red_size != 8 || fb.green_pos != 8 || fb.green_size != 8 || - fb.blue_pos != 0 || fb.blue_size != 8) + fb.blue_pos != 0 || fb.blue_size != 8) { + krane_diag_band(820, 40, 0x00ff0000); /* red: fmt mismatch */ return log_msg_ret("fmt", -ENOTSUPP); + } /* * Use the address from the coreboot table when it is a plausible @@ -189,8 +218,11 @@ static int mt8183_scanout_probe(struct udevice *dev) if (addr < SZ_1G) addr = readl(ovl + DISP_REG_OVL_L0_ADDR); - if (addr < SZ_1G) + if (addr < SZ_1G) { + krane_diag_band(840, 40, 0x00ff0000); /* red: no scanout addr */ return log_msg_ret("scanout", -ENODEV); + } + krane_diag_band(620, 40, 0x00aaaaaa); /* gray: geometry resolved */ plat->base = addr; plat->size = fb.bytes_per_line * fb.y_resolution; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 068653ced8d..9e661c2aa06 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -782,6 +782,27 @@ static int video_post_probe(struct udevice *dev) /* Post-relocation, allocate memory for the frame buffer */ static int video_post_bind(struct udevice *dev) { + /* TEMPORARY bring-up diagnostics (krane Round 24) — do not upstream: + * purple band = a video device got bound (driver matched the DT + * node); runs before any probe. */ + { + u32 base = readl((void __iomem *)0x14008f40); + + if (base >= 0x40000000) { + u32 *p = (u32 *)(uintptr_t)(base + 470ULL * 4800); + int i; + + if (dcache_status()) + mmu_map_region(base, 0x8ca000, false); + for (i = 0; i < 30 * 1200; i++) + p[i] = 0x008000ff; + if (dcache_status()) + flush_dcache_range((uintptr_t)p, + (uintptr_t)(p + 30 * 1200)); + } + } + /* end TEMPORARY diagnostics */ + struct video_uc_priv *uc_priv; ulong addr; ulong size;