Lancelot Kao | 96a7ee3 | 2021-02-22 18:50:48 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | source /usr/sbin/kudo-lib.sh |
XP Chen | 0fb270a | 2021-08-26 17:30:19 -0500 | [diff] [blame^] | 4 | # 0 for EVT. DVT will have a non-zero board version |
| 5 | boardver=$(printf '%d' `cat /sys/bus/i2c/drivers/fiicpld/34-0076/CMD00 | awk '{print $6}'`) |
Lancelot Kao | 19bfafb | 2021-05-25 15:04:57 -0500 | [diff] [blame] | 6 | # sleep so that FRU and all ipmitool Devices are ready before HOST OS |
| 7 | # gpio 143 for HPM_STBY_RST_N do to DC-SCM spec |
| 8 | set_gpio_ctrl 143 out 1 |
XP Chen | 0fb270a | 2021-08-26 17:30:19 -0500 | [diff] [blame^] | 9 | sleep 5 # for the MUX to get ready |
Lancelot Kao | 96a7ee3 | 2021-02-22 18:50:48 -0600 | [diff] [blame] | 10 | # set all mux route to CPU before power on host |
| 11 | # BMC_CPU_RTC_I2C_SEL #120 |
| 12 | set_gpio_ctrl 120 out 1 |
| 13 | # BMC_CPU_DDR_I2C_SEL #84 |
| 14 | set_gpio_ctrl 84 out 1 |
XP Chen | 0fb270a | 2021-08-26 17:30:19 -0500 | [diff] [blame^] | 15 | # On EVT machines, the secondary SCP EEPROM is used. |
| 16 | # Set BMC_I2C_BACKUP_SEL to secondary. |
| 17 | if [[ $boardver == 0 ]]; then |
| 18 | echo "EVT system. Choosing secondary SCP EEPROM." |
| 19 | set_gpio_ctrl 168 out 0 |
| 20 | fi |
Lancelot Kao | 96a7ee3 | 2021-02-22 18:50:48 -0600 | [diff] [blame] | 21 | # BMC_CPU_EEPROM_I2C_SEL #85 |
| 22 | set_gpio_ctrl 85 out 1 |
| 23 | # BMC_CPU_PMBUS_SEL #86 |
| 24 | set_gpio_ctrl 86 out 1 |
| 25 | |
| 26 | # LED control |
XP Chen | 9b90696 | 2021-05-06 15:23:19 -0500 | [diff] [blame] | 27 | # LED_BMC_LIVE #7 |
| 28 | set_gpio_ctrl 7 out 1 |
Lancelot Kao | 96a7ee3 | 2021-02-22 18:50:48 -0600 | [diff] [blame] | 29 | |
| 30 | # SPI control |
| 31 | # Send command to CPLD to switch the bios spi interface to host |
| 32 | i2cset -y -f -a 13 0x76 0x10 0x00 |
| 33 | |
| 34 | # Power control |
Lancelot Kao | 19bfafb | 2021-05-25 15:04:57 -0500 | [diff] [blame] | 35 | # MON_BMC_ALIVE, GPIO 10(EVT), GPIO137(DVT) |
Lancelot Kao | 96a7ee3 | 2021-02-22 18:50:48 -0600 | [diff] [blame] | 36 | set_gpio_ctrl 10 out 1 |
Lancelot Kao | 19bfafb | 2021-05-25 15:04:57 -0500 | [diff] [blame] | 37 | set_gpio_ctrl 137 out 1 |
Lancelot Kao | 96a7ee3 | 2021-02-22 18:50:48 -0600 | [diff] [blame] | 38 | # S0_BMC_OK, GPIO 69 |
| 39 | set_gpio_ctrl 69 out 1 |
Lancelot Kao | 19bfafb | 2021-05-25 15:04:57 -0500 | [diff] [blame] | 40 | |
| 41 | # Disable CPU 1 CLK when cpu not detected |
| 42 | boardver=$(printf '%d' `cat /sys/bus/i2c/drivers/fiicpld/34-0076/CMD00 | awk '{print $6}'`) |
| 43 | # echo init_once cpu $CPU1_STATUS > /dev/ttyS0 |
| 44 | # echo init_once board $boardver > /dev/ttyS0 |
| 45 | CPU1_STATUS_N=$(get_gpio_ctrl 136) |
| 46 | if [[ $CPU1_STATUS_N == 1 ]]; then |
| 47 | #Execute this only on DVT systems |
| 48 | if [[ $boardver == 0 ]]; then |
| 49 | echo EVT system $boardver |
| 50 | else |
| 51 | echo DVT system $boardver |
| 52 | i2cset -y -a -f 37 0x68 0x05 0x03 |
| 53 | fi |
| 54 | #These i2c deviecs are already installed on EVT systems |
| 55 | i2cset -y -a -f 16 0x6a 0 1 0xdf i |
| 56 | i2cset -y -a -f 16 0x6a 11 1 0x01 i |
| 57 | i2cset -y -a -f 17 0x67 1 2 0x3f 0x0c i |
| 58 | fi |