Skip to content

Commit

Permalink
risc-v/mpfs: introduce CONFIG_MPFS_CLKINIT flag
Browse files Browse the repository at this point in the history
This CONFIG_MPFS_CLKINIT is set with bootloaders by default. However,
this gives an option to have it unset. In some cases, the clocks
may be already set so it becomes unnecessary to re-initialize them.

Signed-off-by: Eero Nurkkala <[email protected]>
  • Loading branch information
eenurkka committed Nov 29, 2024
1 parent 890058d commit 05ae6f0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions arch/risc-v/src/mpfs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion arch/risc-v/src/mpfs/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/risc-v/src/mpfs/mpfs_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 05ae6f0

Please sign in to comment.