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

As7312 54x add sfp rest and fan policy #1464

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
909a7e9
Update sonic-platform-modules-accton to lastest
roylee123 Dec 22, 2017
87eed23
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Dec 22, 2017
64529e5
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Dec 28, 2017
2464e45
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Jan 8, 2018
6810dd4
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Jan 9, 2018
5e436b4
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Jan 12, 2018
ce362e4
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Jan 19, 2018
0d14c1c
Merge branch 'master' of https:/roylee123/sonic-buildimage
roylee123 Jan 19, 2018
a40d2d9
Install sonic-platform-common package in platform-monitor docker for …
jleveque Jan 22, 2018
f8e98dd
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Jan 24, 2018
38593b6
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Feb 21, 2018
843ca3f
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Feb 23, 2018
940762d
Merge branch 'master' of https:/Azure/sonic-buildimage
roylee123 Mar 1, 2018
cc03005
Merge branch 'master' of https:/Azure/sonic-buildimage in…
roylee123 Mar 6, 2018
fc37f19
[platform] 1. Add QSFP reset control.
roylee123 Mar 6, 2018
024eb56
Replace tab by blanks.
roylee123 Mar 8, 2018
dd07ffa
Resolve submodule conflicts.
roylee123 Mar 8, 2018
b86477f
Merge branch 'master' of https:/Azure/sonic-buildimage in…
roylee123 Mar 8, 2018
64c4bc7
AS7312-54x, fix a indention error on sfputil.py.
roylee123 Mar 8, 2018
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
57 changes: 35 additions & 22 deletions device/accton/x86_64-accton_as7312_54x-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class SfpUtil(SfpUtilBase):

_port_to_eeprom_mapping = {}
_cpld_mapping = {
0: "4-0060",
1: "5-0062",
2: "6-0064",
}
0: "4-0060",
1: "5-0062",
2: "6-0064",
}
_port_to_i2c_mapping = {
0: 18,
1: 19,
Expand Down Expand Up @@ -137,29 +137,40 @@ def __init__(self):

SfpUtilBase.__init__(self)


# For port 48~51 are QSFP, here presumed they're all split to 4 lanes.
def get_cage_num(self, port_num):
cage_num = port_num
if (port_num >= self.QSFP_PORT_START):
cage_num = (port_num - self.QSFP_PORT_START)/4
cage_num = cage_num + self.QSFP_PORT_START

return cage_num

# For cage 0~23 and 48~51 are at cpld2, others are at cpld3.
def get_cpld_num(self, port_num):
cpld_i = 1
cage_num = self.get_cage_num(port_num)
if (port_num > 23 and port_num < self.QSFP_PORT_START):
cpld_i = 2

if (cage_num >= 52):
cpld_i = 2

return cpld_i

def get_presence(self, port_num):
# Check for invalid port_num
if port_num < self.port_start or port_num > self.port_end:
return False

# For cage 0~23 and 48~51 are at cpld2, others are at cpld3.
# For port 48~51 are QSFP, here presumed they are all broken-out to 4 lanes.
cage_num = port_num
cpld_i = 1
if (port_num > 23):
cpld_i = 2

if (port_num >= self.QSFP_PORT_START):
cpld_i = 1
cage_num = (port_num - self.QSFP_PORT_START)/4
cage_num = cage_num + self.QSFP_PORT_START
if (cage_num >= 52):
cpld_i = 2
cage_num = self.get_cage_num(port_num)
cpld_i = self.get_cpld_num(port_num)

cpld_ps = self._cpld_mapping[cpld_i]
path = "/sys/bus/i2c/devices/{0}/module_present_{1}"
port_ps = path.format(cpld_ps, cage_num+1)

try:
val_file = open(port_ps)
except IOError as e:
Expand All @@ -185,16 +196,18 @@ def reset(self, port_num):
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
return False


path = "/sys/bus/i2c/devices/5-0062/module_reset_{0}"
port_ps = path.format(port_num+1)
cage_num = self.get_cage_num(port_num)
cpld_i = self.get_cpld_num(port_num)
cpld_ps = self._cpld_mapping[cpld_i]
path = "/sys/bus/i2c/devices/{0}/module_reset_{1}"
port_ps = path.format(cpld_ps, cage_num+1)
try:
reg_file = open(port_ps, 'w')
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False

reg_value = '1'
reg_value = '0'

reg_file.write(reg_value)
reg_file.close()
Expand Down