summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-tiogapass/recipes-fbtp/fb-powerctrl/files/setup_gpio.sh
blob: 1b1b2e3f0ca781a828f22c83e86a2b8c60b012da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

# Set all output GPIOs as such and drive them with reasonable values.
function set_gpio_active_low() {
  if [ $# -ne 2 ]; then
    echo "set_gpio_active_low: need both GPIO# and initial level";
    return;
  fi

  echo $1 > /sys/class/gpio/export
  echo $2 > /sys/class/gpio/gpio$1/direction
}

GPIO_BASE=$(cat /sys/class/gpio/gpio*/base)

# FM_BMC_READY_N, GPIO S1, active low
set_gpio_active_low $((${GPIO_BASE} + 144 +1)) high

# FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low
#set_gpio_active_low $((${GPIO_BASE} + 128 + 6)) high

# FP_PWR_BTN_PASS_R_N, GPIO E3, active low
set_gpio_active_low $((${GPIO_BASE} + 32 + 3)) high

# FP_PWR_GOOD, GPIO B6, active low
set_gpio_active_low $((${GPIO_BASE} + 8 + 6)) in

# SYSRST_BTN_OUT_N, GPIO E1, active low
set_gpio_active_low $((${GPIO_BASE} + 32 + 1)) high

# FP_PECI_MUX, active low
set_gpio_active_low $((${GPIO_BASE} + 212)) high

# Set PECI Mux to high to select Peci interface
echo 1 > /sys/class/gpio/gpio$((${GPIO_BASE} + 212))/value


exit 0;