From c3d2e9c593c9f30a82bd94375aaac2f9cd6a16fa Mon Sep 17 00:00:00 2001 From: Rex-BC Chen Date: Thu, 4 Aug 2022 17:11:22 +0800 Subject: [PATCH] soc/mediatek/mt8188: Initialize DFD DFD (Design for Debug) is a debugging tool, which scans flip-flops and dumps to internal RAM on the WDT reset. After system reboots, those values can be shown for debugging using MTK internal parsing tools. TEST=build pass BUG=b:236331724 Signed-off-by: Bo-Chen Chen Change-Id: I6d19dc6f4e47ed69ba2ea87c79984020a413aee9 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66586 Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/mt8188/Makefile.inc | 1 + src/soc/mediatek/mt8188/soc.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc index c1caf3a69a..d76e6f3d77 100644 --- a/src/soc/mediatek/mt8188/Makefile.inc +++ b/src/soc/mediatek/mt8188/Makefile.inc @@ -25,6 +25,7 @@ romstage-y += ../common/pmif_spmi.c pmif_spmi.c romstage-y += ../common/rtc.c ../common/rtc_osc_init.c ../common/rtc_mt6359p.c ramstage-y += ../common/auxadc.c +ramstage-y += ../common/dfd.c ramstage-y += emi.c ramstage-y += ../common/mcu.c ramstage-y += ../common/mcupm.c diff --git a/src/soc/mediatek/mt8188/soc.c b/src/soc/mediatek/mt8188/soc.c index 6066de476b..5b2431bc25 100644 --- a/src/soc/mediatek/mt8188/soc.c +++ b/src/soc/mediatek/mt8188/soc.c @@ -1,12 +1,20 @@ /* SPDX-License-Identifier: GPL-2.0-only OR MIT */ +#include #include +#include #include #include #include #include #include +void bootmem_platform_add_ranges(void) +{ + if (CONFIG(MTK_DFD)) + bootmem_add_range(DFD_DUMP_ADDRESS, DFD_DUMP_SIZE, BM_MEM_RESERVED); +} + static void soc_read_resources(struct device *dev) { ram_range(dev, 0, (uintptr_t)_dram, sdram_size()); @@ -17,6 +25,9 @@ static void soc_init(struct device *dev) mtk_mmu_disable_l2c_sram(); mcupm_init(); sspm_init(); + + if (CONFIG(MTK_DFD)) + dfd_init(); } static struct device_operations soc_ops = {