1#!/bin/bash
2
3# Set all output GPIOs as such and drive them with reasonable values.
4function 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
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
13}
14
15GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base)
16
17# FM_BMC_READY_N, GPIO Q4, active low
18set_gpio_active_low $((${GPIO_BASE} + 128 + 4)) high
19
20# FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low
21set_gpio_active_low $((${GPIO_BASE} + 128 + 6)) high
22
23# FM_BMC_SYS_THROTTLE_N, GPIO A3, active low
24set_gpio_active_low $((${GPIO_BASE} + 0 + 3)) high
25
26# FM_BMC_SSB_SCI_LPC_N, GPIO E4, active low
27set_gpio_active_low $((${GPIO_BASE} + 32 + 4)) high
28
29# FP_PWR_BTN_PASS_R_N, GPIO D3, active low
30set_gpio_active_low $((${GPIO_BASE} + 24 + 3)) high
31
32exit 0;
33