Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Set all output GPIOs as such and drive them with reasonable values. |
| 4 | function set_gpio_active_low() { |
| 5 | if [ $# -ne 2 ]; then |
| 6 | echo "set_gpio_active_low: need both GPIO# and initial level"; |
| 7 | return; |
| 8 | fi |
| 9 | |
Patrick Williams | 8c22623 | 2023-04-15 20:05:21 -0500 | [diff] [blame^] | 10 | echo "$1" > /sys/class/gpio/export |
| 11 | echo 1 > "/sys/class/gpio/gpio$1/active_low" |
| 12 | echo "$2" > "/sys/class/gpio/gpio$1/direction" |
Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 13 | } |
| 14 | |
Patrick Venture | dcdc84c | 2017-11-18 13:46:23 -0800 | [diff] [blame] | 15 | GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base) |
Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 16 | |
| 17 | # FM_BMC_READY_N, GPIO Q4, active low |
Patrick Williams | 8c22623 | 2023-04-15 20:05:21 -0500 | [diff] [blame^] | 18 | set_gpio_active_low $((GPIO_BASE + 128 + 4)) high |
Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 19 | |
| 20 | # FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low |
Patrick Williams | 8c22623 | 2023-04-15 20:05:21 -0500 | [diff] [blame^] | 21 | set_gpio_active_low $((GPIO_BASE + 128 + 6)) high |
Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 22 | |
| 23 | # FM_BMC_SYS_THROTTLE_N, GPIO A3, active low |
Patrick Williams | 8c22623 | 2023-04-15 20:05:21 -0500 | [diff] [blame^] | 24 | set_gpio_active_low $((GPIO_BASE + 0 + 3)) high |
Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 25 | |
| 26 | # FM_BMC_SSB_SCI_LPC_N, GPIO E4, active low |
Patrick Williams | 8c22623 | 2023-04-15 20:05:21 -0500 | [diff] [blame^] | 27 | set_gpio_active_low $((GPIO_BASE + 32 + 4)) high |
Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 28 | |
| 29 | # FP_PWR_BTN_PASS_R_N, GPIO D3, active low |
Patrick Williams | 8c22623 | 2023-04-15 20:05:21 -0500 | [diff] [blame^] | 30 | set_gpio_active_low $((GPIO_BASE + 24 + 3)) high |
Patrick Venture | ccd06d2 | 2017-04-10 15:21:32 -0700 | [diff] [blame] | 31 | |
| 32 | exit 0; |