summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2022-10-10 11:52:54 +0200
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-10 17:18:58 +0000
commitff64a0a06fc22fb1539bff6b40a45807f6331fa0 (patch)
treed0aa6fde5e3e8067f6c05f1c2c5e9a333ce02799
parent63d448a1ac0d44eec4e1e6d7be9543deb14be0b2 (diff)
downloadchrome-ec-ff64a0a06fc22fb1539bff6b40a45807f6331fa0.tar.gz
flash_fp_mcu: Add support for 5.15+ kernel on Zork and Guybrush
Zork-kernelnext and guybrush-kernelnext are using 5.15 kernel which assigns different number to GPIO (shifted by 512). Change config in 'flash_fp_mcu' accordingly. BUG=b:251236295 BRANCH=none TEST=Run 'flash_fp_mcu --hello' on zork, zork-kernelnext, guybrush, guybrush-kernelnext. Cq-Include-Trybots: luci.chromeos.cq:cq-orchestrator Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I9ed744bef6e74a55270ad7bc2ca4b0fdb68ed1f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3942064 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Tested-by: Patryk Duda <patrykd@google.com> Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
-rw-r--r--util/flash_fp_mcu53
1 files changed, 38 insertions, 15 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu
index 4bdf17919d..ed30fdeb08 100644
--- a/util/flash_fp_mcu
+++ b/util/flash_fp_mcu
@@ -696,27 +696,50 @@ config_zork() {
readonly TRANSPORT="UART"
readonly DEVICE="/dev/ttyS1"
- readonly GPIO_CHIP="gpiochip256"
- # FPMCU RST_ODL is on AGPIO 11 = 256 + 11 = 267
- readonly GPIO_NRST=267
- # FPMCU BOOT0 is on AGPIO 69 = 256 + 69 = 325
- readonly GPIO_BOOT0=325
- # FPMCU PWR_EN is on AGPIO 32 = 256 + 32 = 288
- readonly GPIO_PWREN=288
+ local gpiochip="gpiochip768"
+ # Support kernel version 5.4 during transition to 5.15+
+ match_kernel_regex "^5\.4\." && gpiochip="gpiochip256"
+ readonly GPIO_CHIP="${gpiochip}"
+
+ local offset=0
+ # Support kernel version 5.4 during transition to 5.15+
+ # v5.4 has GPIOs that are offset by -512
+ match_kernel_regex "^5\.4\." && offset=512
+
+ # FPMCU RST_ODL is on AGPIO 11 = 768 + 11 = 779
+ local gpionrst=779
+ readonly GPIO_NRST=$(( gpionrst - offset ))
+ # FPMCU BOOT0 is on AGPIO 69 = 768 + 69 = 837
+ local gpioboot=837
+ readonly GPIO_BOOT0=$(( gpioboot - offset ))
+ # FPMCU PWR_EN is on AGPIO 32 = 768 + 32 = 800
+ local gpiopwren=800
+ readonly GPIO_PWREN=$(( gpiopwren - offset ))
}
config_guybrush() {
readonly TRANSPORT="UART"
-
readonly DEVICE="/dev/ttyS1"
- readonly GPIO_CHIP="gpiochip256"
- # FPMCU RST_ODL is on AGPIO 11 = 256 + 11 = 267
- readonly GPIO_NRST=267
- # FPMCU BOOT0 is on AGPIO 144 = 256 + 144 = 400
- readonly GPIO_BOOT0=400
- # FPMCU PWR_EN is on AGPIO 3 = 256 + 3 = 259
- readonly GPIO_PWREN=259
+ local gpiochip="gpiochip768"
+ # Support kernel version 5.10 during transition to 5.15+
+ match_kernel_regex "^5\.10\." && gpiochip="gpiochip256"
+ readonly GPIO_CHIP="${gpiochip}"
+
+ local offset=0
+ # Support kernel version 5.10 during transition to 5.15+
+ # v5.10 has GPIOs that are offset by -512
+ match_kernel_regex "^5\.10\." && offset=512
+
+ # FPMCU RST_ODL is on AGPIO 11 = 768 + 11 = 779
+ local gpionrst=779
+ readonly GPIO_NRST=$(( gpionrst - offset ))
+ # FPMCU BOOT0 is on AGPIO 144 = 768 + 144 = 912
+ local gpioboot=912
+ readonly GPIO_BOOT0=$(( gpioboot - offset ))
+ # FPMCU PWR_EN is on AGPIO 3 = 768 + 3 = 771
+ local gpiopwren=771
+ readonly GPIO_PWREN=$(( gpiopwren - offset ))
}
config_skyrim() {