summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/common/include
diff options
context:
space:
mode:
authorot_zhenguo.li <ot_zhenguo.li@mediatek.corp-partner.google.com>2023-02-24 13:55:27 +0800
committerRex-BC Chen <rex-bc.chen@mediatek.com>2023-03-10 12:38:31 +0000
commit6bd9d959ddc3fabd84c57de41c6a1db7c400f562 (patch)
tree711884a36cf424ad1d35cc4874211596a8866e26 /src/soc/mediatek/common/include
parentc9bf43f4d6caa4b59a6eaff8fff2929c609c6122 (diff)
soc/mediatek/mt8188: Enable lastbus debug hardware
Lastbus is a bus debug tool. When the bus hangs, the bus transmission information before resetting will be recorded. The watchdog cannot clear it and it will be printed out for bus hanging analysis. There are two versions for lastbus: Version 1 for MT8186, and version 2 for MT8188. BUG=b:263753374 TEST=build pass. Change-Id: Ibaf510481d1941376bd8da0168ef17c99a0fb9a2 Signed-off-by: ot_zhenguo.li <ot_zhenguo.li@mediatek.corp-partner.google.com> Signed-off-by: jason-ch chen <Jason-ch.Chen@mediatek.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/73624 Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com> Reviewed-by: Yidi Lin <yidilin@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/soc/mediatek/common/include')
-rw-r--r--src/soc/mediatek/common/include/soc/lastbus_v1.h (renamed from src/soc/mediatek/common/include/soc/lastbus.h)4
-rw-r--r--src/soc/mediatek/common/include/soc/lastbus_v2.h40
2 files changed, 42 insertions, 2 deletions
diff --git a/src/soc/mediatek/common/include/soc/lastbus.h b/src/soc/mediatek/common/include/soc/lastbus_v1.h
index 3c93efbf60..bd6cd86776 100644
--- a/src/soc/mediatek/common/include/soc/lastbus.h
+++ b/src/soc/mediatek/common/include/soc/lastbus_v1.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef SOC_MEDIATEK_COMMON_LASTBUS_H
-#define SOC_MEDIATEK_COMMON_LASTBUS_H
+#ifndef SOC_MEDIATEK_COMMON_LASTBUS_V1_H
+#define SOC_MEDIATEK_COMMON_LASTBUS_V1_H
/* INFRA LASTBUS INFO */
#define BUS_INFRA_SNAPSHOT 0xd00
diff --git a/src/soc/mediatek/common/include/soc/lastbus_v2.h b/src/soc/mediatek/common/include/soc/lastbus_v2.h
new file mode 100644
index 0000000000..d58da76b57
--- /dev/null
+++ b/src/soc/mediatek/common/include/soc/lastbus_v2.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef SOC_MEDIATEK_COMMON_LASTBUS_V2_H
+#define SOC_MEDIATEK_COMMON_LASTBUS_V2_H
+
+#define NR_MAX_LASTBUS_IDLE_MASK 8
+#define NR_MAX_LASTBUS_MONITOR 16
+#define TIMEOUT_THRES_SHIFT 16
+#define TIMEOUT_TYPE_SHIFT 1
+#define LASTBUS_TIMEOUT_CLR 0x0200
+#define LASTBUS_DEBUG_CKEN 0x0008
+#define LASTBUS_DEBUG_EN 0x0004
+#define LASTBUS_TIMEOUT 0x0001
+
+struct lastbus_idle_mask {
+ u32 reg_offset;
+ u32 reg_value;
+};
+
+struct lastbus_monitor {
+ const char *name;
+ uintptr_t base;
+ size_t num_ports;
+ u16 bus_freq_mhz;
+ size_t num_idle_mask;
+ struct lastbus_idle_mask idle_masks[NR_MAX_LASTBUS_IDLE_MASK];
+};
+
+struct lastbus_config {
+ const char *latch_platform;
+ unsigned int timeout_ms;
+ unsigned int timeout_type;
+ unsigned int num_used_monitors;
+ struct lastbus_monitor monitors[NR_MAX_LASTBUS_MONITOR];
+};
+
+void lastbus_init(void);
+extern const struct lastbus_config lastbus_cfg;
+
+#endif