summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2022-11-23 23:33:43 +0000
committerPiotr Pawliczek <pawliczek@chromium.org>2022-11-24 00:25:21 +0000
commitd6a129f6bff2021ad787f7bf298252b2407edbb7 (patch)
tree802da35e78bdf0e52e5de0d693277820b03a6db8
parent9b5fb3a59f1f062c74846676aa23e8e5ed8bb940 (diff)
downloadchrome-ec-d6a129f6bff2021ad787f7bf298252b2407edbb7.tar.gz
Revert "zephyr: Remove CONFIG_PLATFORM_EC_WATCHDOG"
This reverts commit e04250319d222ef8505d9111ba4f03eddcaf5521. Reason for revert: Breaks drallion builds. b:260270232 Original change's description: > zephyr: Remove CONFIG_PLATFORM_EC_WATCHDOG > > Remove CONFIG_PLATFORM_EC_WATCHDOG. Use Zephyr's CONFIG_WATCHDOG option > instead. > > BUG=b:217926701 > BRANCH=none > TEST=twister -T zephyr/test/ > TEST=zmake compare-builds -a > LOW_COVERAGE_REASON=watchdog_init test not yet implemented > > Signed-off-by: Mark Hasemeyer <markhas@google.com> > > Change-Id: I7d5fedfc72ed886f94a94df9d3db14224bc6fb75 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4050634 > Reviewed-by: Keith Short <keithshort@chromium.org> > Reviewed-by: Aaron Massey <aaronmassey@google.com> > Tested-by: Mark Hasemeyer <markhas@google.com> > Commit-Queue: Mark Hasemeyer <markhas@google.com> Bug: b:217926701 Change-Id: I01471b9544cc0792427b3ca6761fb07ee0432dc6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4053682 Commit-Queue: Piotr Pawliczek <pawliczek@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Piotr Pawliczek <pawliczek@chromium.org> Tested-by: Keith Short <keithshort@chromium.org> Owners-Override: Piotr Pawliczek <pawliczek@chromium.org>
-rw-r--r--zephyr/Kconfig17
-rw-r--r--zephyr/Kconfig.watchdog4
-rw-r--r--zephyr/app/ec/ec_app_main.c2
-rw-r--r--zephyr/drivers/cros_flash/cros_flash_it8xxx2.c4
-rw-r--r--zephyr/shim/src/CMakeLists.txt2
-rw-r--r--zephyr/test/ec_app/src/main.c2
6 files changed, 24 insertions, 7 deletions
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index b60e87d10e..9e04f4a679 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -741,6 +741,23 @@ config PLATFORM_EC_VSTORE_SLOT_COUNT
used only for recording a hash of the read-write AP firmware for
checking on resume. For this, one slot is enough.
+menuconfig PLATFORM_EC_WATCHDOG
+ bool "Watchdog"
+ depends on WATCHDOG
+ default y
+ help
+ Enable the watchdog functionality. The watchdog timer will reboot the
+ system if the hook task (which is the lowest-priority task on the
+ system) gets starved for CPU time and isn't able to fire its
+ HOOK_TICK event.
+
+ Chromium EC system uses an auxiliary timer to handle the system
+ warning event. This leaves some time to the system for preparing &
+ printing the debug information. The interval between reloads of the
+ watchdog timer should be less than half of the auxiliary timer
+ (PLATFORM_EC_WATCHDOG_PERIOD_MS -
+ PLATFORM_EC_WATCHDOG_WARNING_LEADING_TIME_MS).
+
config PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API
bool "Workaround needed for npcx9 ES1 chip"
depends on SOC_SERIES_NPCX9
diff --git a/zephyr/Kconfig.watchdog b/zephyr/Kconfig.watchdog
index 653cc58e22..f6c9002233 100644
--- a/zephyr/Kconfig.watchdog
+++ b/zephyr/Kconfig.watchdog
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-if WATCHDOG
+if PLATFORM_EC_WATCHDOG
config PLATFORM_EC_WATCHDOG_PERIOD_MS
int "Watchdog timeout in ms"
@@ -27,4 +27,4 @@ config PLATFORM_EC_WATCHDOG_WARNING_LEADING_TIME_MS
For the ITE chip, use CONFIG_WDT_ITE_WARNING_LEADING_TIME_MS instead
of this config.
-endif # WATCHDOG
+endif # PLATFORM_EC_WATCHDOG
diff --git a/zephyr/app/ec/ec_app_main.c b/zephyr/app/ec/ec_app_main.c
index 961e4f5ce2..4ab5fd3a44 100644
--- a/zephyr/app/ec/ec_app_main.c
+++ b/zephyr/app/ec/ec_app_main.c
@@ -37,7 +37,7 @@ void ec_app_main(void)
system_print_banner();
- if (IS_ENABLED(CONFIG_WATCHDOG) &&
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_WATCHDOG) &&
!IS_ENABLED(CONFIG_WDT_DISABLE_AT_BOOT)) {
watchdog_init();
}
diff --git a/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c b/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
index 2d34a21523..79ef0c36b2 100644
--- a/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
+++ b/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
@@ -180,7 +180,7 @@ static int cros_flash_it8xxx2_write(const struct device *dev, int offset,
* chance to go back to hook task to touch watchdog. Reload watchdog
* on each flash write to prevent the reset.
*/
- if (IS_ENABLED(CONFIG_WATCHDOG))
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_WATCHDOG))
watchdog_reload();
return flash_write(flash_controller, offset, src_data, size);
@@ -223,7 +223,7 @@ static int cros_flash_it8xxx2_erase(const struct device *dev, int offset,
* If requested erase size is too large at one time on KGD
* flash, we need to reload watchdog to prevent the reset.
*/
- if (IS_ENABLED(CONFIG_WATCHDOG) && (size > 0x10000))
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_WATCHDOG) && (size > 0x10000))
watchdog_reload();
}
/* Restore interrupts */
diff --git a/zephyr/shim/src/CMakeLists.txt b/zephyr/shim/src/CMakeLists.txt
index 62697db096..543c2b2303 100644
--- a/zephyr/shim/src/CMakeLists.txt
+++ b/zephyr/shim/src/CMakeLists.txt
@@ -63,7 +63,7 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_TEMP_SENSOR temp_sensors.c
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_TIMER hwtimer.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C i2c.c)
zephyr_library_sources_ifdef(CONFIG_SHIMMED_TASKS tasks.c)
-zephyr_library_sources_ifdef(CONFIG_WATCHDOG watchdog.c)
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_WATCHDOG watchdog.c)
zephyr_library_sources_ifndef(CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER
bc12.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201
diff --git a/zephyr/test/ec_app/src/main.c b/zephyr/test/ec_app/src/main.c
index 52a19f131c..3c317d2a08 100644
--- a/zephyr/test/ec_app/src/main.c
+++ b/zephyr/test/ec_app/src/main.c
@@ -46,7 +46,7 @@ ZTEST(ec_app_tests, test_setup_espi)
}
#endif
-#ifdef CONFIG_WATCHDOG
+#ifdef CONFIG_PLATFORM_EC_WATCHDOG
ZTEST(ec_app_tests, test_watchdog_init)
{
zassert_unreachable("TODO: Implement this test.");