summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/flash_fp_mcu36
1 files changed, 18 insertions, 18 deletions
diff --git a/util/flash_fp_mcu b/util/flash_fp_mcu
index e383186a9f..2d859f3dba 100644
--- a/util/flash_fp_mcu
+++ b/util/flash_fp_mcu
@@ -524,24 +524,24 @@ config_hatch() {
# Examine `cat /sys/kernel/debug/pinctrl/INT34BB:00/gpio-ranges` on a hatch
# device to determine gpio number from pin number.
- local gpiochip="gpiochip712"
- # Support kernel version 4.x, 5.4 and 5.10 during transition to 5.15+
- match_kernel_regex "^((4\..)|(5\.4\.)|(5\.10\.))" && gpiochip="gpiochip200"
- readonly GPIO_CHIP="${gpiochip}"
- local offset=0
- # Support kernel version 4.x, 5.4 and 5.10 during transition to 5.15+
- # v4.4 has GPIOs that are offset by -512
- match_kernel_regex "^((4\..)|(5\.4\.)|(5\.10\.))" && offset=512
-
- # FPMCU RST_ODL is on GPP_A12 = 712 + 12 = 724
- local gpionrst=724
- readonly GPIO_NRST=$(( gpionrst - offset ))
- # FPMCU BOOT0 is on GPP_A22 = 712 + 22 = 734
- local gpioboot=734
- readonly GPIO_BOOT0=$(( gpioboot - offset ))
- # FP_PWR_EN is on GPP_C11 = 968 + (192 - 181) = 968 + 11 = 979
- local gpiopwren=979
- readonly GPIO_PWREN=$(( gpiopwren - offset ))
+ local gpiochip_dev_path="*/pci0000\:00/INT34BB\: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 GPIO_CHIP="gpiochip${gpiobase}"
+
+ # FPMCU RST_ODL is on GPP_A12 = 12
+ local gpionrst=12
+ readonly GPIO_NRST=$(( gpionrst + gpiobase ))
+ # FPMCU BOOT0 is on GPP_A22 = 22
+ local gpioboot=22
+ readonly GPIO_BOOT0=$(( gpioboot + gpiobase ))
+ # FP_PWR_EN is on GPP_C11 = 256 + 11 = 267
+ local gpiopwren=267
+ readonly GPIO_PWREN=$(( gpiopwren + gpiobase ))
}
config_herobrine() {