summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-minerva/recipes-phosphor/state/phosphor-state-manager/chassis-powercycle
blob: deaa7afe5a75ed18e28e48c13cac2842446aa519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash

# shellcheck source=meta-facebook/meta-minerva/recipes-minerva/plat-tool/files/minerva-common-functions
source /usr/libexec/minerva-common-functions

# Minerva CMM Sled Power Cycle and Chassis Power Cycle

cmm-hsc-power-cycle() {
    #TBD: Since there has a 2nd HSC, it is necessary to determine which HSC it is now.

    # LTC4287 MFR_REBOOT_CONTROL (FDh) Read/Write
    # [3]:
    #       REBOOT 0 Write a 1 to reboot.
    # [2:0]
    #       RBT_DL 100 Configures Auto-Reboot turn-on Delay (tDL(RBT)) after the REBOOT bit is set to 1
    #       RBT_DL[2:0] DELAY
    #       000 0.580 s
    #       001 1.16 s
    #       010 2.32 s
    #       011 4.64 s
    #       100 9.28 s
    #       101 18.6 s
    #       110 37.1 s
    #       111 74.2 s
    i2cset -y -f 0 0x44 0xfd 0x00
    i2cset -y -f 0 0x44 0xfd 0x0b
}

compute-blade-hsc-power-off() {
    for i in {0..15}
    do
        set_gpio "PWREN_MTIA_BLADE${i}_HSC_EN_N" 1
    done
}

network-blade-hsc-power-off() {
    for i in {0..15}
    do
        set_gpio "PWREN_MTIA_BLADE${i}_HSC_EN_N" 1
    done
}

# CMM Sled Power Cycle
if [ "$1" == 0 ]
then
    echo "Staring CMM Sled Power Cycle"
    cmm-hsc-power-cycle
# CMM Chassis Power Cycle
elif [ "$1" == 1 ]
then
    echo "Staring CMM Chassis Power Cycle"

    compute-blade-hsc-power-off
    network-blade-hsc-power-off
    cmm-hsc-power-cycle
else
    echo "Invalid CMM Cycle"
    exit 1
fi