summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2020-03-10 18:36:01 -0700
committerCommit Bot <commit-bot@chromium.org>2020-03-12 01:27:37 +0000
commit708277bd1ebb5d9a4dccc875708c3d5018eebd8f (patch)
tree58c24e958f8d9b48397947a85c0b5f095d460d4c
parent3def48bef02dbd81acab77163924bc3bbb20983b (diff)
downloadchrome-ec-release-R82-12974.B-cr50_stab.tar.gz
change the init proiorities of ec_efs_init() and ec_comm_init()release-R82-12974.B-cr50_stab
This patch reprioritizes ec_comm_init() and ec_efs_init() so that they won't be executed prior to board_init(), which executes nvmem_init(). BUG=b:151187315 BRANCH=cr50 TEST=let cr50 reboot a few times, and checked the console message and the ec_comm command output that Kernel secdata was reloaded without error. Swapped cr50 image from normal to dev, vice versa, and repeated the rebooting. [Reset cause: hard] [0.003799 Inits done] strap pin readings: a1:2 a9:3 a6:0 a12:0 [0.005893 Valid strap: 0xe properties: 0xa00041] [0.007991 init_jittery_clock_locking_optional: run level high, ... [0.045539 init took 29953] [0.051185 tpm_rst_asserted] [0.052074 EC-COMM: Initializtion] Console is enabled; type HELP for help. ... > ec_comm ... response : 0xec00 ec_hash : LOADED secdata_error_code : 0x00000000 > Change-Id: Ia695896986374ac9d23ac111fe0086ec6a13923e Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2093102 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--board/cr50/board.c2
-rw-r--r--common/ec_comm.c2
-rw-r--r--common/ec_efs.c2
-rw-r--r--include/hooks.h12
4 files changed, 15 insertions, 3 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c
index f1d4d2a743..8aa6dde87d 100644
--- a/board/cr50/board.c
+++ b/board/cr50/board.c
@@ -857,7 +857,7 @@ static void board_init(void)
* HOOK_INIT, not at +1.0 seconds.
*/
}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_INIT_CR50_BOARD);
/**
* Hook for CCD config loaded/changed.
diff --git a/common/ec_comm.c b/common/ec_comm.c
index 169e65eb55..eaf26b4509 100644
--- a/common/ec_comm.c
+++ b/common/ec_comm.c
@@ -76,7 +76,7 @@ static void ec_comm_init_(void)
if (gpio_get_level(GPIO_EC_PACKET_MODE_EN))
ec_comm_packet_mode_en(GPIO_EC_PACKET_MODE_EN);
}
-DECLARE_HOOK(HOOK_INIT, ec_comm_init_, HOOK_PRIO_DEFAULT + 1);
+DECLARE_HOOK(HOOK_INIT, ec_comm_init_, HOOK_PRIO_INIT_EC_CR50_COMM);
/*
* Process the received packet.
diff --git a/common/ec_efs.c b/common/ec_efs.c
index 9952e0bc1c..207056dce0 100644
--- a/common/ec_efs.c
+++ b/common/ec_efs.c
@@ -116,7 +116,7 @@ static void ec_efs_init_(void)
ec_efs_refresh();
}
-DECLARE_HOOK(HOOK_INIT, ec_efs_init_, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, ec_efs_init_, HOOK_PRIO_INIT_EC_EFS);
/**
* TPM vendor command handler to respond with EC Boot Mode.
diff --git a/include/hooks.h b/include/hooks.h
index e30c420fbb..f349d906cb 100644
--- a/include/hooks.h
+++ b/include/hooks.h
@@ -51,6 +51,18 @@ enum hook_priority {
HOOK_PRIO_INIT_ADC = HOOK_PRIO_DEFAULT,
+ /*
+ * Priorities for CR50 modules.
+ * HOOK_PRIO_INIT_CR50_BOARD is for board_init() in board/cr50/board.c
+ * which calls nvmem_init().
+ * ec_efs_init() should not be called prior to board_init().
+ * ec_comm_init() should not be called prior to ec_efs_init().
+ */
+ HOOK_PRIO_INIT_CR50_BOARD = HOOK_PRIO_DEFAULT,
+ HOOK_PRIO_INIT_EC_EFS = HOOK_PRIO_INIT_CR50_BOARD + 1,
+ HOOK_PRIO_INIT_EC_CR50_COMM = HOOK_PRIO_INIT_EC_EFS + 1,
+
+
/* Specific values to lump temperature-related hooks together */
HOOK_PRIO_TEMP_SENSOR = 6000,
/* After all sensors have been polled */