From ad7f3a9a0c559e461f0e3c06ffc0a01b05820512 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Fri, 1 Nov 2024 14:13:29 +0800 Subject: [PATCH] soc: andestech: refactor out soc_early_init_hook() from pma.c Refactor out the `soc_early_init_hook()` function from `pma.c` to `soc.c` which is always compiled so that it can be extended to run other init functions easily in the future. Then, restore the function in `pma.c` to `pma_init()`. Signed-off-by: Yong Cong Sin --- soc/andestech/ae350/pma.c | 2 +- soc/andestech/ae350/pma.h | 3 +++ soc/andestech/ae350/soc.c | 9 +++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/soc/andestech/ae350/pma.c b/soc/andestech/ae350/pma.c index d880e713097..326bdf372b9 100644 --- a/soc/andestech/ae350/pma.c +++ b/soc/andestech/ae350/pma.c @@ -194,7 +194,7 @@ void pma_init_per_core(void) #endif /* CONFIG_NOCACHE_MEMORY */ } -void soc_early_init_hook(void) +void pma_init(void) { unsigned long mmsc_cfg; diff --git a/soc/andestech/ae350/pma.h b/soc/andestech/ae350/pma.h index 9f6db1c655c..459db7c98d9 100644 --- a/soc/andestech/ae350/pma.h +++ b/soc/andestech/ae350/pma.h @@ -13,3 +13,6 @@ * (e.g. uncacheable) affects all CPUs. */ void pma_init_per_core(void); + +/* Initialize PMA */ +void pma_init(void); diff --git a/soc/andestech/ae350/soc.c b/soc/andestech/ae350/soc.c index 2decfe40826..852da6d8113 100644 --- a/soc/andestech/ae350/soc.c +++ b/soc/andestech/ae350/soc.c @@ -14,3 +14,12 @@ void soc_per_core_init_hook(void) #endif /* SOC_ANDES_V5_PMA */ } #endif /* CONFIG_SOC_PER_CORE_INIT_HOOK */ + +#ifdef CONFIG_SOC_EARLY_INIT_HOOK +void soc_early_init_hook(void) +{ +#ifdef CONFIG_SOC_ANDES_V5_PMA + pma_init(); +#endif /* CONFIG_SOC_ANDES_V5_PMA */ +} +#endif /* CONFIG_SOC_EARLY_INIT_HOOK */