From 7b298a828d340bde125945088ad21d3811665c0d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 15 Jul 2016 13:11:28 -0600 Subject: [PATCH] up_pminitialize() needs to be called from instances of up_initialize() --- arch/arm/src/common/up_initialize.c | 5 +++-- arch/avr/src/common/up_initialize.c | 13 ++++++++++++- arch/hc/src/common/up_initialize.c | 13 ++++++++++++- arch/mips/src/common/up_initialize.c | 13 ++++++++++++- arch/rgmp/src/nuttx.c | 11 +++++++++++ arch/sh/src/common/up_initialize.c | 13 ++++++++++++- arch/sim/src/up_initialize.c | 13 ++++++++++++- arch/x86/src/common/up_initialize.c | 13 ++++++++++++- arch/z16/src/common/up_initialize.c | 15 +++++++++++++-- arch/z80/src/common/up_initialize.c | 15 +++++++++++++-- 10 files changed, 112 insertions(+), 12 deletions(-) diff --git a/arch/arm/src/common/up_initialize.c b/arch/arm/src/common/up_initialize.c index 6f0dc0bce7..973e2318f3 100644 --- a/arch/arm/src/common/up_initialize.c +++ b/arch/arm/src/common/up_initialize.c @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -159,21 +160,21 @@ void up_initialize(void) up_irqinitialize(); +#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). */ -#ifdef CONFIG_PM up_pminitialize(); #endif +#ifdef CONFIG_ARCH_DMA /* Initialize the DMA subsystem if the weak function up_dmainitialize has been * brought into the build */ -#ifdef CONFIG_ARCH_DMA #ifdef CONFIG_HAVE_WEAKFUNCTIONS if (up_dmainitialize) #endif diff --git a/arch/avr/src/common/up_initialize.c b/arch/avr/src/common/up_initialize.c index 425b070d3c..d6df062b4b 100644 --- a/arch/avr/src/common/up_initialize.c +++ b/arch/avr/src/common/up_initialize.c @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -201,11 +202,21 @@ void up_initialize(void) up_irqinitialize(); +#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 + +#ifdef CONFIG_ARCH_DMA /* Initialize the DMA subsystem if the weak function stm32_dmainitialize has been * brought into the build */ -#ifdef CONFIG_ARCH_DMA #ifdef CONFIG_HAVE_WEAKFUNCTIONS if (up_dmainitialize) #endif diff --git a/arch/hc/src/common/up_initialize.c b/arch/hc/src/common/up_initialize.c index 5162464638..881f8abd71 100644 --- a/arch/hc/src/common/up_initialize.c +++ b/arch/hc/src/common/up_initialize.c @@ -53,6 +53,7 @@ #include #include #include +#include #include "up_arch.h" #include "up_internal.h" @@ -127,11 +128,21 @@ void up_initialize(void) up_irqinitialize(); +#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 + +#ifdef CONFIG_ARCH_DMA /* Initialize the DMA subsystem if the weak function stm32_dmainitialize has been * brought into the build */ -#ifdef CONFIG_ARCH_DMA #ifdef CONFIG_HAVE_WEAKFUNCTIONS if (up_dmainitialize) #endif diff --git a/arch/mips/src/common/up_initialize.c b/arch/mips/src/common/up_initialize.c index faa8edab97..185b475e1d 100644 --- a/arch/mips/src/common/up_initialize.c +++ b/arch/mips/src/common/up_initialize.c @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -129,11 +130,21 @@ void up_initialize(void) up_irqinitialize(); +#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 + +#ifdef CONFIG_ARCH_DMA /* Initialize the DMA subsystem if the weak function stm32_dmainitialize has been * brought into the build */ -#ifdef CONFIG_ARCH_DMA #ifdef CONFIG_HAVE_WEAKFUNCTIONS if (up_dmainitialize) #endif diff --git a/arch/rgmp/src/nuttx.c b/arch/rgmp/src/nuttx.c index 30824ccff0..ee6148e35e 100644 --- a/arch/rgmp/src/nuttx.c +++ b/arch/rgmp/src/nuttx.c @@ -56,6 +56,7 @@ #include #include #include +#include #include "task/task.h" #include "sched/sched.h" @@ -107,6 +108,16 @@ void up_initialize(void) nuttx_arch_init(); +#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 + #if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_PSEUDOTERM_SUSV1) /* Register the master pseudo-terminal multiplexor device */ diff --git a/arch/sh/src/common/up_initialize.c b/arch/sh/src/common/up_initialize.c index 6b62007d0b..c438993655 100644 --- a/arch/sh/src/common/up_initialize.c +++ b/arch/sh/src/common/up_initialize.c @@ -53,6 +53,7 @@ #include #include #include +#include #include "up_arch.h" #include "up_internal.h" @@ -131,9 +132,19 @@ void up_initialize(void) up_irqinitialize(); - /* Initialize the system timer interrupt */ +#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 #if !defined(CONFIG_SUPPRESS_INTERRUPTS) && !defined(CONFIG_SUPPRESS_TIMER_INTS) + /* Initialize the system timer interrupt */ + up_timer_initialize(); #endif diff --git a/arch/sim/src/up_initialize.c b/arch/sim/src/up_initialize.c index 56f8f435aa..5df82aec95 100644 --- a/arch/sim/src/up_initialize.c +++ b/arch/sim/src/up_initialize.c @@ -54,6 +54,7 @@ #include #include #include +#include #include "up_internal.h" @@ -126,15 +127,25 @@ static void up_init_smartfs(void) void up_initialize(void) { +#ifdef CONFIG_NET /* The real purpose of the following is to make sure that syslog * is drawn into the link. It is needed by up_tapdev which is linked * separately. */ -#ifdef CONFIG_NET syslog(LOG_INFO, "SIM: Initializing"); #endif +#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 + #if CONFIG_NFILE_DESCRIPTORS > 0 /* Register devices */ diff --git a/arch/x86/src/common/up_initialize.c b/arch/x86/src/common/up_initialize.c index 1d3270e3a3..6a9eca8d5a 100644 --- a/arch/x86/src/common/up_initialize.c +++ b/arch/x86/src/common/up_initialize.c @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -129,11 +130,21 @@ void up_initialize(void) up_irqinitialize(); +#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 + +#ifdef CONFIG_ARCH_DMA /* Initialize the DMA subsystem if the weak function up_dmainitialize has been * brought into the build */ -#ifdef CONFIG_ARCH_DMA #ifdef CONFIG_HAVE_WEAKFUNCTIONS if (up_dmainitialize) #endif diff --git a/arch/z16/src/common/up_initialize.c b/arch/z16/src/common/up_initialize.c index 2bb5d7316e..3f375763bd 100644 --- a/arch/z16/src/common/up_initialize.c +++ b/arch/z16/src/common/up_initialize.c @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -132,9 +133,9 @@ void up_initialize(void) up_calibratedelay(); +#if CONFIG_MM_REGIONS > 1 /* Add any extra memory fragments to the memory manager */ -#if CONFIG_MM_REGIONS > 1 up_addregion(); #endif @@ -142,9 +143,19 @@ void up_initialize(void) up_irqinitialize(); - /* Initialize the system timer interrupt */ +#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 #if !defined(CONFIG_SUPPRESS_INTERRUPTS) && !defined(CONFIG_SUPPRESS_TIMER_INTS) + /* Initialize the system timer interrupt */ + up_timer_initialize(); #endif diff --git a/arch/z80/src/common/up_initialize.c b/arch/z80/src/common/up_initialize.c index 3bd7c6e9ab..760f6c74a9 100644 --- a/arch/z80/src/common/up_initialize.c +++ b/arch/z80/src/common/up_initialize.c @@ -52,6 +52,7 @@ #include #include #include +#include #include @@ -121,9 +122,9 @@ void up_initialize(void) up_calibratedelay(); +#if CONFIG_MM_REGIONS > 1 /* Add any extra memory fragments to the memory manager */ -#if CONFIG_MM_REGIONS > 1 up_addregion(); #endif @@ -131,9 +132,19 @@ void up_initialize(void) up_irqinitialize(); - /* Initialize the system timer interrupt */ +#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 #if !defined(CONFIG_SUPPRESS_INTERRUPTS) && !defined(CONFIG_SUPPRESS_TIMER_INTS) + /* Initialize the system timer interrupt */ + up_timer_initialize(); #endif