Skip to content

Commit 85a6314

Browse files
Dell S6000: Fix reboot failure issue (#6656)
Reboot command in Dell S6000 failed to reboot the switch. Added retry mechanism and CPU reset.
1 parent 4a93bb2 commit 85a6314

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot

+15-13
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import sys
44
import os
55
import struct
66

7+
PORT_RES = '/dev/port'
78
NVRAM_RES = '/dev/nvram'
89
COLD_RESET = 0xE # Cold Reset
910
WARM_RESET = 0x6 # Warm Reset
10-
11+
RESET_REG = 0xCF9
1112

1213
def io_reg_write(resource, offset, val):
1314
fd = os.open(resource, os.O_RDWR)
@@ -23,39 +24,40 @@ def io_reg_write(resource, offset, val):
2324
return
2425
os.close(fd)
2526

26-
2727
def power_reset(val):
2828
with open('/sys/devices/platform/dell-s6000-cpld.0/power_reset', 'w') as p:
2929
p.write(str(int(val)) + '\n')
3030
p.flush()
3131

32-
3332
def gpio_direction(pin, direction):
3433
kernpath = '/sys/class/gpio/gpio'+str(pin)+'/direction'
3534
with open(('kernpath'), 'w') as p:
3635
p.write(str(direction) + '\n')
3736
p.flush()
3837

39-
4038
def gpio_set(pin, value):
4139
kernpath = '/sys/class/gpio/gpio'+str(pin)+'/value'
4240
with open(('kernpath'), 'w') as p:
4341
p.write(str(int(value)) + '\n')
4442
p.flush()
4543

46-
4744
def gpio_export(value):
4845
with open('/sys/class/gpio/export', 'w') as p:
4946
p.write(str(int(value)) + '\n')
5047
p.flush()
5148

52-
5349
if __name__ == "__main__":
50+
51+
retry_count = 0
5452
io_reg_write(NVRAM_RES, 0x49, COLD_RESET)
55-
if not os.path.isdir("/sys/class/gpio/gpio10"):
56-
gpio_export(10)
57-
gpio_direction("10", "out")
58-
# Toggle GPIO10 pin (to reset MUX)
59-
gpio_set("10", 1)
60-
gpio_set("10", 0)
61-
power_reset(1)
53+
54+
while retry_count < 3:
55+
if not os.path.isdir("/sys/class/gpio/gpio10"):
56+
gpio_export(10)
57+
gpio_direction("10", "out")
58+
# Toggle GPIO10 pin (to reset MUX)
59+
gpio_set("10", 1)
60+
gpio_set("10", 0)
61+
power_reset(1)
62+
retry_count += 1
63+
io_reg_write(PORT_RES, RESET_REG, COLD_RESET)

0 commit comments

Comments
 (0)