summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2023-01-25 16:09:38 +0100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-20 17:18:17 +0000
commit985ccf1df14d90a20589d39077cb8c29d4d08e23 (patch)
tree4ab7752b59252ebe2b2e81fdb77cf469bdbc932c
parentc56fcc601f443721999c1e8787eb1371b5ac9ce3 (diff)
downloadchrome-ec-985ccf1df14d90a20589d39077cb8c29d4d08e23.tar.gz
flash_fp_mcu: Dynamically determine gpiochip number for guybrush
Guybrush-kernelnext uses upstream kernel which changes every week. In this case it's cumbersome to hardcode gpiochip number in the script and we should determine it dynamically. BUG=b:269985136 BRANCH=none TEST=Run `flash_fp_mcu --hello` on guybrush and guybrush-kernelnext Change-Id: Ia416b664fffdaf0dd9bf14e79da6fd6f4d9c05f0 Signed-off-by: Patryk Duda <pdk@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4271785 Commit-Queue: Patryk Duda <patrykd@google.com> Reviewed-by: Josie Nordrum <josienordrum@google.com> Tested-by: Patryk Duda <patrykd@google.com>
-rw-r--r--util/flash_fp_mcu33
1 files changed, 16 insertions, 17 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu
index b857ba82f6..8a01a074df 100644
--- a/util/flash_fp_mcu
+++ b/util/flash_fp_mcu
@@ -745,25 +745,24 @@ config_guybrush() {
readonly TRANSPORT="UART"
readonly DEVICE="/dev/ttyS1"
- 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 gpiochip_dev_path="*/platform/AMD0030\:00/gpio/*"
+ local gpiobase
+ if ! gpiobase=$(get_sysfs_gpiochip_base "${gpiochip_dev_path}"); then
+ echo "Unable to find gpio chip base"
+ return "${EXIT_PRECONDITION}"
+ fi
- 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
+ local GPIO_CHIP="gpiochip${gpiobase}"
- # 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 ))
+ # FPMCU RST_ODL is on AGPIO 11
+ local gpionrst=11
+ readonly GPIO_NRST=$(( gpionrst + gpiobase ))
+ # FPMCU BOOT0 is on AGPIO 144
+ local gpioboot=144
+ readonly GPIO_BOOT0=$(( gpioboot + gpiobase ))
+ # FPMCU PWR_EN is on AGPIO 3
+ local gpiopwren=3
+ readonly GPIO_PWREN=$(( gpiopwren + gpiobase ))
}
config_skyrim() {