soc/mediatek/mt8188: Add tracker dump

Tracker is a debugging tool. When bus timeout occurs, the system will
reboot and latch some values of tracker registers which could be used
for debugging.

This function will be triggered only when it encounters the bus
hanging issue.

TEST=build pass
BUG=b:236331724

Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com>
Change-Id: I78f676c08ea44e9bb10bd99bbfed70e3e8ece993
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66584
Reviewed-by: Yidi Lin <yidilin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc
index d82b19c..c1caf3a 100644
--- a/src/soc/mediatek/mt8188/Makefile.inc
+++ b/src/soc/mediatek/mt8188/Makefile.inc
@@ -10,6 +10,7 @@
 
 bootblock-y += bootblock.c
 bootblock-y += ../common/mmu_operations.c
+bootblock-y += ../common/tracker.c ../common/tracker_v2.c
 bootblock-y += ../common/wdt.c ../common/wdt_req.c wdt.c
 
 romstage-y += ../common/cbmem.c
diff --git a/src/soc/mediatek/mt8188/bootblock.c b/src/soc/mediatek/mt8188/bootblock.c
index e7ff97ae..75fab9a 100644
--- a/src/soc/mediatek/mt8188/bootblock.c
+++ b/src/soc/mediatek/mt8188/bootblock.c
@@ -3,11 +3,13 @@
 #include <bootblock_common.h>
 #include <soc/mmu_operations.h>
 #include <soc/pll.h>
+#include <soc/tracker_common.h>
 #include <soc/wdt.h>
 
 void bootblock_soc_init(void)
 {
 	mtk_mmu_init();
+	bustracker_init();
 	mtk_wdt_init();
 	mt_pll_init();
 }
diff --git a/src/soc/mediatek/mt8188/include/soc/addressmap.h b/src/soc/mediatek/mt8188/include/soc/addressmap.h
index 3ae61fa..e117f74 100644
--- a/src/soc/mediatek/mt8188/include/soc/addressmap.h
+++ b/src/soc/mediatek/mt8188/include/soc/addressmap.h
@@ -11,6 +11,7 @@
 	MCUSYS_BASE		= 0x0C530000,
 	MCUPM_SRAM_BASE		= 0x0C540000,
 	MCUPM_CFG_BASE		= 0x0C560000,
+	BUS_TRACE_MONITOR_BASE  = 0x0D040000,
 	IO_PHYS			= 0x10000000,
 	MCUCFG_BASE		= MCUSYS_BASE + 0x00008000,
 };
@@ -30,6 +31,8 @@
 	PMICSPI_MST_BASE	= IO_PHYS + 0x00025000,
 	PMIF_SPMI_BASE		= IO_PHYS + 0x00027000,
 	SPMI_MST_BASE		= IO_PHYS + 0x00029000,
+	DBG_TRACKER_BASE	= IO_PHYS + 0x00208000,
+	PERI_TRACKER_BASE	= IO_PHYS + 0x00218000,
 	EMI0_BASE		= IO_PHYS + 0x00219000,
 	EMI1_BASE		= IO_PHYS + 0x0021D000,
 	I2C0_DMA_BASE		= IO_PHYS + 0x00220080,
@@ -41,6 +44,7 @@
 	I2C6_DMA_BASE		= IO_PHYS + 0x00220600,
 	SCP_ADSP_CFG_BASE	= IO_PHYS + 0x00720000,
 	DRAMC_CHA_AO_BASE	= IO_PHYS + 0x00230000,
+	INFRA_TRACKER_BASE	= IO_PHYS + 0x00314000,
 	SSPM_SRAM_BASE          = IO_PHYS + 0x00400000,
 	SSPM_CFG_BASE		= IO_PHYS + 0x00440000,
 	DPM_PM_SRAM_BASE	= IO_PHYS + 0x00900000,
diff --git a/src/soc/mediatek/mt8188/include/soc/tracker.h b/src/soc/mediatek/mt8188/include/soc/tracker.h
new file mode 100644
index 0000000..6555d70
--- /dev/null
+++ b/src/soc/mediatek/mt8188/include/soc/tracker.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef SOC_MEDIATEK_MT8188_TRACKER_H
+#define SOC_MEDIATEK_MT8188_TRACKER_H
+
+#include <soc/tracker_v2.h>
+
+#endif