summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Hesling <hesling@chromium.org>2021-01-28 20:32:33 -0800
committerCommit Bot <commit-bot@chromium.org>2021-02-22 21:12:32 +0000
commit1d878115a26f2f583cd5d0d01a1c6cf2993b2776 (patch)
treeb687f3a72d542cd3d01ee9dbb4d68819c24f98df
parent56cad56df12fcd4f7e0ebe2409ca26650961b198 (diff)
downloadchrome-ec-1d878115a26f2f583cd5d0d01a1c6cf2993b2776.tar.gz
flash_fp_mcu: Add initial support for strongbad
Caveats * Need to fix modalias for strongbad * Need to fix driver binding so that the gpios are not reset * Need to fix external nrst pull BRANCH=none BUG=b:145245345, b:172966748, b:179533783, b:179530529, b:179839337 TEST=emerge-strongbad chromeos-base/ec-utils-test cros deploy dut1 chromeos-base/ec-utils-test ./flash_fp_mcu custom-strongbad-evt-image.bin Change-Id: I33d8fee21a2afbf8f5c399e6cb47c2095d833f57 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654737 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2713553 Tested-by: Sujit Kautkar <sujitka@chromium.org> Reviewed-by: Sujit Kautkar <sujitka@chromium.org> Commit-Queue: Sujit Kautkar <sujitka@chromium.org>
-rw-r--r--util/flash_fp_mcu37
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"