Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic/starfive: Add Starfive JH7110 platform implementation
Add Starfive JH7110 platform implementation Signed-off-by: Wei Liang Lim <weiliang.lim@starfivetech.com> Reviewed-by: Chee Hong Ang <cheehong.ang@starfivetech.com> Reviewed-by: Jun Liang Tan <junliang.tan@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
- Loading branch information
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
* | ||
* Copyright (c) 2022 StarFive | ||
* | ||
* Authors: | ||
* Wei Liang Lim <weiliang.lim@starfivetech.com> | ||
*/ | ||
|
||
#include <libfdt.h> | ||
#include <platform_override.h> | ||
#include <sbi_utils/fdt/fdt_helper.h> | ||
|
||
static u32 selected_hartid = -1; | ||
|
||
static bool starfive_jh7110_cold_boot_allowed(u32 hartid, | ||
const struct fdt_match *match) | ||
{ | ||
if (selected_hartid != -1) | ||
return (selected_hartid == hartid); | ||
|
||
return true; | ||
} | ||
|
||
static void starfive_jh7110_fw_init(void *fdt, const struct fdt_match *match) | ||
{ | ||
const fdt32_t *val; | ||
int len, coff; | ||
|
||
coff = fdt_path_offset(fdt, "/chosen"); | ||
if (-1 < coff) { | ||
val = fdt_getprop(fdt, coff, "starfive,boot-hart-id", &len); | ||
if (val && len >= sizeof(fdt32_t)) | ||
selected_hartid = (u32) fdt32_to_cpu(*val); | ||
} | ||
} | ||
|
||
static const struct fdt_match starfive_jh7110_match[] = { | ||
{ .compatible = "starfive,jh7110" }, | ||
{ }, | ||
}; | ||
|
||
const struct platform_override starfive_jh7110 = { | ||
.match_table = starfive_jh7110_match, | ||
.cold_boot_allowed = starfive_jh7110_cold_boot_allowed, | ||
.fw_init = starfive_jh7110_fw_init, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
# | ||
|
||
carray-platform_override_modules-$(CONFIG_PLATFORM_STARFIVE_JH7110) += starfive_jh7110 | ||
platform-objs-$(CONFIG_PLATFORM_STARFIVE_JH7110) += starfive/jh7110.o |