drivers/mipi: Add support for KD_KD110N11_51IE panel
[coreboot2.git] / src / soc / mediatek / common / tracker_v2.c
blob0b41605b72a119152825c78a14f71b9fba41b895
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <commonlib/bsd/helpers.h>
4 #include <device/mmio.h>
5 #include <soc/addressmap.h>
6 #include <soc/tracker.h>
7 #include <soc/tracker_common.h>
9 /*
10 * for systracker:
11 * offset[0] dump from offset 0x100 ~ 0x2F8.
12 * offset[1] dump from offset 0x300 ~ 0x4FC
14 * for infra tracker:
15 * offset[0] dump from offset 0x100 ~ 0x1F8
16 * offset[1] dump from offset 0x300 ~ 0x3FC
18 * for perisys tracker:
19 * offset[0] dump from offset 0x100 ~ 0x2F8
20 * offset[1] dump from offset 0x300 ~ 0x4FC
23 static const u32 offsets[] = { AR_TRACK_OFFSET, AW_TRACK_OFFSET };
25 struct tracker tracker_data[TRACKER_NUM] = {
26 [TRACKER_SYSTRACKER] = {
27 .base_addr = DBG_TRACKER_BASE,
28 .timeout = BUS_DBG_CON_TIMEOUT,
29 .entry = SYS_TRACK_ENTRY,
30 .offsets = offsets,
31 .offsets_size = ARRAY_SIZE(offsets),
32 .str = "systracker",
34 [TRACKER_INFRATRACKER] = {
35 .base_addr = INFRA_TRACKER_BASE,
36 .timeout = BUSTRACKER_TIMEOUT,
37 .entry = INFRA_ENTRY_NUM,
38 .offsets = offsets,
39 .offsets_size = ARRAY_SIZE(offsets),
40 .str = "infra_tracker",
42 [TRACKER_PERISYSTRACKER] = {
43 .base_addr = PERI_TRACKER_BASE,
44 .timeout = BUSTRACKER_TIMEOUT,
45 .entry = PERI_ENTRY_NUM,
46 .offsets = offsets,
47 .offsets_size = ARRAY_SIZE(offsets),
48 .str = "peri_tracker",
52 void tracker_setup(void)
54 u32 val;
56 * Set infra/peri tracker timeout.
57 * timeout = clock_in_mhz * 1000 / 16 * timeout_in_ms
59 * timeout: 200ms
60 * infra tracker clock: 156MHz
61 * peri tracker clock: 78MHz
63 val = 156 * 1000 / 16 * 200;
64 write32p(INFRA_TRACKER_BASE + BUS_DBG_TIMER_CON0, val);
65 write32p(INFRA_TRACKER_BASE + BUS_DBG_TIMER_CON1, val);
67 val = 78 * 1000 / 16 * 200;
68 write32p(PERI_TRACKER_BASE + BUS_DBG_TIMER_CON0, val);
69 write32p(PERI_TRACKER_BASE + BUS_DBG_TIMER_CON1, val);
71 /* Enable infra/peri tracer because tracker and tracer share the same enable bit. */
72 write32p(BUS_TRACE_MONITOR_BASE + BUS_TRACE_CON_1, 1 << BUS_TRACE_EN);
73 write32p(BUS_TRACE_MONITOR_BASE + BUS_TRACE_CON_2, 1 << BUS_TRACE_EN);
76 * Enable infra/peri tracker.
77 * bit[0] - BUS_DBG_EN
78 * bit[1] - TIMEOUT_EN
79 * bit[2] - SLV_ERR_EN
80 * bit[13] - HALT_ON_TIMEOUT_EN
81 * bit[14] - BUS_OT_WEN_CTRL
83 val = BIT(0) | BIT(1) | BIT(2) | BIT(13) | BIT(14);
84 write32p(BUS_TRACE_MONITOR_BASE + BUS_TRACE_CON_AO_1, val);
85 write32p(BUS_TRACE_MONITOR_BASE + BUS_TRACE_CON_AO_2, val);