blob: 08b288083f92753f5d7cb3bd86f65a0183b188bb [file] [log] [blame]
Patrick Ventureccd06d22017-04-10 15:21:32 -07001#!/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
Patrick Williams8c226232023-04-15 20:05:21 -050010 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 Ventureccd06d22017-04-10 15:21:32 -070013}
14
Patrick Venturedcdc84c2017-11-18 13:46:23 -080015GPIO_BASE=$(cat /sys/devices/platform/ahb/ahb:apb/1e780000.gpio/gpio/*/base)
Patrick Ventureccd06d22017-04-10 15:21:32 -070016
17# FM_BMC_READY_N, GPIO Q4, active low
Patrick Williams8c226232023-04-15 20:05:21 -050018set_gpio_active_low $((GPIO_BASE + 128 + 4)) high
Patrick Ventureccd06d22017-04-10 15:21:32 -070019
20# FM_BMC_SSB_SMI_LPC_N, GPIO Q6, active low
Patrick Williams8c226232023-04-15 20:05:21 -050021set_gpio_active_low $((GPIO_BASE + 128 + 6)) high
Patrick Ventureccd06d22017-04-10 15:21:32 -070022
23# FM_BMC_SYS_THROTTLE_N, GPIO A3, active low
Patrick Williams8c226232023-04-15 20:05:21 -050024set_gpio_active_low $((GPIO_BASE + 0 + 3)) high
Patrick Ventureccd06d22017-04-10 15:21:32 -070025
26# FM_BMC_SSB_SCI_LPC_N, GPIO E4, active low
Patrick Williams8c226232023-04-15 20:05:21 -050027set_gpio_active_low $((GPIO_BASE + 32 + 4)) high
Patrick Ventureccd06d22017-04-10 15:21:32 -070028
29# FP_PWR_BTN_PASS_R_N, GPIO D3, active low
Patrick Williams8c226232023-04-15 20:05:21 -050030set_gpio_active_low $((GPIO_BASE + 24 + 3)) high
Patrick Ventureccd06d22017-04-10 15:21:32 -070031
32exit 0;