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