From 61be50dafb308f4b54a4ec329c324e2c89048f98 Mon Sep 17 00:00:00 2001 From: Rex-BC Chen Date: Tue, 10 Aug 2021 12:39:32 +0800 Subject: soc/mediatek/mt8195: 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 could be showed for debugging. BUG=b:192429713 Signed-off-by: Rex-BC Chen Change-Id: Ied63913db94b2e52ab394a66c70f7edfd507c99b Reviewed-on: https://review.coreboot.org/c/coreboot/+/57980 Reviewed-by: Rex-BC Chen Reviewed-by: Hung-Te Lin Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/mt8195/Makefile.inc | 1 + src/soc/mediatek/mt8195/include/soc/dfd.h | 12 ++++++++++++ src/soc/mediatek/mt8195/soc.c | 12 ++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/soc/mediatek/mt8195/include/soc/dfd.h (limited to 'src/soc/mediatek/mt8195') diff --git a/src/soc/mediatek/mt8195/Makefile.inc b/src/soc/mediatek/mt8195/Makefile.inc index d15d4760c2..6540ce2288 100644 --- a/src/soc/mediatek/mt8195/Makefile.inc +++ b/src/soc/mediatek/mt8195/Makefile.inc @@ -52,6 +52,7 @@ romstage-y += ../common/rtc.c ../common/rtc_osc_init.c ../common/rtc_mt6359p.c ramstage-y += ../common/auxadc.c ramstage-y += ../common/ddp.c ddp.c ramstage-y += devapc.c +ramstage-y += ../common/dfd.c ramstage-y += ../common/dpm.c ramstage-$(CONFIG_DPM_FOUR_CHANNEL) += dpm_4ch.c ramstage-y += dp_intf.c dptx.c dptx_hal.c diff --git a/src/soc/mediatek/mt8195/include/soc/dfd.h b/src/soc/mediatek/mt8195/include/soc/dfd.h new file mode 100644 index 0000000000..123b568433 --- /dev/null +++ b/src/soc/mediatek/mt8195/include/soc/dfd.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_MEDIATEK_MT8195_DFD_H +#define SOC_MEDIATEK_MT8195_DFD_H + +#include + +/* DFD dump address and size need to be the same as defined in Kernel DTS. */ +#define DFD_DUMP_ADDRESS 0x6A000000 +#define DFD_DUMP_SIZE (1 * MiB) + +#endif diff --git a/src/soc/mediatek/mt8195/soc.c b/src/soc/mediatek/mt8195/soc.c index 638056487b..399196489a 100644 --- a/src/soc/mediatek/mt8195/soc.c +++ b/src/soc/mediatek/mt8195/soc.c @@ -1,7 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include +#include #include #include #include @@ -10,6 +12,12 @@ #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_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size() / KiB); @@ -21,6 +29,10 @@ static void soc_init(struct device *dev) dapc_init(); mcupm_init(); sspm_init(); + + if (CONFIG(MTK_DFD)) + dfd_init(); + ufs_disable_refclk(); hdmi_low_power_setting(); } -- cgit v1.2.3