diff --git a/arch/risc-v/src/mpfs/Kconfig b/arch/risc-v/src/mpfs/Kconfig index 6855dd71599..67ae59f1c13 100644 --- a/arch/risc-v/src/mpfs/Kconfig +++ b/arch/risc-v/src/mpfs/Kconfig @@ -46,6 +46,14 @@ config MPFS_BOOTLOADER ---help--- This NuttX image is used as a bootloader, which will boot only on one hart, putting the others in WFI +config MPFS_CLKINIT + bool "Initialize system clocks" + depends on MPFS_BOOTLOADER + default y + ---help--- + This initilizes the system clocks at mpfs_start.c file. The option may be also turned off + if some other entity has already set them up. + config MPFS_BOARD_PMP bool "Enable board specific PMP configuration" depends on ARCH_USE_MPU && MPFS_BOOTLOADER diff --git a/arch/risc-v/src/mpfs/Make.defs b/arch/risc-v/src/mpfs/Make.defs index 1f4403ca43b..2e60c313f5a 100644 --- a/arch/risc-v/src/mpfs/Make.defs +++ b/arch/risc-v/src/mpfs/Make.defs @@ -27,13 +27,17 @@ CMN_ASRCS += mpfs_head.S endif # Specify our C code within this directory to be included -CHIP_CSRCS = mpfs_allocateheap.c mpfs_clockconfig.c +CHIP_CSRCS = mpfs_allocateheap.c CHIP_CSRCS += mpfs_irq.c mpfs_irq_dispatch.c CHIP_CSRCS += mpfs_lowputc.c mpfs_serial.c CHIP_CSRCS += mpfs_start.c mpfs_timerisr.c CHIP_CSRCS += mpfs_gpio.c mpfs_systemreset.c CHIP_CSRCS += mpfs_plic.c mpfs_dsn.c +ifeq ($(CONFIG_MPFS_CLKINIT),y) +CHIP_CSRCS += mpfs_clockconfig.c +endif + ifeq ($(CONFIG_MPFS_DMA),y) CHIP_CSRCS += mpfs_dma.c endif diff --git a/arch/risc-v/src/mpfs/mpfs_start.c b/arch/risc-v/src/mpfs/mpfs_start.c index fb82c2af016..c02b568715c 100644 --- a/arch/risc-v/src/mpfs/mpfs_start.c +++ b/arch/risc-v/src/mpfs/mpfs_start.c @@ -121,7 +121,7 @@ void __mpfs_start(uint64_t mhartid) /* Setup PLL if not already provided */ -#ifdef CONFIG_MPFS_BOOTLOADER +#ifdef CONFIG_MPFS_CLKINIT mpfs_clockconfig(); #endif