diff options
author | Andrew McRae <amcrae@google.com> | 2022-04-28 15:38:28 +1000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-05-05 23:46:37 +0000 |
commit | ade735848a985bb90073a320938d42064e788cee (patch) | |
tree | 2ed22a79dae9627df37d2f473ad4820fb946b4be | |
parent | 526043e053cb65b9fe9b54262e829710e060ae40 (diff) | |
download | chrome-ec-ade735848a985bb90073a320938d42064e788cee.tar.gz |
zephyr: Move system pre-init earlier
The system_common_pre_init() function detects whether
a warm boot (sysjump) has been performed, and sets the
reset flags accordingly.
A number of modules rely on detecting whether a warm
boot has happened (e.g the GPIO init, AP power sequence etc.),
and previously the check was performed as part of the
main EC task initialisation, after the kernel and application
init phases. With more Zephyr based modules using SYS_INIT,
moving the check will allow modules using POST_KERNEL and
APPLICATION phase initialisation to check this flag as needed.
BUG=b:230691031
TEST=zmake testall; zmake build nivviks; flash and run
BRANCH=none
Signed-off-by: Andrew McRae <amcrae@google.com>
Change-Id: I772b57c32b3176a539d464d5d301ff9b87b9d8ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3612983
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
-rw-r--r-- | zephyr/app/ec/ec_app_main.c | 2 | ||||
-rw-r--r-- | zephyr/shim/src/gpio.c | 5 | ||||
-rw-r--r-- | zephyr/shim/src/system.c | 1 | ||||
-rw-r--r-- | zephyr/subsys/ap_pwrseq/signal_gpio.c | 7 |
4 files changed, 5 insertions, 10 deletions
diff --git a/zephyr/app/ec/ec_app_main.c b/zephyr/app/ec/ec_app_main.c index 1a29e9fddd..c317eadbbe 100644 --- a/zephyr/app/ec/ec_app_main.c +++ b/zephyr/app/ec/ec_app_main.c @@ -26,8 +26,6 @@ */ void ec_app_main(void) { - system_common_pre_init(); - /* * Initialize reset logs. This needs to be done before any updates of * reset logs because we need to verify if the values remain the same diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c index 4daa6b3c2b..945c04a577 100644 --- a/zephyr/shim/src/gpio.c +++ b/zephyr/shim/src/gpio.c @@ -14,7 +14,7 @@ #include "gpio.h" #include "gpio/gpio.h" #include "ioexpander.h" -#include "sysjump.h" +#include "system.h" #include "cros_version.h" LOG_MODULE_REGISTER(gpio_shim, LOG_LEVEL_ERR); @@ -255,8 +255,7 @@ const struct gpio_dt_spec *gpio_get_dt_spec(enum gpio_signal signal) static int init_gpios(const struct device *unused) { gpio_flags_t flags; - struct jump_data *jdata = get_jump_data(); - bool is_sys_jumped = (jdata && jdata->magic == JUMP_DATA_MAGIC); + bool is_sys_jumped = system_jumped_to_this_image(); ARG_UNUSED(unused); diff --git a/zephyr/shim/src/system.c b/zephyr/shim/src/system.c index 802da6c838..11da1bcc46 100644 --- a/zephyr/shim/src/system.c +++ b/zephyr/shim/src/system.c @@ -369,6 +369,7 @@ static int system_preinitialize(const struct device *unused) arch_nop(); } #endif + system_common_pre_init(); return 0; } diff --git a/zephyr/subsys/ap_pwrseq/signal_gpio.c b/zephyr/subsys/ap_pwrseq/signal_gpio.c index e28df96e6b..cd43db537e 100644 --- a/zephyr/subsys/ap_pwrseq/signal_gpio.c +++ b/zephyr/subsys/ap_pwrseq/signal_gpio.c @@ -6,7 +6,7 @@ #include <power_signals.h> #include <signal_gpio.h> #include <drivers/gpio.h> -#include "sysjump.h" +#include "system.h" #define MY_COMPAT intel_ap_pwrseq_gpio @@ -121,11 +121,8 @@ void power_signal_gpio_init(void) /* * If there has been a sysjump, do not set the output * to the deasserted state. - * We can't use system_jumped_late() since that is not - * initialised at this point. */ - struct jump_data *jdata = get_jump_data(); - gpio_flags_t out_flags = (jdata && jdata->magic == JUMP_DATA_MAGIC) ? + gpio_flags_t out_flags = system_jumped_to_this_image() ? GPIO_OUTPUT : GPIO_OUTPUT_INACTIVE; for (int i = 0; i < ARRAY_SIZE(gpio_config); i++) { |