diff --git a/arch/risc-v/src/common/up_initialize.c b/arch/risc-v/src/common/up_initialize.c index c6c0066fdb..2aed49b6a9 100644 --- a/arch/risc-v/src/common/up_initialize.c +++ b/arch/risc-v/src/common/up_initialize.c @@ -124,6 +124,16 @@ void up_initialize(void) idle->adj_stack_ptr = (FAR void *)g_idle_topstack; idle->adj_stack_size = CONFIG_IDLETHREAD_STACKSIZE; +#ifdef CONFIG_PM + /* Initialize the power management subsystem. This MCU-specific function + * must be called *very* early in the initialization sequence *before* any + * other device drivers are initialized (since they may attempt to register + * with the power management subsystem). + */ + + up_pminitialize(); +#endif + /* Register devices */ #if defined(CONFIG_DEV_NULL) diff --git a/arch/risc-v/src/common/up_internal.h b/arch/risc-v/src/common/up_internal.h index 4a1994656d..29dc0c08de 100644 --- a/arch/risc-v/src/common/up_internal.h +++ b/arch/risc-v/src/common/up_internal.h @@ -201,6 +201,14 @@ void up_restorefpu(const uint32_t *regs); # define up_restorefpu(regs) #endif +/* Power management *********************************************************/ + +#ifdef CONFIG_PM +void up_pminitialize(void); +#else +# define up_pminitialize() +#endif + /* Low level serial output **************************************************/ void up_lowputc(char ch);