[PATCH v3 05/12] platform: generic: Add SiFive development platform
Anup Patel
anup at brainfault.org
Mon Aug 4 01:37:32 PDT 2025
On Tue, Jul 8, 2025 at 1:20 PM Nick Hu <nick.hu at sifive.com> wrote:
>
> 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 | 41 +++++++++++++++++++
> 4 files changed, 50 insertions(+)
> create mode 100644 platform/generic/sifive/sifive_dev_platform.c
>
> diff --git a/platform/generic/Kconfig b/platform/generic/Kconfig
> index a24d6ab2..20c25a83 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 6b219cfb..42e7ef75 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..ac659868
> --- /dev/null
> +++ b/platform/generic/sifive/sifive_dev_platform.c
> @@ -0,0 +1,41 @@
> +/*
> + * SPDX-License-Identifier: BSD-2-Clause
> + *
> + * Copyright (c) 2025 SiFive Inc.
> + */
> +
> +#include <platform_override.h>
> +#include <sbi_utils/cache/fdt_cmo_helper.h>
> +
> +static int sifive_early_init(bool cold_boot)
> +{
> + int rc;
> +
> + rc = generic_early_init(cold_boot);
> + if (rc)
> + return rc;
> +
> + rc = fdt_cmo_init(cold_boot);
> + if (rc)
> + return rc;
Why not call fdt_cmo_init() directly as part of generic_early_init() ?
> +
> + return 0;
> +}
> +
> +static int sifive_platform_init(const void *fdt, int nodeoff,
> + const struct fdt_match *match)
> +{
> + generic_platform_ops.early_init = sifive_early_init;
> +
> + return 0;
> +}
> +
> +static const struct fdt_match sifive_dev_platform_match[] = {
> + { .compatible = "sifive-dev" },
> + { },
> +};
> +
> +const struct fdt_driver sifive_dev_platform = {
> + .match_table = sifive_dev_platform_match,
> + .init = sifive_platform_init,
> +};
> --
> 2.17.1
>
Regards,
Anup
More information about the opensbi
mailing list