platform: generic: Add an init hook matching fdt_driver

In preparation for reusing the fdt_driver code to match platform
overrides, add a new .init hook matching the type signature from
fdt_driver. This hook replaces the existing .fw_init hook, since
it is called at roughly the same place in the init process.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20250325234342.711447-5-samuel.holland@sifive.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2025-03-25 16:43:27 -07:00
committed by Anup Patel
parent de777cc633
commit e78a0ebdc4
3 changed files with 14 additions and 7 deletions

View File

@@ -301,7 +301,8 @@ static bool starfive_jh7110_cold_boot_allowed(u32 hartid,
return true;
}
static void starfive_jh7110_fw_init(const void *fdt, const struct fdt_match *match)
static int starfive_jh7110_platform_init(const void *fdt, int nodeoff,
const struct fdt_match *match)
{
const fdt32_t *val;
int len, coff;
@@ -312,6 +313,8 @@ static void starfive_jh7110_fw_init(const void *fdt, const struct fdt_match *mat
if (val && len >= sizeof(fdt32_t))
selected_hartid = (u32) fdt32_to_cpu(*val);
}
return 0;
}
static const struct fdt_match starfive_jh7110_match[] = {
@@ -321,7 +324,7 @@ static const struct fdt_match starfive_jh7110_match[] = {
const struct platform_override starfive_jh7110 = {
.match_table = starfive_jh7110_match,
.init = starfive_jh7110_platform_init,
.cold_boot_allowed = starfive_jh7110_cold_boot_allowed,
.fw_init = starfive_jh7110_fw_init,
.final_init = starfive_jh7110_final_init,
};