summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMatt Davis <mattedavis@google.com>2022-02-06 12:05:09 -0800
committerCommit Bot <commit-bot@chromium.org>2022-02-07 21:36:35 +0000
commite4455cc4a12a1579bee8d06b29e4ca1555f77cf2 (patch)
treee482a8f798ef0bb92bf7782ebd16475199fb50a0 /util
parent55daab4bfd516c59b45cb4d9041e55d810ecbf97 (diff)
downloadchrome-ec-e4455cc4a12a1579bee8d06b29e4ca1555f77cf2.tar.gz
flash_fp_mcu: Fix FPMCU flashing on nami/nami-kernelnext
The 4.4 and 5.4 kernel use different DEVICE constants, but the kernel version cannot necessarily be inferred from the platform name. This change adds a regex-based kernel version check and consolidates config_nami and config_nami-kernelnext into a single function. BUG=b:218213808 BRANCH=none TEST=on bard using both the 4.4 and 5.4 kernels: flash_fp_mcu --noservices Signed-off-by: Matt Davis <mattedavis@google.com> Change-Id: I1c61658d5d652c175fc43dea09d1b40f80ae4cb6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3442758 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/flash_fp_mcu27
1 files changed, 16 insertions, 11 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu
index 426e824180..950642a109 100644
--- a/util/flash_fp_mcu
+++ b/util/flash_fp_mcu
@@ -209,6 +209,16 @@ get_platform_name() {
echo "${platform_name}"
}
+# Test the current running kernel version against a regular expression.
+# Returns 0 if the regex matches.
+match_kernel_regex() {
+ local match_exp=$1
+ local kversion
+ kversion=$(uname -r)
+ [[ $kversion =~ $match_exp ]]
+ return $?
+}
+
# Given a full platform name, extract the base platform.
#
# Tests are also run on modified images, like hatch-arc-r, hatch-borealis, or
@@ -516,8 +526,12 @@ config_herobrine() {
}
config_nami() {
+ local device="/dev/spidev1.0"
+ # Support kernel version 4.4 during transition to 5.4
+ match_kernel_regex "^4\.4\." && device="/dev/spidev32765.0"
+
readonly TRANSPORT="SPI"
- readonly DEVICE="/dev/spidev1.0"
+ readonly DEVICE="${device}"
readonly GPIO_CHIP="gpiochip360"
# FPMCU RST_ODL is on GPP_C9 = 360 + 57 = 417
@@ -529,16 +543,7 @@ config_nami() {
}
config_nami-kernelnext() {
- readonly TRANSPORT="SPI"
- readonly DEVICE="/dev/spidev1.0"
-
- readonly GPIO_CHIP="gpiochip360"
- # FPMCU RST_ODL is on GPP_C9 = 360 + 57 = 417
- readonly GPIO_NRST=417
- # FPMCU BOOT0 is on GPP_D5 = 360 + 77 = 437
- readonly GPIO_BOOT0=437
- # FP_PWR_EN is on GPP_B11 = 360 + 35 = 395
- readonly GPIO_PWREN=395
+ config_nami
}
config_nocturne() {