soc/mediatek/mt8196: Initialize SSPM
[coreboot2.git] / src / mainboard / emulation / spike-riscv / clint.c
blob4d45bce6baeb8d92f1fdb90ff439d1fa0c5ae0fa
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <mcall.h>
4 #include <device/mmio.h>
6 #define SPIKE_CLINT_BASE 0x02000000
8 /* This function is used to initialize HLS()->time/HLS()->timecmp */
9 void mtime_init(void)
11 long hart_id = read_csr(mhartid);
12 HLS()->time = (uint64_t *)(SPIKE_CLINT_BASE + 0xbff8);
13 HLS()->timecmp = (uint64_t *)(SPIKE_CLINT_BASE + 0x4000 + 8 * hart_id);
16 void set_msip(int hartid, int val)
18 write32((void *)(SPIKE_CLINT_BASE + 4 * (uintptr_t)hartid), !!val);