| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <mcall.h> |
| 4 | #include <stdint.h> |
| 5 | #include <device/mmio.h> |
| 6 | #include <soc/addressmap.h> |
| 7 | |
| 8 | void mtime_init(void) |
| 9 | { |
| 10 | long hart_id = read_csr(mhartid); |
| 11 | HLS()->time = (uint64_t *)(FU540_CLINT + 0xbff8); |
| 12 | HLS()->timecmp = (uint64_t *)(FU540_CLINT + 0x4000 + 8 * hart_id); |
| 13 | } |
| 14 | |
| 15 | void set_msip(int hartid, int val) |
| 16 | { |
| 17 | write32((void *)(FU540_CLINT + 4 * (uintptr_t)hartid), !!val); |
| 18 | } |