summaryrefslogtreecommitdiff
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-11 19:57:54 +0000
commit58febdef536b153b6f6bbb2f25474f7c89322d7e (patch)
tree6179990d181f02b647af4e53d461471142093e7c
parent765d56243a2a8d612c1f82418d174d8421fe0530 (diff)
downloadchrome-ec-stabilize-14469.58.B-main.tar.gz
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> (cherry picked from commit e4455cc4a12a1579bee8d06b29e4ca1555f77cf2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3454213 Commit-Queue: Tom Hughes <tomhughes@chromium.org>
-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() {