Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dell S6000: Fix reboot failure issue #6656

Merged
merged 1 commit into from
Feb 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import sys
import os
import struct

PORT_RES = '/dev/port'
NVRAM_RES = '/dev/nvram'
COLD_RESET = 0xE # Cold Reset
WARM_RESET = 0x6 # Warm Reset

RESET_REG = 0xCF9

def io_reg_write(resource, offset, val):
fd = os.open(resource, os.O_RDWR)
Expand All @@ -23,39 +24,40 @@ def io_reg_write(resource, offset, val):
return
os.close(fd)


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


def gpio_direction(pin, direction):
kernpath = '/sys/class/gpio/gpio'+str(pin)+'/direction'
with open(('kernpath'), 'w') as p:
p.write(str(direction) + '\n')
p.flush()


def gpio_set(pin, value):
kernpath = '/sys/class/gpio/gpio'+str(pin)+'/value'
with open(('kernpath'), 'w') as p:
p.write(str(int(value)) + '\n')
p.flush()


def gpio_export(value):
with open('/sys/class/gpio/export', 'w') as p:
p.write(str(int(value)) + '\n')
p.flush()


if __name__ == "__main__":

retry_count = 0
io_reg_write(NVRAM_RES, 0x49, COLD_RESET)
if not os.path.isdir("/sys/class/gpio/gpio10"):
gpio_export(10)
gpio_direction("10", "out")
# Toggle GPIO10 pin (to reset MUX)
gpio_set("10", 1)
gpio_set("10", 0)
power_reset(1)

while retry_count < 3:
if not os.path.isdir("/sys/class/gpio/gpio10"):
gpio_export(10)
gpio_direction("10", "out")
# Toggle GPIO10 pin (to reset MUX)
gpio_set("10", 1)
gpio_set("10", 0)
power_reset(1)
retry_count += 1
io_reg_write(PORT_RES, RESET_REG, COLD_RESET)