diff options
author | Craig Hesling <hesling@chromium.org> | 2021-07-15 18:28:55 -0400 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-08-05 21:36:30 +0000 |
commit | c8af797e53fcacac5fde4c5f2beeb7bfce207146 (patch) | |
tree | 54a55cbada1de71324b93746791b9aa332492203 | |
parent | 69d96e325f9f9060e64fece1e04cf2963ccef3ab (diff) | |
download | chrome-ec-c8af797e53fcacac5fde4c5f2beeb7bfce207146.tar.gz |
flash_fp_mcu: Add FPMCU power cycle
This is a workaround for the dartmonkey RO flash init bug,
where a boot loop occurs when HW-WP is disabled, but SW-WP
is still enabled.
We force a true power-on-reset so that flash init function in RO
sees that SW-WP cannot be removed (and is "stuck").
BRANCH=none
BUG=b:146428434,b:187387061,b:143374692
TEST=# Test on helios, bard, and nocturne
scp util/flash_fp_mcu ${DUT_HOSTNAME}:/usr/local/bin/flash_fp_mcu
ssh ${DUT_HOSTNAME} ectool --name=cros_fp reboot_ec
ssh ${DUT_HOSTNAME} ectool --name=cros_fp uptimeinfo
# No power-on reset flag should be set.
ssh ${DUT_HOSTNAME} flash_fp_mcu
# Check that power-on reset flag is set.
# If you were to check the uptimeinfo after flash_fp_mu
# finished, you would see a few seconds later that the
# power-on flag is gone. This is because biod's startup
# would reinitialize entropy and cause reset.
TEST=# Test on morphius
scp util/flash_fp_mcu ${DUT_HOSTNAME}:/usr/local/bin/flash_fp_mcu
ssh ${DUT_HOSTNAME} flash_fp_mcu
# Just make sure we didn't break the script.
Signed-off-by: Craig Hesling <hesling@chromium.org>
Change-Id: Ib8e239c6c0d5e5de66da2e664374a80479eb4098
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3032665
Commit-Queue: Josie Nordrum <josienordrum@google.com>
Reviewed-by: Josie Nordrum <josienordrum@google.com>
-rw-r--r-- | util/flash_fp_mcu | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu index 2b2e31918f..94551c5741 100644 --- a/util/flash_fp_mcu +++ b/util/flash_fp_mcu @@ -414,11 +414,26 @@ flash_fp_mcu_stm32() { fi gpio unexport "${gpio_boot0}" "${gpio_nrst}" - # wait for FP MCU to come back up (including RWSIG delay) - sleep 2 + # Dartmonkey's RO has a flashprotect logic issue that forces reboot loops + # when SW-WP is enabled and HW-WP is disabled. It is avoided if a POR is + # detected on boot. We force a POR here to ensure we avoid this reboot loop. + # See to b/146428434. + if [[ "${gpio_pwren}" -gt 0 ]]; then + echo "Power cycling the FPMCU." + gpio export "${gpio_pwren}" + gpio out "${gpio_pwren}" + gpio 0 "${gpio_pwren}" + # Must outlast hardware soft start, which is typically ~3ms. + sleep 0.5 + gpio 1 "${gpio_pwren}" + # Power enable line is externally pulled down, so leave as output-high. + gpio unexport "${gpio_pwren}" + fi # Put back cros_fp driver if transport is SPI if [[ "${transport}" != "UART" ]]; then + # wait for FP MCU to come back up (including RWSIG delay) + sleep 2 klog "Binding cros-ec driver" echo "" > "/sys/bus/spi/devices/${deviceid}/driver_override" echo "${deviceid}" > /sys/bus/spi/drivers/cros-ec-spi/bind @@ -434,8 +449,9 @@ flash_fp_mcu_stm32() { echo "Please reboot this device." else # Test it - klog "Query version" + klog "Query version and reset flags" ectool --name=cros_fp version + ectool --name=cros_fp uptimeinfo fi } |