platform: generic: Modify platform ops instead of using hooks

Switch all existing platform overrides to use the helper pattern instead
of the platform hooks. After this commit, only the .match_table and
.init members of struct platform_override are used.

There are two minor behavioral differences:
 - For Allwinner D1, fdt_add_cpu_idle_states() is now called before the
   body of generic_final_init(). This should have no functional impact.
 - For StarFive JH7110, if the /chosen/starfive,boot-hart-id property is
   missing, the code now falls back to using generic_coldboot_harts,
   instead of accepting any hart.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20250325234342.711447-7-samuel.holland@sifive.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2025-03-25 16:43:29 -07:00
committed by Anup Patel
parent 2489e1421d
commit b353af63e2
12 changed files with 160 additions and 80 deletions

View File

@@ -102,11 +102,23 @@ static void ae350_hsm_device_init(const void *fdt)
}
}
static int ae350_final_init(bool cold_boot, void *fdt,
const struct fdt_match *match)
static int ae350_final_init(bool cold_boot)
{
if (cold_boot)
if (cold_boot) {
const void *fdt = fdt_get_address();
ae350_hsm_device_init(fdt);
}
return generic_final_init(cold_boot);
}
static int ae350_platform_init(const void *fdt, int nodeoff, const struct fdt_match *match)
{
generic_platform_ops.final_init = ae350_final_init;
generic_platform_ops.extensions_init = andes_pmu_extensions_init;
generic_platform_ops.pmu_init = andes_pmu_init;
generic_platform_ops.vendor_ext_provider = andes_sbi_vendor_ext_provider;
return 0;
}
@@ -118,8 +130,5 @@ static const struct fdt_match andes_ae350_match[] = {
const struct platform_override andes_ae350 = {
.match_table = andes_ae350_match,
.final_init = ae350_final_init,
.extensions_init = andes_pmu_extensions_init,
.pmu_init = andes_pmu_init,
.vendor_ext_provider = andes_sbi_vendor_ext_provider,
.init = ae350_platform_init,
};