Files
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

57 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
*/
#include <linux/io.h>
#include "adsp_helper.h"
#include "adsp_bus_monitor.h"
/**
* TIMEOUT_VALUE = value * unit(15 cycle count) / clk_src
*/
#define BUS_MON_STAGE1_TIMEOUT_VALUE (0x01DA0A2B) /* 1.00 sec @ 466MHz */
#define BUS_MON_STAGE2_TIMEOUT_VALUE (0x03B41456) /* 2.00 sec @ 466MHz */
#define ADSP_BUS_MON_STATE (ADSP_BUS_MON_BACKUP_BASE)
#define ADSP_BUS_MON_1ST_STAGE_BASE (ADSP_BUS_MON_BACKUP_BASE + sizeof(u32))
#define ADSP_BUS_MON_2ND_STAGE_BASE (ADSP_BUS_MON_1ST_STAGE_BASE + \
sizeof(struct bus_monitor_cblk))
#define ADSP_BUS_MON_BACKUP_SIZE (sizeof(u32) + \
2 * sizeof(struct bus_monitor_cblk))
int adsp_bus_monitor_init(void)
{
/* Clear bus monitor register backup in DTCM */
memset_io((void *)ADSP_BUS_MON_BACKUP_BASE, 0,
(size_t)ADSP_BUS_MON_BACKUP_SIZE);
/* initialize bus monitor */
writel(BUS_MON_STAGE1_TIMEOUT_VALUE, ADSP_BUS_DBG_TIMER_CON0);
writel(BUS_MON_STAGE2_TIMEOUT_VALUE, ADSP_BUS_DBG_TIMER_CON1);
writel(0x0, ADSP_BUS_DBG_WP);
writel(0x0, ADSP_BUS_DBG_WP_MASK);
writel(0x00002037, ADSP_BUS_DBG_CON); /* timeout control */
writel(STAGE_RUN, ADSP_BUS_MON_STATE);
return 0;
}
bool is_adsp_bus_monitor_alert(void)
{
return readl(ADSP_BUS_MON_STATE) > STAGE_RUN;
}
static void adsp_bus_monitor_stage_info(void *addr)
{
int i = 0;
struct bus_monitor_cblk cblk;
memcpy_fromio(&cblk, addr, sizeof(struct bus_monitor_cblk));
for (i = 0; i < 8; i++) {
if (!cblk.r_tracks[i] && !cblk.w_tracks[i])
continue;
}
}