Skip to content

Commit e8ec7d2

Browse files
pphucharMichelMoriniaux
authored andcommitted
[devices]: Haliburton xcvrd event support (sonic-net#2486)
* [platform/broadcom] Add xcvr event interrupt for haliburton * [device/celestica] Sfputil implement xcvr event monitor on haliburton * Codes cleanup, remove gpio_ich module unload line
1 parent 81b93aa commit e8ec7d2

File tree

4 files changed

+1082
-13
lines changed

4 files changed

+1082
-13
lines changed

device/celestica/x86_64-cel_e1031-r0/plugins/sfputil.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
try:
44
import time
55
import os
6+
import select
67
from sonic_sfp.sfputilbase import SfpUtilBase
78
except ImportError as e:
89
raise ImportError("%s - required module not found" % str(e))
@@ -121,15 +122,35 @@ def reset(self, port_num):
121122
raise NotImplementedError
122123

123124
def get_transceiver_change_event(self, timeout=0):
125+
epoll = select.epoll()
126+
port_dict = {}
127+
timeout_sec = timeout/1000
124128
modabs_interrupt_path = '/sys/devices/platform/e1031.smc/SFP/modabs_int'
125-
ports_evt = {}
126129
try:
127-
with open(modabs_interrupt_path, 'r') as port_changes:
128-
changes = int(port_changes.read(), 16)
129-
for port_num in self._sfp_port:
130-
change = (changes >> ( port_num - 49)) & 1
131-
if change == 1:
132-
ports_evt[str(port_num)] = str(self.get_presence(port_num))
133-
except IOError:
134-
return False, {}
135-
return True, ports_evt
130+
# We get notified when there is an SCI interrupt from GPIO SUS7
131+
fd = open("/sys/devices/platform/hlx-ich.0/sci_int_gpio_sus7", "r")
132+
fd.read()
133+
134+
epoll.register(fd.fileno(), select.EPOLLIN & select.EPOLLET)
135+
events = epoll.poll(timeout=timeout_sec if timeout != 0 else -1)
136+
if events:
137+
found_flag = 0
138+
# Read the QSFP ABS interrupt & status registers
139+
with open(modabs_interrupt_path, 'r') as port_changes:
140+
changes = int(port_changes.read(), 16)
141+
for port_num in self._sfp_port:
142+
change = (changes >> ( port_num - 49)) & 1
143+
if change == 1:
144+
port_dict[str(port_num)] = str(int(self.get_presence(port_num)))
145+
found_flag = 1
146+
147+
if not found_flag:
148+
return False, {}
149+
150+
return True, port_dict
151+
152+
finally:
153+
fd.close()
154+
epoll.close()
155+
156+
return False, {}

platform/broadcom/sonic-platform-modules-cel/debian/platform-modules-haliburton.init

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ case "$1" in
1515
start)
1616
echo -n "Setting up board... "
1717

18-
modprobe smc
19-
18+
modprobe smc
19+
modprobe hlx_gpio_ich
20+
2021
found=0
2122
for devnum in 0 1; do
2223
devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
obj-m := mc24lc64t.o emc2305.o smc.o
1+
obj-m := mc24lc64t.o emc2305.o smc.o hlx_gpio_ich.o

0 commit comments

Comments
 (0)