diff --git a/board/mediatek/mt8183/mt8183.c b/board/mediatek/mt8183/mt8183.c index 1b8736966f6..ae342e3ddcc 100644 --- a/board/mediatek/mt8183/mt8183.c +++ b/board/mediatek/mt8183/mt8183.c @@ -4,6 +4,64 @@ * Author: Fabien Parent */ +/* + * TEMPORARY bring-up diagnostics (krane Round 13) — do not upstream. + * Paint colored bands into the live depthcharge scanout as early-init + * checkpoints: full green = wrapper (before U-Boot), orange top band = + * board_early_init_f, blue bottom band = dram_init_banksize, red top + * band = board_early_init_r. The last one reached localizes the crash; + * a successful video probe clears the screen for the banner. + */ +#include +#include +#include +#include + +#define DIAG_OVL_L0_ADDR 0x14008f40 +#define DIAG_FB_WIDTH 1200 +#define DIAG_FB_BPL 4800 +#define DIAG_FB_SIZE 0x8ca000 + +static void diag_paint(u32 y0, u32 rows, u32 color) +{ + u32 base = readl((void __iomem *)DIAG_OVL_L0_ADDR); + u32 *p, n = rows * DIAG_FB_WIDTH, i; + + if (base < 0x40000000) + return; + + if (dcache_status()) + mmu_map_region(base, DIAG_FB_SIZE, false); + + p = (u32 *)(uintptr_t)(base + (u64)y0 * DIAG_FB_BPL); + for (i = 0; i < n; i++) + p[i] = color; + + if (dcache_status()) + flush_dcache_range((uintptr_t)p, + (uintptr_t)(p + n)); +} + +int board_early_init_f(void) +{ + diag_paint(0, 100, 0x00ff8000); /* orange */ + return 0; +} + +void dram_init_banksize(void) +{ + fdtdec_setup_memory_banksize(); + diag_paint(1820, 100, 0x000000ff); /* blue */ +} + +int board_early_init_r(void) +{ + diag_paint(0, 100, 0x00ff0000); /* red */ + return 0; +} + +/* end TEMPORARY diagnostics */ + #include #include diff --git a/configs/mt8183_kukui_krane_defconfig b/configs/mt8183_kukui_krane_defconfig index 85c327f87dd..f97389fc95b 100644 --- a/configs/mt8183_kukui_krane_defconfig +++ b/configs/mt8183_kukui_krane_defconfig @@ -35,6 +35,8 @@ CONFIG_HUSH_PARSER=y # CONFIG_CMD_GO is not set # CONFIG_CMD_IMI is not set CONFIG_BOOTDELAY=-1 +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_BOARD_EARLY_INIT_R=y # CONFIG_CMD_XIMG is not set # CONFIG_CMD_EXPORTENV is not set # CONFIG_CMD_IMPORTENV is not set