[Juniper][QFX5210] Optoe driver for SFP management (#3438)
* Adding platform support for Juniper QFX5210 This switch has 64 QSFP28 (40G/100G) ports, 2 SFP+ (1G/10G) ports on Broadcom Tomahawk II chipset. CPU used in QFX5210-64C-S is Intel Broadwell-DE. The machine has Redundant and hot-swappable Power Supply (1+1) and also has Redundant and hot swappable fans (3+1). Signed-off-by: Ciju Rajan K <crajank@juniper.net> * [Juniper][QFX5210] Optoe driver for SFP management This commit implements the following changes - Moving to optoe driver for sfp management - Removing the old sfp driver - Updating the port-config.ini to add the index field - Correction in sfputil.py to incorporate optoe driver - Platform support for 'poweroff' command Signed-off-by: Ciju Rajan K <crajank@juniper.net>
This commit is contained in:
parent
9179990ba1
commit
3ff0c4d0dc
@ -1,65 +1,65 @@
|
|||||||
# name lanes alias
|
# name lanes alias index speed
|
||||||
Ethernet0 73,74,75,76 hundredGigE1
|
Ethernet0 73,74,75,76 hundredGigE1 0 100000
|
||||||
Ethernet4 65,66,67,68 hundredGigE2
|
Ethernet4 65,66,67,68 hundredGigE2 1 100000
|
||||||
Ethernet8 81,82,83,84 hundredGigE3
|
Ethernet8 81,82,83,84 hundredGigE3 2 100000
|
||||||
Ethernet12 89,90,91,92 hundredGigE4
|
Ethernet12 89,90,91,92 hundredGigE4 3 100000
|
||||||
Ethernet16 105,106,107,108 hundredGigE5
|
Ethernet16 105,106,107,108 hundredGigE5 4 100000
|
||||||
Ethernet20 97,98,99,100 hundredGigE6
|
Ethernet20 97,98,99,100 hundredGigE6 5 100000
|
||||||
Ethernet24 113,114,115,116 hundredGigE7
|
Ethernet24 113,114,115,116 hundredGigE7 6 100000
|
||||||
Ethernet28 121,122,123,124 hundredGigE8
|
Ethernet28 121,122,123,124 hundredGigE8 7 100000
|
||||||
Ethernet32 41,42,43,44 hundredGigE9
|
Ethernet32 41,42,43,44 hundredGigE9 8 100000
|
||||||
Ethernet36 33,34,35,36 hundredGigE10
|
Ethernet36 33,34,35,36 hundredGigE10 9 100000
|
||||||
Ethernet40 49,50,51,52 hundredGigE11
|
Ethernet40 49,50,51,52 hundredGigE11 10 100000
|
||||||
Ethernet44 57,58,59,60 hundredGigE12
|
Ethernet44 57,58,59,60 hundredGigE12 11 100000
|
||||||
Ethernet48 137,138,139,140 hundredGigE13
|
Ethernet48 137,138,139,140 hundredGigE13 12 100000
|
||||||
Ethernet52 129,130,131,132 hundredGigE14
|
Ethernet52 129,130,131,132 hundredGigE14 13 100000
|
||||||
Ethernet56 145,146,147,148 hundredGigE15
|
Ethernet56 145,146,147,148 hundredGigE15 14 100000
|
||||||
Ethernet60 153,154,155,156 hundredGigE16
|
Ethernet60 153,154,155,156 hundredGigE16 15 100000
|
||||||
Ethernet64 173,174,175,176 hundredGigE17
|
Ethernet64 173,174,175,176 hundredGigE17 16 100000
|
||||||
Ethernet68 165,166,167,168 hundredGigE18
|
Ethernet68 165,166,167,168 hundredGigE18 17 100000
|
||||||
Ethernet72 181,182,183,184 hundredGigE19
|
Ethernet72 181,182,183,184 hundredGigE19 18 100000
|
||||||
Ethernet76 189,190,191,192 hundredGigE20
|
Ethernet76 189,190,191,192 hundredGigE20 19 100000
|
||||||
Ethernet80 13,14,15,16 hundredGigE21
|
Ethernet80 13,14,15,16 hundredGigE21 20 100000
|
||||||
Ethernet84 5,6,7,8 hundredGigE22
|
Ethernet84 5,6,7,8 hundredGigE22 21 100000
|
||||||
Ethernet88 29,30,31,32 hundredGigE23
|
Ethernet88 29,30,31,32 hundredGigE23 22 100000
|
||||||
Ethernet92 21,22,23,24 hundredGigE24
|
Ethernet92 21,22,23,24 hundredGigE24 23 100000
|
||||||
Ethernet96 205,206,207,208 hundredGigE25
|
Ethernet96 205,206,207,208 hundredGigE25 24 100000
|
||||||
Ethernet100 197,198,199,200 hundredGigE26
|
Ethernet100 197,198,199,200 hundredGigE26 25 100000
|
||||||
Ethernet104 213,214,215,216 hundredGigE27
|
Ethernet104 213,214,215,216 hundredGigE27 26 100000
|
||||||
Ethernet108 221,222,223,224 hundredGigE28
|
Ethernet108 221,222,223,224 hundredGigE28 27 100000
|
||||||
Ethernet112 229,230,231,232 hundredGigE29
|
Ethernet112 229,230,231,232 hundredGigE29 28 100000
|
||||||
Ethernet116 237,238,239,240 hundredGigE30
|
Ethernet116 237,238,239,240 hundredGigE30 29 100000
|
||||||
Ethernet120 245,246,247,248 hundredGigE31
|
Ethernet120 245,246,247,248 hundredGigE31 30 100000
|
||||||
Ethernet124 253,254,255,256 hundredGigE32
|
Ethernet124 253,254,255,256 hundredGigE32 31 100000
|
||||||
Ethernet128 69,70,71,72 hundredGigE33
|
Ethernet128 69,70,71,72 hundredGigE33 32 100000
|
||||||
Ethernet132 77,78,79,80 hundredGigE34
|
Ethernet132 77,78,79,80 hundredGigE34 33 100000
|
||||||
Ethernet136 93,94,95,96 hundredGigE35
|
Ethernet136 93,94,95,96 hundredGigE35 34 100000
|
||||||
Ethernet140 85,86,87,88 hundredGigE36
|
Ethernet140 85,86,87,88 hundredGigE36 35 100000
|
||||||
Ethernet144 101,102,103,104 hundredGigE37
|
Ethernet144 101,102,103,104 hundredGigE37 36 100000
|
||||||
Ethernet148 109,110,111,112 hundredGigE38
|
Ethernet148 109,110,111,112 hundredGigE38 37 100000
|
||||||
Ethernet152 125,126,127,128 hundredGigE39
|
Ethernet152 125,126,127,128 hundredGigE39 38 100000
|
||||||
Ethernet156 117,118,119,120 hundredGigE40
|
Ethernet156 117,118,119,120 hundredGigE40 39 100000
|
||||||
Ethernet160 37,38,39,40 hundredGigE41
|
Ethernet160 37,38,39,40 hundredGigE41 40 100000
|
||||||
Ethernet164 45,46,47,48 hundredGigE42
|
Ethernet164 45,46,47,48 hundredGigE42 41 100000
|
||||||
Ethernet168 61,62,63,64 hundredGigE43
|
Ethernet168 61,62,63,64 hundredGigE43 42 100000
|
||||||
Ethernet172 53,54,55,56 hundredGigE44
|
Ethernet172 53,54,55,56 hundredGigE44 43 100000
|
||||||
Ethernet176 133,134,135,136 hundredGigE45
|
Ethernet176 133,134,135,136 hundredGigE45 44 100000
|
||||||
Ethernet180 141,142,143,144 hundredGigE46
|
Ethernet180 141,142,143,144 hundredGigE46 45 100000
|
||||||
Ethernet184 157,158,159,160 hundredGigE47
|
Ethernet184 157,158,159,160 hundredGigE47 46 100000
|
||||||
Ethernet188 149,150,151,152 hundredGigE48
|
Ethernet188 149,150,151,152 hundredGigE48 47 100000
|
||||||
Ethernet192 161,162,163,164 hundredGigE49
|
Ethernet192 161,162,163,164 hundredGigE49 48 100000
|
||||||
Ethernet196 169,170,171,172 hundredGigE50
|
Ethernet196 169,170,171,172 hundredGigE50 49 100000
|
||||||
Ethernet200 185,186,187,188 hundredGigE51
|
Ethernet200 185,186,187,188 hundredGigE51 50 100000
|
||||||
Ethernet204 177,178,179,180 hundredGigE52
|
Ethernet204 177,178,179,180 hundredGigE52 51 100000
|
||||||
Ethernet208 1,2,3,4 hundredGigE53
|
Ethernet208 1,2,3,4 hundredGigE53 52 100000
|
||||||
Ethernet212 9,10,11,12 hundredGigE54
|
Ethernet212 9,10,11,12 hundredGigE54 53 100000
|
||||||
Ethernet216 25,26,27,28 hundredGigE55
|
Ethernet216 25,26,27,28 hundredGigE55 54 100000
|
||||||
Ethernet220 17,18,19,20 hundredGigE56
|
Ethernet220 17,18,19,20 hundredGigE56 55 100000
|
||||||
Ethernet224 193,194,195,196 hundredGigE57
|
Ethernet224 193,194,195,196 hundredGigE57 56 100000
|
||||||
Ethernet228 201,202,203,204 hundredGigE58
|
Ethernet228 201,202,203,204 hundredGigE58 57 100000
|
||||||
Ethernet232 217,218,219,220 hundredGigE59
|
Ethernet232 217,218,219,220 hundredGigE59 58 100000
|
||||||
Ethernet236 209,210,211,212 hundredGigE60
|
Ethernet236 209,210,211,212 hundredGigE60 59 100000
|
||||||
Ethernet240 225,226,227,228 hundredGigE61
|
Ethernet240 225,226,227,228 hundredGigE61 60 100000
|
||||||
Ethernet244 233,234,235,236 hundredGigE62
|
Ethernet244 233,234,235,236 hundredGigE62 61 100000
|
||||||
Ethernet248 249,250,251,252 hundredGigE63
|
Ethernet248 249,250,251,252 hundredGigE63 62 100000
|
||||||
Ethernet252 241,242,243,244 hundredGigE64
|
Ethernet252 241,242,243,244 hundredGigE64 63 100000
|
||||||
|
@ -43,146 +43,79 @@ class SfpUtil(SfpUtilBase):
|
|||||||
cmd = '/var/run/sfppresence'
|
cmd = '/var/run/sfppresence'
|
||||||
_port_to_eeprom_mapping = {}
|
_port_to_eeprom_mapping = {}
|
||||||
port_to_i2c_mapping = {
|
port_to_i2c_mapping = {
|
||||||
61 : 25,
|
60 : 25,
|
||||||
62 : 26,
|
61 : 26,
|
||||||
63 : 27,
|
62 : 27,
|
||||||
64 : 28,
|
63 : 28,
|
||||||
55 : 29,
|
54 : 29,
|
||||||
56 : 30,
|
55 : 30,
|
||||||
53 : 31,
|
52 : 31,
|
||||||
54 : 32,
|
53 : 32,
|
||||||
9 : 33,
|
8 : 33,
|
||||||
10 : 34,
|
9 : 34,
|
||||||
11 : 35,
|
10 : 35,
|
||||||
12 : 36,
|
11 : 36,
|
||||||
1 : 37,
|
0 : 37,
|
||||||
2 : 38,
|
1 : 38,
|
||||||
3 : 39,
|
2 : 39,
|
||||||
4 : 40,
|
3 : 40,
|
||||||
6 : 41,
|
5 : 41,
|
||||||
5 : 42,
|
4 : 42,
|
||||||
8 : 43,
|
7 : 43,
|
||||||
7 : 44,
|
6 : 44,
|
||||||
13 : 45,
|
12 : 45,
|
||||||
14 : 46,
|
13 : 46,
|
||||||
15 : 47,
|
14 : 47,
|
||||||
16 : 48,
|
15 : 48,
|
||||||
17 : 49,
|
16 : 49,
|
||||||
18 : 50,
|
17 : 50,
|
||||||
19 : 51,
|
18 : 51,
|
||||||
20 : 52,
|
19 : 52,
|
||||||
25 : 53,
|
24 : 53,
|
||||||
26 : 54,
|
25 : 54,
|
||||||
27 : 55,
|
26 : 55,
|
||||||
28 : 56,
|
27 : 56,
|
||||||
29 : 57,
|
28 : 57,
|
||||||
30 : 58,
|
29 : 58,
|
||||||
31 : 59,
|
30 : 59,
|
||||||
32 : 60,
|
31 : 60,
|
||||||
21 : 61,
|
20 : 61,
|
||||||
22 : 62,
|
21 : 62,
|
||||||
23 : 63,
|
22 : 63,
|
||||||
24 : 64,
|
23 : 64,
|
||||||
41 : 65,
|
40 : 65,
|
||||||
42 : 66,
|
41 : 66,
|
||||||
43 : 67,
|
42 : 67,
|
||||||
44 : 68,
|
43 : 68,
|
||||||
33 : 69,
|
32 : 69,
|
||||||
34 : 70,
|
33 : 70,
|
||||||
35 : 71,
|
34 : 71,
|
||||||
36 : 72,
|
35 : 72,
|
||||||
45 : 73,
|
44 : 73,
|
||||||
46 : 74,
|
45 : 74,
|
||||||
47 : 75,
|
46 : 75,
|
||||||
48 : 76,
|
47 : 76,
|
||||||
37 : 77,
|
36 : 77,
|
||||||
38 : 78,
|
37 : 78,
|
||||||
39 : 79,
|
38 : 79,
|
||||||
40 : 80,
|
39 : 80,
|
||||||
57 : 81,
|
56 : 81,
|
||||||
58 : 82,
|
57 : 82,
|
||||||
59 : 83,
|
58 : 83,
|
||||||
60 : 84,
|
59 : 84,
|
||||||
49 : 85,
|
48 : 85,
|
||||||
50 : 86,
|
49 : 86,
|
||||||
51 : 87,
|
50 : 87,
|
||||||
52 : 88,}
|
51 : 88,}
|
||||||
|
|
||||||
port_to_sysfs_map = [
|
|
||||||
'/sys/bus/i2c/devices/37-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/38-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/39-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/40-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/42-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/41-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/44-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/43-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/33-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/34-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/35-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/36-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/45-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/46-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/47-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/48-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/49-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/50-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/51-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/52-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/61-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/62-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/63-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/64-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/53-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/54-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/55-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/56-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/57-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/58-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/59-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/60-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/69-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/70-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/71-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/72-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/77-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/78-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/79-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/80-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/65-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/66-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/67-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/68-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/73-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/74-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/75-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/76-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/85-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/86-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/87-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/88-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/31-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/32-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/29-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/30-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/81-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/82-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/83-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/84-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/25-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/26-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/27-0050/sfp_is_present',
|
|
||||||
'/sys/bus/i2c/devices/28-0050/sfp_is_present'
|
|
||||||
|
|
||||||
]
|
|
||||||
# sys.path.append('/usr/local/bin')
|
# sys.path.append('/usr/local/bin')
|
||||||
_qsfp_ports = range(0, ports_in_block + 1)
|
_qsfp_ports = range(0, ports_in_block + 1)
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom'
|
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'
|
||||||
for x in range(0, self._port_end + 1):
|
for x in range(self._port_start, self._port_end + 1):
|
||||||
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1])
|
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x])
|
||||||
self._port_to_eeprom_mapping[x] = port_eeprom_path
|
self._port_to_eeprom_mapping[x] = port_eeprom_path
|
||||||
SfpUtilBase.__init__(self)
|
SfpUtilBase.__init__(self)
|
||||||
|
|
||||||
@ -210,9 +143,8 @@ class SfpUtil(SfpUtilBase):
|
|||||||
if port_num < self._port_start or port_num > self._port_end:
|
if port_num < self._port_start or port_num > self._port_end:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present"
|
path = "/sys/bus/i2c/devices/19-0060/module_present_{0}"
|
||||||
port_ps = path.format(self.port_to_i2c_mapping[port_num+1])
|
port_ps = path.format(port_num + 1)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
reg_file = open(port_ps)
|
reg_file = open(port_ps)
|
||||||
@ -278,6 +210,8 @@ class SfpUtil(SfpUtilBase):
|
|||||||
current_sfp_values = [0] * 64
|
current_sfp_values = [0] * 64
|
||||||
previous_sfp_values = [0] * 64
|
previous_sfp_values = [0] * 64
|
||||||
|
|
||||||
|
path = "/sys/bus/i2c/devices/19-0060/module_present_{0}"
|
||||||
|
|
||||||
if not os.path.isfile(self.cmd):
|
if not os.path.isfile(self.cmd):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -287,9 +221,10 @@ class SfpUtil(SfpUtilBase):
|
|||||||
previous_sfp_values = self.read_from_file(self.cmd)
|
previous_sfp_values = self.read_from_file(self.cmd)
|
||||||
|
|
||||||
# Read the current values from sysfs
|
# Read the current values from sysfs
|
||||||
for x in range(len(self.port_to_sysfs_map)):
|
for x in range(self._port_start , self._port_end + 1):
|
||||||
try:
|
try:
|
||||||
reg_file = open(self.port_to_sysfs_map[x], 'r')
|
new_path = path.format(x + 1)
|
||||||
|
reg_file = open(new_path, 'r')
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
print "Error: unable to open file: %s" % str(e)
|
print "Error: unable to open file: %s" % str(e)
|
||||||
return False, defl_dict
|
return False, defl_dict
|
||||||
@ -305,7 +240,7 @@ class SfpUtil(SfpUtilBase):
|
|||||||
else:
|
else:
|
||||||
return False, defl_dict
|
return False, defl_dict
|
||||||
|
|
||||||
def get_transceiver_change_event(self):
|
def get_transceiver_change_event(self, timeout=2000):
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
return self.sfp_detect()
|
return self.sfp_detect()
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
obj-m:=x86-64-juniper-qfx5210-64x-fan.o x86-64-juniper-qfx5210-64x-sfp.o x86-64-juniper-qfx5210-64x-leds.o \
|
obj-m:=x86-64-juniper-qfx5210-64x-fan.o x86-64-juniper-qfx5210-64x-leds.o \
|
||||||
x86-64-juniper-qfx5210-64x-psu.o juniper_i2c_cpld.o ym2651y.o
|
x86-64-juniper-qfx5210-64x-psu.o juniper_i2c_cpld.o ym2651y.o
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* An hwmon driver for juniper qfx5210_64x Power Module
|
* An hwmon driver for juniper qfx5210_64x Power Module
|
||||||
*
|
*
|
||||||
* Tested and validated on Juniper QFX5210
|
* Modified and tested on Juniper QFX5210
|
||||||
* Ciju Rajan K <crajank@juniper.net>
|
* Ciju Rajan K <crajank@juniper.net>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Accton Technology Corporation.
|
* Copyright (C) 2014 Accton Technology Corporation.
|
||||||
@ -103,6 +103,30 @@ static const struct attribute_group qfx5210_64x_psu_group = {
|
|||||||
.attrs = qfx5210_64x_psu_attributes,
|
.attrs = qfx5210_64x_psu_attributes,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is defined in juniper_i2c_cpld.c
|
||||||
|
*/
|
||||||
|
extern int juniper_i2c_cpld_write(unsigned short, u8, u8);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* QFX5210 power off sequence
|
||||||
|
*/
|
||||||
|
static void qfx5210_cpld_power_off(void)
|
||||||
|
{
|
||||||
|
printk(KERN_ALERT "pm_power_off: qfx5210_cpld_power_off\n");
|
||||||
|
(void) juniper_i2c_cpld_write(0x65, 0x14, 0x00);
|
||||||
|
msleep(100);
|
||||||
|
(void) juniper_i2c_cpld_write(0x77, 0x00, 0x01);
|
||||||
|
msleep(100);
|
||||||
|
(void) juniper_i2c_cpld_write(0x76, 0x00, 0x04);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default platform pm_power_off handler
|
||||||
|
*/
|
||||||
|
static void (*default_pm_power_off)(void);
|
||||||
|
|
||||||
|
|
||||||
static int qfx5210_64x_psu_probe(struct i2c_client *client,
|
static int qfx5210_64x_psu_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *dev_id)
|
const struct i2c_device_id *dev_id)
|
||||||
{
|
{
|
||||||
@ -141,6 +165,11 @@ static int qfx5210_64x_psu_probe(struct i2c_client *client,
|
|||||||
|
|
||||||
dev_info(&client->dev, "%s: psu '%s'\n",
|
dev_info(&client->dev, "%s: psu '%s'\n",
|
||||||
dev_name(data->hwmon_dev), client->name);
|
dev_name(data->hwmon_dev), client->name);
|
||||||
|
/*
|
||||||
|
* Store the default poweroff handler for later usage
|
||||||
|
*/
|
||||||
|
default_pm_power_off = pm_power_off;
|
||||||
|
pm_power_off = qfx5210_cpld_power_off;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -161,6 +190,11 @@ static int qfx5210_64x_psu_remove(struct i2c_client *client)
|
|||||||
sysfs_remove_group(&client->dev.kobj, &qfx5210_64x_psu_group);
|
sysfs_remove_group(&client->dev.kobj, &qfx5210_64x_psu_group);
|
||||||
kfree(data);
|
kfree(data);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Restore the poweroff handler
|
||||||
|
*/
|
||||||
|
pm_power_off = default_pm_power_off;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -56,8 +56,6 @@ args = []
|
|||||||
ALL_DEVICE = {}
|
ALL_DEVICE = {}
|
||||||
DEVICE_NO = {'led':4, 'fan':4,'thermal':6, 'psu':2, 'sfp':64}
|
DEVICE_NO = {'led':4, 'fan':4,'thermal':6, 'psu':2, 'sfp':64}
|
||||||
FORCE = 0
|
FORCE = 0
|
||||||
#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG)
|
|
||||||
#logging.basicConfig(level=logging.INFO)
|
|
||||||
|
|
||||||
|
|
||||||
if DEBUG == True:
|
if DEBUG == True:
|
||||||
@ -124,6 +122,7 @@ def main():
|
|||||||
print 'Error: Execution of "%s" failed', DisableWatchDogCmd
|
print 'Error: Execution of "%s" failed', DisableWatchDogCmd
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
CPUeepromFileCmd = 'cat /sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-0056/eeprom > /etc/init.d/eeprom_qfx5210_ascii'
|
CPUeepromFileCmd = 'cat /sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-0056/eeprom > /etc/init.d/eeprom_qfx5210_ascii'
|
||||||
# Write the contents of CPU EEPROM to file
|
# Write the contents of CPU EEPROM to file
|
||||||
try:
|
try:
|
||||||
@ -178,11 +177,11 @@ def driver_check():
|
|||||||
|
|
||||||
kos = [
|
kos = [
|
||||||
'modprobe i2c_dev',
|
'modprobe i2c_dev',
|
||||||
'modprobe i2c_mux_pca954x',
|
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||||
|
'modprobe optoe',
|
||||||
'modprobe juniper_i2c_cpld' ,
|
'modprobe juniper_i2c_cpld' ,
|
||||||
'modprobe ym2651y' ,
|
'modprobe ym2651y' ,
|
||||||
'modprobe x86-64-juniper-qfx5210-64x-fan' ,
|
'modprobe x86-64-juniper-qfx5210-64x-fan' ,
|
||||||
'modprobe x86-64-juniper-qfx5210-64x-sfp' ,
|
|
||||||
'modprobe x86-64-juniper-qfx5210-64x-leds' ,
|
'modprobe x86-64-juniper-qfx5210-64x-leds' ,
|
||||||
'modprobe x86-64-juniper-qfx5210-64x-psu' ]
|
'modprobe x86-64-juniper-qfx5210-64x-psu' ]
|
||||||
|
|
||||||
@ -220,7 +219,7 @@ i2c_bus = {'fan': ['17-0068'] ,
|
|||||||
i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] ,
|
i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] ,
|
||||||
'thermal': ['hwmon/hwmon*/temp1_input'] ,
|
'thermal': ['hwmon/hwmon*/temp1_input'] ,
|
||||||
'psu': ['psu_present ', 'psu_power_good'] ,
|
'psu': ['psu_present ', 'psu_power_good'] ,
|
||||||
'sfp': ['sfp_is_present ', 'sfp_tx_disable']}
|
'sfp': ['sfp_is_present ', 'module_present']}
|
||||||
|
|
||||||
sfp_map = [37,38,39,40,42,41,44,43,33,34,35,36,45,46,47,48,49,50,51,52,
|
sfp_map = [37,38,39,40,42,41,44,43,33,34,35,36,45,46,47,48,49,50,51,52,
|
||||||
61,62,63,64,53,54,55,56,57,58,59,60,69,70,71,72,77,78,79,80,65,
|
61,62,63,64,53,54,55,56,57,58,59,60,69,70,71,72,77,78,79,80,65,
|
||||||
@ -274,7 +273,13 @@ def device_install():
|
|||||||
return status
|
return status
|
||||||
|
|
||||||
for i in range(0,len(sfp_map)):
|
for i in range(0,len(sfp_map)):
|
||||||
status, output =log_os_system("echo qfx5210_64x_port"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1)
|
path = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device"
|
||||||
|
status, output =log_os_system("echo optoe1 0x50 > " + path, 1)
|
||||||
|
if status:
|
||||||
|
print output
|
||||||
|
if FORCE == 0:
|
||||||
|
return status
|
||||||
|
status, output =log_os_system("echo Port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1)
|
||||||
if status:
|
if status:
|
||||||
print output
|
print output
|
||||||
if FORCE == 0:
|
if FORCE == 0:
|
||||||
@ -381,7 +386,8 @@ def devices_info():
|
|||||||
elif 'sfp' == key:
|
elif 'sfp' == key:
|
||||||
for k in range(0,DEVICE_NO[key]):
|
for k in range(0,DEVICE_NO[key]):
|
||||||
node = key+str(k+1)
|
node = key+str(k+1)
|
||||||
path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j]
|
fmt = i2c_prefix+"19-0060/{0}_{1}"
|
||||||
|
path = fmt.format(nodes[j], k+1)
|
||||||
my_log(node+": "+ path)
|
my_log(node+": "+ path)
|
||||||
ALL_DEVICE[key][node].append(path)
|
ALL_DEVICE[key][node].append(path)
|
||||||
else:
|
else:
|
||||||
@ -416,10 +422,8 @@ def show_eeprom(index):
|
|||||||
print("Please install first!")
|
print("Please install first!")
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(ALL_DEVICE)==0:
|
i = int(index)-1
|
||||||
devices_info()
|
node = i2c_prefix+ str(sfp_map[i])+ i2c_bus['sfp'][0]+"/"+ 'eeprom'
|
||||||
node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0]
|
|
||||||
node = node.replace(node.split("/")[-1], 'sfp_eeprom')
|
|
||||||
# check if got hexdump command in current environment
|
# check if got hexdump command in current environment
|
||||||
ret, log = log_os_system("which hexdump", 0)
|
ret, log = log_os_system("which hexdump", 0)
|
||||||
ret, log2 = log_os_system("which busybox hexdump", 0)
|
ret, log2 = log_os_system("which busybox hexdump", 0)
|
||||||
@ -434,7 +438,7 @@ def show_eeprom(index):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
print node + ":"
|
print node + ":"
|
||||||
ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1)
|
ret, log = log_os_system(hex_cmd +" -C "+node, 1)
|
||||||
if ret==0:
|
if ret==0:
|
||||||
print log
|
print log
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user