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

Haliburton xcvrd event support #2486

Merged
merged 3 commits into from Apr 18, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
41 changes: 31 additions & 10 deletions device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
try:
import time
import os
import select
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
Expand Down Expand Up @@ -121,15 +122,35 @@ def reset(self, port_num):
raise NotImplementedError

def get_transceiver_change_event(self, timeout=0):
epoll = select.epoll()
port_dict = {}
timeout_sec = timeout/1000
modabs_interrupt_path = '/sys/devices/platform/e1031.smc/SFP/modabs_int'
ports_evt = {}
try:
with open(modabs_interrupt_path, 'r') as port_changes:
changes = int(port_changes.read(), 16)
for port_num in self._sfp_port:
change = (changes >> ( port_num - 49)) & 1
if change == 1:
ports_evt[str(port_num)] = str(self.get_presence(port_num))
except IOError:
return False, {}
return True, ports_evt
# We get notified when there is an SCI interrupt from GPIO SUS7
fd = open("/sys/devices/platform/hlx-ich.0/sci_int_gpio_sus7", "r")
fd.read()

epoll.register(fd.fileno(), select.EPOLLIN & select.EPOLLET)
events = epoll.poll(timeout=timeout_sec if timeout != 0 else -1)
if events:
found_flag = 0
# Read the QSFP ABS interrupt & status registers
with open(modabs_interrupt_path, 'r') as port_changes:
changes = int(port_changes.read(), 16)
for port_num in self._sfp_port:
change = (changes >> ( port_num - 49)) & 1
if change == 1:
port_dict[str(port_num)] = str(int(self.get_presence(port_num)))
found_flag = 1

if not found_flag:
return False, {}

return True, port_dict

finally:
fd.close()
epoll.close()

return False, {}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ start)
echo -n "Setting up board... "

modprobe smc

sleep 1
modprobe -r gpio_ich
pphuchar marked this conversation as resolved.
Show resolved Hide resolved
sleep 1
modprobe hlx_gpio_ich

found=0
for devnum in 0 1; do
devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name`
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
obj-m := mc24lc64t.o emc2305.o smc.o
obj-m := mc24lc64t.o emc2305.o smc.o hlx_gpio_ich.o
Loading