2020-04-04 18:51:30 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2018-08-28 10:34:29 +02:00
|
|
|
|
|
|
|
#include <mcall.h>
|
2018-10-11 11:30:37 +02:00
|
|
|
#include <stdint.h>
|
2019-03-03 07:01:05 +01:00
|
|
|
#include <device/mmio.h>
|
2018-08-27 07:32:32 +02:00
|
|
|
#include <soc/addressmap.h>
|
2018-08-28 10:34:29 +02:00
|
|
|
|
|
|
|
void mtime_init(void)
|
|
|
|
{
|
2018-08-27 07:32:32 +02:00
|
|
|
long hart_id = read_csr(mhartid);
|
|
|
|
HLS()->time = (uint64_t *)(FU540_CLINT + 0xbff8);
|
|
|
|
HLS()->timecmp = (uint64_t *)(FU540_CLINT + 0x4000 + 8 * hart_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_msip(int hartid, int val)
|
|
|
|
{
|
2018-10-11 11:30:37 +02:00
|
|
|
write32((void *)(FU540_CLINT + 4 * (uintptr_t)hartid), !!val);
|
2018-08-28 10:34:29 +02:00
|
|
|
}
|