[devices]: Haliburton xcvrd event support (#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
This commit is contained in:
parent
7ed5a92fc0
commit
9525f862fa
@ -3,6 +3,7 @@
|
|||||||
try:
|
try:
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import select
|
||||||
from sonic_sfp.sfputilbase import SfpUtilBase
|
from sonic_sfp.sfputilbase import SfpUtilBase
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
raise ImportError("%s - required module not found" % str(e))
|
raise ImportError("%s - required module not found" % str(e))
|
||||||
@ -121,15 +122,35 @@ class SfpUtil(SfpUtilBase):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_transceiver_change_event(self, timeout=0):
|
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'
|
modabs_interrupt_path = '/sys/devices/platform/e1031.smc/SFP/modabs_int'
|
||||||
ports_evt = {}
|
|
||||||
try:
|
try:
|
||||||
with open(modabs_interrupt_path, 'r') as port_changes:
|
# We get notified when there is an SCI interrupt from GPIO SUS7
|
||||||
changes = int(port_changes.read(), 16)
|
fd = open("/sys/devices/platform/hlx-ich.0/sci_int_gpio_sus7", "r")
|
||||||
for port_num in self._sfp_port:
|
fd.read()
|
||||||
change = (changes >> ( port_num - 49)) & 1
|
|
||||||
if change == 1:
|
epoll.register(fd.fileno(), select.EPOLLIN & select.EPOLLET)
|
||||||
ports_evt[str(port_num)] = str(self.get_presence(port_num))
|
events = epoll.poll(timeout=timeout_sec if timeout != 0 else -1)
|
||||||
except IOError:
|
if events:
|
||||||
return False, {}
|
found_flag = 0
|
||||||
return True, ports_evt
|
# 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, {}
|
@ -15,7 +15,8 @@ case "$1" in
|
|||||||
start)
|
start)
|
||||||
echo -n "Setting up board... "
|
echo -n "Setting up board... "
|
||||||
|
|
||||||
modprobe smc
|
modprobe smc
|
||||||
|
modprobe hlx_gpio_ich
|
||||||
|
|
||||||
found=0
|
found=0
|
||||||
for devnum in 0 1; do
|
for devnum in 0 1; do
|
||||||
|
@ -1 +1 @@
|
|||||||
obj-m := mc24lc64t.o emc2305.o smc.o
|
obj-m := mc24lc64t.o emc2305.o smc.o hlx_gpio_ich.o
|
||||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user