Skip to content

Commit

Permalink
platform: generic: add sophgo sg2044 soc support
Browse files Browse the repository at this point in the history
Signed-off-by: tingzhu.wang <[email protected]>
Signed-off-by: Xiaoguang Xing <[email protected]>
  • Loading branch information
tingzhuwang authored and xingxg2022 committed Aug 30, 2024
1 parent cbf76ce commit 3361818
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
5 changes: 5 additions & 0 deletions platform/generic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ config PLATFORM_SOPHGO_SG2042
select THEAD_C9XX_PMU
default n

config PLATFORM_SOPHGO_SG2044
bool "Sophgo sg2044 support"
select THEAD_C9XX_PMU
default n

config PLATFORM_STARFIVE_JH7110
bool "StarFive JH7110 support"
default n
Expand Down
1 change: 1 addition & 0 deletions platform/generic/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CONFIG_PLATFORM_RENESAS_RZFIVE=y
CONFIG_PLATFORM_SIFIVE_FU540=y
CONFIG_PLATFORM_SIFIVE_FU740=y
CONFIG_PLATFORM_SOPHGO_SG2042=y
CONFIG_PLATFORM_SOPHGO_SG2044=y
CONFIG_PLATFORM_STARFIVE_JH7110=y
CONFIG_PLATFORM_THEAD=y
CONFIG_FDT_GPIO=y
Expand Down
2 changes: 2 additions & 0 deletions platform/generic/sophgo/objects.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@

carray-platform_override_modules-$(CONFIG_PLATFORM_SOPHGO_SG2042) += sophgo_sg2042
platform-objs-$(CONFIG_PLATFORM_SOPHGO_SG2042) += sophgo/sg2042.o
carray-platform_override_modules-$(CONFIG_PLATFORM_SOPHGO_SG2044) += sophgo_sg2044
platform-objs-$(CONFIG_PLATFORM_SOPHGO_SG2044) += sophgo/sg2044.o
49 changes: 49 additions & 0 deletions platform/generic/sophgo/sg2044.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c)
*
* Authors:
* Inochi Amaoto <[email protected]>
* YuQing Cai <[email protected]>
* ZhenYu Zhang <[email protected]>
*/

#include <platform_override.h>
#include <thead/c9xx_pmu.h>
#include <sbi/riscv_asm.h>
#include <sbi/riscv_encoding.h>
#include <sbi/sbi_const.h>
#include <sbi/sbi_ecall_interface.h>
#include <sbi/sbi_pmu.h>
#include <sbi/sbi_platform.h>
#include <sbi_utils/fdt/fdt_helper.h>

static u32 selected_hartid = -1;

static bool sg2044_cold_boot_allowed(u32 hartid,
const struct fdt_match *match)
{
if (selected_hartid != -1)
return (selected_hartid == hartid);

return true;
}

static int sg2044_extensions_init(const struct fdt_match *match,
struct sbi_hart_features *hfeatures)
{
thead_c9xx_register_pmu_device();
return 0;
}

static const struct fdt_match sophgo_sg2044_match[] = {
{ .compatible = "sophgo,sg2044" },
{ },
};

const struct platform_override sophgo_sg2044 = {
.match_table = sophgo_sg2044_match,
.cold_boot_allowed = sg2044_cold_boot_allowed,
.extensions_init = sg2044_extensions_init,
};

0 comments on commit 3361818

Please sign in to comment.