blob: adb86f23868a50afe6be974a4b05f4951aa46e1a [file] [log] [blame]
Lancelot Kao96a7ee32021-02-22 18:50:48 -06001#!/bin/bash
2
3source /usr/sbin/kudo-lib.sh
XP Chen0fb270a2021-08-26 17:30:19 -05004# 0 for EVT. DVT will have a non-zero board version
5boardver=$(printf '%d' `cat /sys/bus/i2c/drivers/fiicpld/34-0076/CMD00 | awk '{print $6}'`)
Lancelot Kao19bfafb2021-05-25 15:04:57 -05006# 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
8set_gpio_ctrl 143 out 1
XP Chen0fb270a2021-08-26 17:30:19 -05009sleep 5 # for the MUX to get ready
Lancelot Kao96a7ee32021-02-22 18:50:48 -060010# set all mux route to CPU before power on host
11# BMC_CPU_RTC_I2C_SEL #120
12set_gpio_ctrl 120 out 1
13# BMC_CPU_DDR_I2C_SEL #84
14set_gpio_ctrl 84 out 1
XP Chen0fb270a2021-08-26 17:30:19 -050015# On EVT machines, the secondary SCP EEPROM is used.
16# Set BMC_I2C_BACKUP_SEL to secondary.
17if [[ $boardver == 0 ]]; then
18 echo "EVT system. Choosing secondary SCP EEPROM."
19 set_gpio_ctrl 168 out 0
20fi
Lancelot Kao96a7ee32021-02-22 18:50:48 -060021# BMC_CPU_EEPROM_I2C_SEL #85
22set_gpio_ctrl 85 out 1
23# BMC_CPU_PMBUS_SEL #86
24set_gpio_ctrl 86 out 1
25
26# LED control
XP Chen9b906962021-05-06 15:23:19 -050027# LED_BMC_LIVE #7
28set_gpio_ctrl 7 out 1
Lancelot Kao96a7ee32021-02-22 18:50:48 -060029
30# SPI control
31# Send command to CPLD to switch the bios spi interface to host
32i2cset -y -f -a 13 0x76 0x10 0x00
33
34# Power control
Lancelot Kao19bfafb2021-05-25 15:04:57 -050035# MON_BMC_ALIVE, GPIO 10(EVT), GPIO137(DVT)
Lancelot Kao96a7ee32021-02-22 18:50:48 -060036set_gpio_ctrl 10 out 1
Lancelot Kao19bfafb2021-05-25 15:04:57 -050037set_gpio_ctrl 137 out 1
Lancelot Kao96a7ee32021-02-22 18:50:48 -060038# S0_BMC_OK, GPIO 69
39set_gpio_ctrl 69 out 1
Lancelot Kao19bfafb2021-05-25 15:04:57 -050040
41# Disable CPU 1 CLK when cpu not detected
42boardver=$(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
45CPU1_STATUS_N=$(get_gpio_ctrl 136)
46if [[ $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
58fi