[PATCH 5/5] platform: generic: Add SiFive development platform
Nick Hu
nick.hu at sifive.com
Sun Apr 20 23:25:08 PDT 2025
From: Vincent Chen <vincent.chen at sifive.com>
The sifive_dev_platform is a new platform which is compatible to the
generic platform to place some features which are only for the SiFive
development machine.
Signed-off-by: Vincent Chen <vincent.chen at sifive.com>
Co-developed-by: Nick Hu <nick.hu at sifive.com>
Signed-off-by: Nick Hu <nick.hu at sifive.com>
---
platform/generic/Kconfig | 5 +++
platform/generic/configs/defconfig | 1 +
platform/generic/sifive/objects.mk | 3 ++
platform/generic/sifive/sifive_dev_platform.c | 31 +++++++++++++++++++
4 files changed, 40 insertions(+)
create mode 100644 platform/generic/sifive/sifive_dev_platform.c
diff --git a/platform/generic/Kconfig b/platform/generic/Kconfig
index 688da3f4..e27cb50e 100644
--- a/platform/generic/Kconfig
+++ b/platform/generic/Kconfig
@@ -43,6 +43,11 @@ config PLATFORM_RENESAS_RZFIVE
select ANDES_PMU
default n
+config PLATFORM_SIFIVE_DEV
+ bool "SiFive development platform support"
+ depends on FDT_CACHE
+ default n
+
config PLATFORM_SIFIVE_FU540
bool "SiFive FU540 support"
default n
diff --git a/platform/generic/configs/defconfig b/platform/generic/configs/defconfig
index 09807207..39869c08 100644
--- a/platform/generic/configs/defconfig
+++ b/platform/generic/configs/defconfig
@@ -1,6 +1,7 @@
CONFIG_PLATFORM_ALLWINNER_D1=y
CONFIG_PLATFORM_ANDES_AE350=y
CONFIG_PLATFORM_RENESAS_RZFIVE=y
+CONFIG_PLATFORM_SIFIVE_DEV=y
CONFIG_PLATFORM_SIFIVE_FU540=y
CONFIG_PLATFORM_SIFIVE_FU740=y
CONFIG_PLATFORM_SOPHGO_SG2042=y
diff --git a/platform/generic/sifive/objects.mk b/platform/generic/sifive/objects.mk
index d75e444a..d32e1273 100644
--- a/platform/generic/sifive/objects.mk
+++ b/platform/generic/sifive/objects.mk
@@ -2,6 +2,9 @@
# SPDX-License-Identifier: BSD-2-Clause
#
+carray-platform_override_modules-$(CONFIG_PLATFORM_SIFIVE_DEV) += sifive_dev_platform
+platform-objs-$(CONFIG_PLATFORM_SIFIVE_DEV) += sifive/sifive_dev_platform.o
+
carray-platform_override_modules-$(CONFIG_PLATFORM_SIFIVE_FU540) += sifive_fu540
platform-objs-$(CONFIG_PLATFORM_SIFIVE_FU540) += sifive/fu540.o
diff --git a/platform/generic/sifive/sifive_dev_platform.c b/platform/generic/sifive/sifive_dev_platform.c
new file mode 100644
index 00000000..2506c932
--- /dev/null
+++ b/platform/generic/sifive/sifive_dev_platform.c
@@ -0,0 +1,31 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2025 SiFive Inc.
+ */
+
+#include <platform_override.h>
+#include <sbi_utils/cache/fdt_cmo_helper.h>
+#include <sbi_utils/fdt/fdt_helper.h>
+
+static int sifive_early_init(bool cold_boot, const void *fdt,
+ const struct fdt_match *match)
+{
+ int rc;
+
+ rc = fdt_cmo_init(fdt, cold_boot);
+ if (rc)
+ return rc;
+
+ return 0;
+}
+
+static const struct fdt_match sifive_dev_platform_match[] = {
+ { .compatible = "sifive-dev" },
+ { },
+};
+
+const struct platform_override sifive_dev_platform = {
+ .match_table = sifive_dev_platform_match,
+ .early_init = sifive_early_init,
+};
--
2.17.1
More information about the opensbi
mailing list