blob: 437fd445c483f4f56e35579e73ff73df7d2d51aa [file] [log] [blame]
Delphine CC Chiu177e9872023-09-22 10:30:23 +08001#!/bin/bash -e
2# shellcheck source=meta-facebook/meta-yosemite4/recipes-yosemite4/plat-tool/files/yosemite4-common-functions
3source /usr/libexec/yosemite4-common-functions
4
Tim Lee52b63362024-07-22 15:35:49 +08005is_nuvoton_board="$(check_nuvoton_board)"
Allen.Wang1fd57fe2024-04-03 18:03:11 +08006
7enable_all_fan_input()
8{
9 for file in /sys/bus/i2c/devices/*/hwmon/*/fan*_enable
10 do
11 echo 1 > "${file}"
12 done
13}
14
Tim Lee68f27092024-07-19 11:20:47 +080015set_sd_bic_interface_to_i3c()
16{
17 for host_bus in $(seq 0 7);
18 do
19 GPIOCHIP=$(basename /sys/bus/i2c/devices/"$host_bus"-0023/*gpiochip*)
20 if [ "$GPIOCHIP" != "*gpiochip*" ]; then
21 gpioset "$GPIOCHIP" 24=1
22 fi
23 done
24}
25
Delphine CC Chiu177e9872023-09-22 10:30:23 +080026# set initial value for GPIO output pins
27set_gpio EN_P5V_USB_CPLD_R 1
28set_gpio EN_NIC0_POWER_BMC_R 1
29set_gpio EN_NIC1_POWER_BMC_R 1
30set_gpio EN_NIC2_POWER_BMC_R 1
31set_gpio EN_NIC3_POWER_BMC_R 1
32set_gpio FM_BMC_RTCRST_R 0
33set_gpio RST_USB_HUB_R_N 1
34set_gpio FM_BMC_READY_R2 1
35set_gpio SPI_LOCK_REQ_BMC_N 1
36set_gpio EN_P3V_BAT_SCALED_R 0
MarshallZhana365e4b2024-07-18 18:13:19 +080037set_gpio FM_BMC_SLED_CYCLE_R 0
Delphine CC Chiu177e9872023-09-22 10:30:23 +080038
Delphine CC Chiu177e9872023-09-22 10:30:23 +080039set_gpio NIC0_MAIN_PWR_EN 1
40set_gpio NIC1_MAIN_PWR_EN 1
41set_gpio NIC2_MAIN_PWR_EN 1
42set_gpio NIC3_MAIN_PWR_EN 1
43
Tim Lee52b63362024-07-22 15:35:49 +080044if [ -z "$is_nuvoton_board" ]
Tim Lee1b847b22024-07-18 14:29:03 +080045then
46 # short-term set gpio v0~v3 to input pin for slot5~8 reset button
47 mknod -m 660 /dev/mem c 1 1
48 chown root:kmem /dev/mem
49 devmem 0x1e78008c 32 0x19000000
50fi
Delphine CC Chiu05c30e12024-03-06 13:21:47 +080051
Allen.Wang1fd57fe2024-04-03 18:03:11 +080052# Enable all fan input as early as possible
53enable_all_fan_input
54
Tim Lee52b63362024-07-22 15:35:49 +080055if [ -n "$is_nuvoton_board" ]
Tim Lee68f27092024-07-19 11:20:47 +080056then
57 # Set interface to SD BIC to I3C for Nuvoton BMC
58 set_sd_bic_interface_to_i3c
59fi
60
Delphine CC Chiu177e9872023-09-22 10:30:23 +080061exit 0