diff options
author | Craig Hesling <hesling@chromium.org> | 2021-07-06 19:22:44 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-22 22:12:40 +0000 |
commit | 04fa88c66ab876842d1e8d3b7ffedfec1408eef8 (patch) | |
tree | 1a51494d2f86b3082709ecc9c64d592e922ba618 | |
parent | 688162ec7d780c62d8435ebb91f3ad35bf67420c (diff) | |
download | chrome-ec-04fa88c66ab876842d1e8d3b7ffedfec1408eef8.tar.gz |
flash_fp_mcu: Log actions to kernel log
We note our flash_fp_mcu actions to the kernel log in order to be
able to debug what action of the script may have triggered a kernel
warning or error.
This is for debugging current and future issues with the kernel
and flash_fp_mcu.
BRANCH=none
BUG=b:190744837
TEST=# On Nami and Zork
scp util/flash_fp_mcu ${DUT_HOSTNAME}:/usr/local/bin/flash_fp_mcu
ssh ${DUT_HOSTNAME} flash_fp_mcu --hello
dmesg
Change-Id: Ie57b1042d20284065a652b0a805c081a9591280c
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3010624
Reviewed-by: Patryk Duda <patrykd@google.com>
Reviewed-by: Jora Jacobi <jora@google.com>
(cherry picked from commit b0e93341bc75ff677afa520322fb61eaac98c4f1)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3041184
Commit-Queue: Jora Jacobi <jora@google.com>
-rw-r--r-- | util/flash_fp_mcu | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu index a2f7b118a8..827aa398de 100644 --- a/util/flash_fp_mcu +++ b/util/flash_fp_mcu @@ -39,6 +39,10 @@ readonly CROS_EC_SPI_MODALIAS_STR="of:NcrfpTCgoogle,cros-ec-spi" readonly CROS_EC_UART_MODALIAS_STR="of:NcrfpTCgoogle,cros-ec-uart" +klog() { + echo "flash_fp_mcu: $*" > /dev/kmsg +} + check_hardware_write_protect_disabled() { local hardware_write_protect_state if ! hardware_write_protect_state="$(crossystem wpsw_cur)"; then @@ -93,18 +97,22 @@ gpio() { for signal in "$@"; do case "${cmd}" in unexport|export) + klog "Set gpio ${signal} to ${cmd}" echo "${signal}" > "/sys/class/gpio/${cmd}" ;; in|out) local direction="${cmd}" + klog "Set gpio ${signal} direction to ${direction}" echo "${direction}" > "/sys/class/gpio/gpio${signal}/direction" ;; 0|1) local value="${cmd}" + klog "Set gpio ${signal} to ${value}" echo "${value}" > "/sys/class/gpio/gpio${signal}/value" ;; get) local value="${cmd}" + klog "Get gpio ${signal}" cat "/sys/class/gpio/gpio${signal}/value" ;; *) @@ -299,6 +307,7 @@ flash_fp_mcu_stm32() { fi # Remove cros_fp if present + klog "Unbinding cros-ec driver" if [[ "${transport}" == "UART" ]]; then echo "${deviceid}" > /sys/bus/serial/drivers/cros-ec-uart/unbind else @@ -314,6 +323,7 @@ flash_fp_mcu_stm32() { gpio 0 "${gpio_nrst}" sleep 0.001 + klog "Binding raw driver" if [[ "${transport}" == "UART" ]]; then # load AMDI0020:01 ttyS1 echo AMDI0020:01 > /sys/bus/platform/drivers/dw-apb-uart/unbind; @@ -374,6 +384,7 @@ flash_fp_mcu_stm32() { # unload device if [[ "${transport}" != "UART" ]]; then + klog "Unbinding raw driver" echo "${deviceid}" > /sys/bus/spi/drivers/spidev/unbind fi @@ -395,6 +406,7 @@ flash_fp_mcu_stm32() { # Put back cros_fp driver if transport is SPI if [[ "${transport}" != "UART" ]]; then + klog "Binding cros-ec driver" echo "" > "/sys/bus/spi/devices/${deviceid}/driver_override" echo "${deviceid}" > /sys/bus/spi/drivers/cros-ec-spi/bind @@ -414,6 +426,7 @@ flash_fp_mcu_stm32() { echo "Please reboot this device." else # Test it + klog "Query version" ectool --name=cros_fp version fi } |