1#!/bin/bash
2
3# shellcheck source=/dev/null
4source /usr/sbin/gpio-lib.sh
5
6# GPIOAC3 BMC_SPI0_BACKUP_SEL Boot from MAIN SPI-HOST
7gpio_configure_output 227 0
8
9# GPIOM4 S0_I2C9_ALERT_L
10gpio_configure_input 100
11
12# GPIOM5 S1_I2C9_ALERT_L
13gpio_configure_input 101
14
15# GPIOQ7 GPIO_BMC_VGA_FRONT_PRES_L
16gpio_configure_input 135
17
18# GPIOS0 GPIO_S0_VRHOT_L
19gpio_configure_input 144
20
21# GPIOS1 GPIO_S1_VRHOT_L
22gpio_configure_input 145
23
24# GPIOY3 BMC_VGA_SEL
25gpio_configure_output 195 1
26
27# GPIO_BMC_READY
28gpio_configure_output 229 1
29
30# =======================================================
31# Below GPIOs are controlled by other services so just
32# initialize in A/C power only.
33bootstatus=$(cat /sys/class/watchdog/watchdog0/bootstatus)
34if [ "$bootstatus" == '32' ]; then
35	# BMC_GPIOR2_EXT_HIGHTEMP_L
36	gpio_configure_output 138 1
37
38	# GPIOS5 GPIO_BMC_VR_PMBUS_SEL_L
39	gpio_configure_output 149 1
40
41	# GPIOH7 GPIO_BMC_I2C6_RESET_L
42	gpio_configure_output 63 1
43
44	# GPIO_BMC_OCP_AUX_PWREN
45	gpio_configure_output 139 1
46
47	# GPIO_BMC_OCP_MAIN_PWREN
48	gpio_configure_output 140 0
49
50	# BMC_GPIOAC2_SPI0_PROGRAM_SEL
51	gpio_configure_output 226 0
52
53	# BMC_GPIOB0_I2C_BACKUP_SEL
54	gpio_configure_output 8 1
55fi
56