summaryrefslogtreecommitdiff
path: root/platform/kendryte
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2021-05-21 14:03:33 +0300
committerAnup Patel <anup@brainfault.org>2021-06-24 07:09:55 +0300
commita731c7e36988c3308e1978ecde491f2f6182d490 (patch)
treee6d966c4cc40d92863326914bc1e8b736bcf93c6 /platform/kendryte
parent03d6bb51ba96a16a8ac9a2fcbaebec9f6c31d900 (diff)
downloadopensbi-a731c7e36988c3308e1978ecde491f2f6182d490.tar.xz
platform: Replace CLINT library usage with ACLINT library
The ACLINT devices are backward compatible with SiFive CLINT so we replace all CLINT library usage in various platforms with ACLINT library. As a result of this replacement, the CLINT library is not used by any part of OpenSBI hence we remove it. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Xiang W <wxjstz@126.com>
Diffstat (limited to 'platform/kendryte')
-rw-r--r--platform/kendryte/k210/platform.c23
-rw-r--r--platform/kendryte/k210/platform.h4
2 files changed, 20 insertions, 7 deletions
diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c
index 66a0392..55c4b1e 100644
--- a/platform/kendryte/k210/platform.c
+++ b/platform/kendryte/k210/platform.c
@@ -14,9 +14,10 @@
#include <sbi/sbi_platform.h>
#include <sbi/sbi_system.h>
#include <sbi_utils/fdt/fdt_fixup.h>
+#include <sbi_utils/ipi/aclint_mswi.h>
#include <sbi_utils/irqchip/plic.h>
#include <sbi_utils/serial/sifive-uart.h>
-#include <sbi_utils/sys/clint.h>
+#include <sbi_utils/timer/aclint_mtimer.h>
#include "platform.h"
extern const char dt_k210_start[];
@@ -33,8 +34,16 @@ static struct plic_data plic = {
.num_src = K210_PLIC_NUM_SOURCES,
};
-static struct clint_data clint = {
- .addr = K210_CLINT_BASE_ADDR,
+static struct aclint_mswi_data mswi = {
+ .addr = K210_ACLINT_MSWI_ADDR,
+ .size = ACLINT_MSWI_SIZE,
+ .first_hartid = 0,
+ .hart_count = K210_HART_COUNT,
+};
+
+static struct aclint_mtimer_data mtimer = {
+ .addr = K210_ACLINT_MTIMER_ADDR,
+ .size = ACLINT_MTIMER_SIZE,
.first_hartid = 0,
.hart_count = K210_HART_COUNT,
.has_64bit_mmio = TRUE,
@@ -139,12 +148,12 @@ static int k210_ipi_init(bool cold_boot)
int rc;
if (cold_boot) {
- rc = clint_cold_ipi_init(&clint);
+ rc = aclint_mswi_cold_init(&mswi);
if (rc)
return rc;
}
- return clint_warm_ipi_init();
+ return aclint_mswi_warm_init();
}
static int k210_timer_init(bool cold_boot)
@@ -152,12 +161,12 @@ static int k210_timer_init(bool cold_boot)
int rc;
if (cold_boot) {
- rc = clint_cold_timer_init(&clint, NULL);
+ rc = aclint_mtimer_cold_init(&mtimer, NULL);
if (rc)
return rc;
}
- return clint_warm_timer_init();
+ return aclint_mtimer_warm_init();
}
const struct sbi_platform_operations platform_ops = {
diff --git a/platform/kendryte/k210/platform.h b/platform/kendryte/k210/platform.h
index e425faf..0a32530 100644
--- a/platform/kendryte/k210/platform.h
+++ b/platform/kendryte/k210/platform.h
@@ -22,6 +22,10 @@
#define K210_SYSCTL_BASE_ADDR 0x50440000ULL
#define K210_UART_BASE_ADDR 0x38000000ULL
#define K210_CLINT_BASE_ADDR 0x02000000ULL
+#define K210_ACLINT_MSWI_ADDR \
+ (K210_CLINT_BASE_ADDR + CLINT_MSWI_OFFSET)
+#define K210_ACLINT_MTIMER_ADDR \
+ (K210_CLINT_BASE_ADDR + CLINT_MTIMER_OFFSET)
#define K210_PLIC_BASE_ADDR 0x0C000000ULL
/* Registers */