Delphine CC Chiu | 177e987 | 2023-09-22 10:30:23 +0800 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | # shellcheck source=meta-facebook/meta-yosemite4/recipes-yosemite4/plat-tool/files/yosemite4-common-functions |
| 3 | source /usr/libexec/yosemite4-common-functions |
| 4 | |
Allen.Wang | 1fd57fe | 2024-04-03 18:03:11 +0800 | [diff] [blame] | 5 | |
| 6 | enable_all_fan_input() |
| 7 | { |
| 8 | for file in /sys/bus/i2c/devices/*/hwmon/*/fan*_enable |
| 9 | do |
| 10 | echo 1 > "${file}" |
| 11 | done |
| 12 | } |
| 13 | |
Eric | a29bca5 | 2023-12-05 10:27:41 +0800 | [diff] [blame] | 14 | # probe devices behind mux for management board cpld |
| 15 | |
| 16 | rev_id_gpiochip=$(basename "/sys/bus/i2c/devices/13-0020/"*gpiochip*) |
| 17 | rev_id_bit0=$(gpioget "$rev_id_gpiochip" 0) |
| 18 | rev_id_bit1=$(gpioget "$rev_id_gpiochip" 1) |
| 19 | rev_id_bit2=$(gpioget "$rev_id_gpiochip" 2) |
| 20 | rev_id_bit3=$(gpioget "$rev_id_gpiochip" 3) |
| 21 | |
| 22 | # Default devicetree was set for EVT and later, only POC will do following manual devices' probing |
| 23 | if [ "$rev_id_bit0" -eq 0 ] && [ "$rev_id_bit1" -eq 0 ] && [ "$rev_id_bit2" -eq 0 ] && [ "$rev_id_bit3" -eq 0 ] |
| 24 | then |
| 25 | echo 24c128 "0x50" > /sys/bus/i2c/devices/i2c-12/new_device |
| 26 | echo 24c64 "0x54" > /sys/bus/i2c/devices/i2c-12/new_device |
| 27 | echo tmp75 "0x48" > /sys/bus/i2c/devices/i2c-12/new_device |
| 28 | echo nct3018y "0x6f" > /sys/bus/i2c/devices/i2c-12/new_device |
| 29 | fi |
| 30 | |
Delphine CC Chiu | 177e987 | 2023-09-22 10:30:23 +0800 | [diff] [blame] | 31 | # set initial value for GPIO output pins |
| 32 | set_gpio EN_P5V_USB_CPLD_R 1 |
| 33 | set_gpio EN_NIC0_POWER_BMC_R 1 |
| 34 | set_gpio EN_NIC1_POWER_BMC_R 1 |
| 35 | set_gpio EN_NIC2_POWER_BMC_R 1 |
| 36 | set_gpio EN_NIC3_POWER_BMC_R 1 |
| 37 | set_gpio FM_BMC_RTCRST_R 0 |
| 38 | set_gpio RST_USB_HUB_R_N 1 |
| 39 | set_gpio FM_BMC_READY_R2 1 |
| 40 | set_gpio SPI_LOCK_REQ_BMC_N 1 |
| 41 | set_gpio EN_P3V_BAT_SCALED_R 0 |
| 42 | |
Delphine CC Chiu | 177e987 | 2023-09-22 10:30:23 +0800 | [diff] [blame] | 43 | set_gpio NIC0_MAIN_PWR_EN 1 |
| 44 | set_gpio NIC1_MAIN_PWR_EN 1 |
| 45 | set_gpio NIC2_MAIN_PWR_EN 1 |
| 46 | set_gpio NIC3_MAIN_PWR_EN 1 |
| 47 | |
Delphine CC Chiu | 05c30e1 | 2024-03-06 13:21:47 +0800 | [diff] [blame] | 48 | # short-term set gpio v0~v3 to input pin for slot5~8 reset button |
| 49 | mknod -m 660 /dev/mem c 1 1 |
| 50 | chown root:kmem /dev/mem |
| 51 | devmem 0x1e78008c 32 0x19000000 |
| 52 | |
Allen.Wang | 1fd57fe | 2024-04-03 18:03:11 +0800 | [diff] [blame] | 53 | # Enable all fan input as early as possible |
| 54 | enable_all_fan_input |
| 55 | |
Delphine CC Chiu | 177e987 | 2023-09-22 10:30:23 +0800 | [diff] [blame] | 56 | exit 0 |