Skip to content

Commit

Permalink
fix low polarity wrong value for hw_reset deassert and seek(0) before…
Browse files Browse the repository at this point in the history
… reading sysfs upon poll event (#17627)

* fix hw_reset low polarity (reverse values)

* move seek to beginning of sysfs fd before reading to resolve power_good
sysfs returns empty upon plug out cable
  • Loading branch information
dbarashinvd authored and mssonicbld committed Jan 23, 2024
1 parent 204c552 commit d7a7760
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ def run(self):
module_fd_path = module_obj.module_power_good_fd_path
self.fds_events_count_dict[module_obj.port_num][fd_name] += 1
try:
val = module_fd.read()
module_fd.seek(0)
val = module_fd.read()
logger.log_info("dynamic detection got module_obj {} with port {} from fd number {} path {} val {} count {}"
.format(module_obj, module_obj.port_num, fd, module_fd_path
, val, self.fds_events_count_dict[module_obj.port_num]))
Expand Down Expand Up @@ -450,8 +450,9 @@ def power_on_module(self, port, module_sm_obj, dynamic=False):
utils.write_file(module_fd_indep_path_po, "1")
if os.path.isfile(module_fd_indep_path_r):
logger.log_info("powerOnModule resetting via {} for port {}".format(module_fd_indep_path_r, port))
# echo 0 > /sys/module/sx_core/$asic/$module/hw_reset
utils.write_file(module_fd_indep_path_r, "0")
# de-assert hw_reset - low polarity. 1 for de-assert 0 for assert
# echo 1 > /sys/module/sx_core/$asic/$module/hw_reset
utils.write_file(module_fd_indep_path_r, "1")
self.add_port_to_wait_reset(module_sm_obj)
except Exception as e:
logger.log_info("exception in powerOnModule {} for port {}".format(e, port))
Expand Down

0 comments on commit d7a7760

Please sign in to comment.