platform: generic: add sophgo sg2260 soc support

Signed-off-by: tingzhu.wang <tingzhu.wang@sophgo.com>
Signed-off-by: Xiaoguang Xing <xiaoguang.xing@sophgo.com>
This commit is contained in:
tingzhu.wang
2023-09-18 11:36:10 +08:00
committed by Xiaoguang Xing
parent 56183ca609
commit 08c8572c8d
4 changed files with 57 additions and 0 deletions

View File

@@ -58,6 +58,11 @@ config PLATFORM_SOPHGO_SG2042
select THEAD_C9XX_PMU
default n
config PLATFORM_SOPHGO_SG2260
bool "Sophgo sg2260 support"
select THEAD_C9XX_PMU
default n
config PLATFORM_STARFIVE_JH7110
bool "StarFive JH7110 support"
default n

View File

@@ -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_SG2260=y
CONFIG_PLATFORM_STARFIVE_JH7110=y
CONFIG_PLATFORM_THEAD=y
CONFIG_FDT_GPIO=y

View File

@@ -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_SG2260) += sophgo_sg2260
platform-objs-$(CONFIG_PLATFORM_SOPHGO_SG2260) += sophgo/sg2260.o

View File

@@ -0,0 +1,49 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c)
*
* Authors:
* Inochi Amaoto <inochiama@outlook.com>
* YuQing Cai <caiyuqing_hz@163.com>
* ZhenYu Zhang <1204122531@qq.com>
*/
#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 = 0;
static bool sg2260_cold_boot_allowed(u32 hartid,
const struct fdt_match *match)
{
if (selected_hartid != -1)
return (selected_hartid == hartid);
return true;
}
static int sg2260_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_sg2260_match[] = {
{ .compatible = "sophgo, sg2260" },
{ },
};
const struct platform_override sophgo_sg2260 = {
.match_table = sophgo_sg2260_match,
.cold_boot_allowed = sg2260_cold_boot_allowed,
.extensions_init = sg2260_extensions_init,
};