diff options
author | Peter Marheine <pmarheine@chromium.org> | 2022-03-16 10:53:01 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-03-16 02:13:57 +0000 |
commit | dbbbe2946d44693b183bedbe7d628bfc66b493df (patch) | |
tree | 114899386c3bb94f8c9d2453d12896305d23d4d0 | |
parent | d7944fc80a732248240cc5c110952cfd3b8a5439 (diff) | |
download | chrome-ec-dbbbe2946d44693b183bedbe7d628bfc66b493df.tar.gz |
nissa: run sub-board detection at PRIO_INIT_I2C
HOOK_PRIO_INIT_I2C is documented as the priority at which I2C is
guaranteed to be ready, and +1 from there is also the priority at
which chargers are initialized so we must use PRIO_INIT_I2C because
otherwise chargers (and maybe other USB-C peripherals) won't get
initialized.
I noticed this when Nereid failed to charge, and the "PD port count
not initialized" warning was being output. Since this is probably a
serious problem, I've also added an assertion to that function to fail
fast in debug builds.
BUG=none
TEST=nereid charges again, and does not warn about uninitialized port
counts.
BRANCH=none
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: If6cc0de5279bc5616813a38d8b29e3b747514049
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3526118
Reviewed-by: Andrew McRae <amcrae@google.com>
-rw-r--r-- | zephyr/projects/nissa/src/common.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/zephyr/projects/nissa/src/common.c b/zephyr/projects/nissa/src/common.c index b093c54e8d..1dd9d3f024 100644 --- a/zephyr/projects/nissa/src/common.c +++ b/zephyr/projects/nissa/src/common.c @@ -37,6 +37,8 @@ static uint8_t cached_usb_pd_port_count; __override uint8_t board_get_usb_pd_port_count(void) { + __ASSERT(cached_usb_pd_port_count != 0, + "sub-board detection did not run before a port count request"); if (cached_usb_pd_port_count == 0) LOG_WRN("USB PD Port count not initialized!"); return cached_usb_pd_port_count; @@ -100,7 +102,7 @@ static void board_setup_init(void) /* * Make sure setup is done after EEPROM is readable. */ -DECLARE_HOOK(HOOK_INIT, board_setup_init, HOOK_PRIO_INIT_I2C + 1); +DECLARE_HOOK(HOOK_INIT, board_setup_init, HOOK_PRIO_INIT_I2C); void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) |