blob: 5145009a656a5f4684321b00763ed9c41c470612 [file] [log] [blame]
Lancelot Kao96a7ee32021-02-22 18:50:48 -06001#!/bin/bash
2
3source /usr/sbin/kudo-lib.sh
Lancelot Kao19bfafb2021-05-25 15:04:57 -05004# sleep so that FRU and all ipmitool Devices are ready before HOST OS
5# gpio 143 for HPM_STBY_RST_N do to DC-SCM spec
6set_gpio_ctrl 143 out 1
7sleep 5 # for the MUX to get ready
Lancelot Kao96a7ee32021-02-22 18:50:48 -06008# set all mux route to CPU before power on host
9# BMC_CPU_RTC_I2C_SEL #120
10set_gpio_ctrl 120 out 1
11# BMC_CPU_DDR_I2C_SEL #84
12set_gpio_ctrl 84 out 1
13# BMC_CPU_EEPROM_I2C_SEL #85
14set_gpio_ctrl 85 out 1
15# BMC_CPU_PMBUS_SEL #86
16set_gpio_ctrl 86 out 1
17
18# LED control
XP Chen9b906962021-05-06 15:23:19 -050019# LED_BMC_LIVE #7
20set_gpio_ctrl 7 out 1
Lancelot Kao96a7ee32021-02-22 18:50:48 -060021
22# SPI control
23# Send command to CPLD to switch the bios spi interface to host
24i2cset -y -f -a 13 0x76 0x10 0x00
25
26# Power control
Lancelot Kao19bfafb2021-05-25 15:04:57 -050027# MON_BMC_ALIVE, GPIO 10(EVT), GPIO137(DVT)
Lancelot Kao96a7ee32021-02-22 18:50:48 -060028set_gpio_ctrl 10 out 1
Lancelot Kao19bfafb2021-05-25 15:04:57 -050029set_gpio_ctrl 137 out 1
Lancelot Kao96a7ee32021-02-22 18:50:48 -060030# S0_BMC_OK, GPIO 69
31set_gpio_ctrl 69 out 1
Lancelot Kao19bfafb2021-05-25 15:04:57 -050032
33# Disable CPU 1 CLK when cpu not detected
34boardver=$(printf '%d' `cat /sys/bus/i2c/drivers/fiicpld/34-0076/CMD00 | awk '{print $6}'`)
35# echo init_once cpu $CPU1_STATUS > /dev/ttyS0
36# echo init_once board $boardver > /dev/ttyS0
37CPU1_STATUS_N=$(get_gpio_ctrl 136)
38if [[ $CPU1_STATUS_N == 1 ]]; then
39 #Execute this only on DVT systems
40 if [[ $boardver == 0 ]]; then
41 echo EVT system $boardver
42 else
43 echo DVT system $boardver
44 i2cset -y -a -f 37 0x68 0x05 0x03
45 fi
46 #These i2c deviecs are already installed on EVT systems
47 i2cset -y -a -f 16 0x6a 0 1 0xdf i
48 i2cset -y -a -f 16 0x6a 11 1 0x01 i
49 i2cset -y -a -f 17 0x67 1 2 0x3f 0x0c i
50fi