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 <ycsin@meta.com>
This commit is contained in:
Yong Cong Sin 2024-11-01 14:13:29 +08:00 committed by Anas Nashif
commit ad7f3a9a0c
3 changed files with 13 additions and 1 deletions

View file

@ -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;

View file

@ -13,3 +13,6 @@
* (e.g. uncacheable) affects all CPUs.
*/
void pma_init_per_core(void);
/* Initialize PMA */
void pma_init(void);

View file

@ -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 */