diff options
-rw-r--r-- | util/flash_fp_mcu | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu index b1217b171a..5fcf5b102f 100644 --- a/util/flash_fp_mcu +++ b/util/flash_fp_mcu @@ -51,6 +51,12 @@ check_hardware_write_protect_disabled() { # Get the spiid for the fingerprint sensor based on the modalias # string: https://crbug.com/955117 get_spiid() { + # TODO(b/179533783): Fix modalias on strongbad and remove this bypass. + if [[ -n "${DEVICEID}" ]]; then + echo "${DEVICEID}" + exit 0 + fi + for dev in /sys/bus/spi/devices/*; do if [[ "$(cat "${dev}/modalias")" == "${CROS_EC_SPI_MODALIAS_STR}" ]]; then echo "$(basename "${dev}")" @@ -269,6 +275,14 @@ flash_fp_mcu_stm32() { echo "WARNING: One of the drivers changed NRST pin state on bind attempt." fi + # TODO(b/179530529): Remove this hack when the drivers on strongbad stop + # setting the gpio states. + if [[ "${PLATFORM_NAME}" == "strongbad" ]]; then + echo "# Fixing GPIOs" + gpio 1 "${gpio_boot0}" + gpio 0 "${gpio_nrst}" + fi + local attempt=0 local cmd_exit_status=1 local cmd="stm32mon ${stm32mon_flags}" @@ -305,7 +319,11 @@ flash_fp_mcu_stm32() { gpio 1 "${gpio_nrst}" # Give up GPIO control - gpio in "${gpio_boot0}" "${gpio_nrst}" + # TODO(b/179839337): Remove this for Strongbad DVT, where we should have + # correct external pulls on these lines. + if [[ "${PLATFORM_NAME}" != "strongbad" ]]; then + gpio in "${gpio_boot0}" "${gpio_nrst}" + fi gpio unexport "${gpio_boot0}" "${gpio_nrst}" # wait for FP MCU to come back up (including RWSIG delay) @@ -381,6 +399,23 @@ config_nocturne() { readonly GPIO_PWREN=371 } +config_strongbad() { + check_gpio_chip_exists "gpiochip392" + + readonly TRANSPORT="SPI" + readonly DEVICE="/dev/spidev10.0" + # TODO(b/179533783): Fix modalias on strongbad and remove this bypass. + readonly DEVICEID="spi10.0" + + # FPMCU RST_ODL is $(gpiofind FP_RST_L) is gpiochip0 22 + readonly GPIO_NRST=$((392 + $(gpiofind FP_RST_L|cut -f2 -d" "))) + # FPMCU BOOT0 is $(gpiofind FPMCU_BOOT0) is gpiochip0 10 + readonly GPIO_BOOT0=$((392 + $(gpiofind FPMCU_BOOT0|cut -f2 -d" "))) + # TODO(b/179839337): Hardware currently doesn't support PWREN, but the + # next revision will. Add a comment here about the power enable gpio. + readonly GPIO_PWREN=-1 +} + config_volteer() { check_gpio_chip_exists "gpiochip152" |